Codebase Design
Prefer deep modules: useful behaviour behind a small interface at a clean seam.
Default flow
Handler → Service → Repository. Handlers translate protocol concerns (thin). Services own business rules and orchestration. Repositories own persistence only. Adapters isolate external systems.
Rules
- Preserve existing boundaries unless the change is explicitly about moving them.
- Put a rule where all callers naturally pass through it.
- Prefer explicit request flow over hidden magic.
- Delete speculative layers, single-use interfaces, and config for values that never vary.
- Name domain concepts with words from
CONTEXT.mdwhen the repo has one.
Completion: each changed behavior has one natural owner, callers cross the intended seam, and the resulting boundary is easier to test than the old one.