What problem does it solve?
Projects often suffer from blurred layer responsibilities, transaction leakage, tight coupling between modules, and inconsistent testing boundaries, which lead to brittle backends and hard-to-maintain code.
Core Features & Use Cases
- Layered Contracts: Enforces
route -> service -> repository -> db separation so HTTP handlers remain transport-only and services hold business logic.
- DTO-Based Service API: Mandates Pydantic DTOs for service inputs and outputs to stabilize contracts and avoid leaking ORM models.
- Centralized Transaction Management: Confines commit/rollback to the dependency/session manager (get_db) and prescribes flush/refresh semantics in repositories.
- Module Isolation & Testing Matrix: Prescribes service-to-service cross-module calls, facade/orchestrator patterns for multi-module workflows, and a strict testing mocking matrix (router mocks service, service mocks repo, repo uses real DB).
- HTMX Guidance (Optional): Provides decorator-based patterns and response semantics when HTMX-driven views are relevant.
- Use Case: Add a new update endpoint that preserves DTO boundaries, uses provider wiring for service/repository, keeps services transaction-unaware, and includes layered tests as specified.
Quick Start
Read STRUCTURE.md, consult the required references for your change, and ask for route, service, repository, DTOs, dependency providers, and tests that follow the skill's non-negotiable rules.