<!-- Generated by scripts/generate_ai_collab_docs.py. Edit metadata in that script. -->

# Backend Service: common

This file adds local guidance for `src/api/flaskr/service/common`. Read the
repository root and `src/api/AGENTS.md` first, then use this file for
module-specific ownership and risk points.

## Scope

- This service owns shared backend DTOs, app exceptions, dictionaries, storage
  helpers, and other cross-service primitives.

- Primary checked-in entry files today:
  `src/api/flaskr/service/common/dtos.py`,
  `src/api/flaskr/service/common/models.py`,
  `src/api/flaskr/service/common/dicts.py`,
  `src/api/flaskr/service/common/storage.py`

- Keep behavior in this module unless the concern is clearly cross-service and
  shared by multiple backend domains.

- Preferred pytest location: `src/api/tests/service/common/` already exists
  and should remain the first stop.

## Do

- Start from the local entry files and preserve how this service already
  structures helpers, models, routes, and DTO-like helpers.

- Treat shared DTOs and app exceptions as compatibility surfaces used by many
  backend modules.

- Keep storage-provider selection and helper behavior centralized here instead
  of branching it in every service.

- Add new cross-service primitives here only when they are genuinely shared
  and not just convenient for one module.

## Avoid

- Do not change shared DTO fields or exception codes without updating all
  consumers in the same task.

- Do not reimplement storage or dictionary helpers inside feature services
  when the shared layer should own them.

- Do not let this module become a grab bag for service-specific logic that
  belongs in a dedicated domain directory.

- Avoid scattering service-specific rules upward into root docs when the
  behavior only matters inside this module.

## Commands

- `rg -n "common" src/api/flaskr/service src/api/tests` to locate all backend
  call sites and tests before editing.

- `cd src/api && pytest tests/service/common/ -q` for the narrowest focused
  regression pass while iterating on this module.

- `cd src/api && pytest -q` is usually enough unless work here also changes
  shared models in another service.

- `cd src/api && pytest -q` when a change touches shared DTOs, auth, streaming
  contracts, or other services in addition to this module.

## Tests

- Add or update focused tests around `src/api/tests/service/common/` for the
  happy path and the highest-risk validation, permission, or failure case.

- Expand coverage when payload shapes, error codes, or shared helper contracts
  used outside this module change.

- Review persistence-related changes manually for indexing, business-key
  semantics, and migration output whenever models move.

- Document any skipped provider, network, or credential-dependent checks in
  the final task summary.

## Related Skills

- `src/api/SKILL.md`

- `SKILL.md`

- Create a new backend skill under `src/api/skills/<topic>/SKILL.md` when this
  module grows a repeatable multi-step debugging workflow.
