Use proactively after non-trivial changes in src/ to review architecture compliance (layer rules, requestbus/DBGateway patterns from CLAUDE.md) AND security/authorization correctness — verify that admin-only parameters cannot be supplied by regular users, that user-facing responses don't leak internal/business data…
Runs before the agent uses a tool for Edit, Write, MultiEdit and Bash tool calls, executing guard_paths.py, guard_layers.py and pre_commit_checks.py (3 commands). From ocbunknown/fastapi-claude-template.
Use when integrating an external HTTP API (Stripe, GitHub, Twilio, a payment provider, etc.) into the project. Enforces the Client + Service split — Client lives in infrastructure and returns raw vendor-shaped Pydantic responses, Service lives in application and maps raw responses to application Result types. Covers…
Use when creating or editing a FastAPI endpoint under src/presentation/http/v1/endpoints/ /. Enforces audience-first organization (public/user/admin/internal), the exact parameter-naming convention (data for bodies, query for GET filters), the five-parameter list shape, correct Require + Authorization wiring, and…
Use when the user asks to create a database migration, change a SQLAlchemy model, add a column, add an index, or otherwise modify the schema. Enforces the rule that migrations are generated via make generate NAME="..." (the project's Makefile target that runs Alembic autogenerate) — never hand-written — and never edit…
Use when creating or extending a repository under src/database/psql/repositories/. Enforces the project's fixed repository vocabulary (create, select, selectmany, update, delete, exists, count, upsert) — no invented methods. Shows exactly how to wrap CRUDRepository, use @onintegrity, build loads-aware selects, and…
Use when creating or extending tests under tests/unit/, tests/integration/, or tests/e2e/. Enforces per-use-case unit coverage, per-endpoint e2e coverage, mutation-persistence verification (not just 200 status), contract-vs-Request field-mismatch detection, loads-opt-in flow tests, role/validation boundary tests, and…
Use when creating or editing a use case under src/application/v1/usecases/. Enforces the RequestBus + UseCase pattern (Request + UseCase in one file, @dataclass(slots=True), returns Result type) and the DBGateway transaction rules — never open two sessions in one use case, never touch self.database outside a context…