The layersThe five hard rules and the naming that follows
No narration yet
Module 5 · Lesson 211 min

The five hard rules and the naming that follows

The layer map compresses into five rules the CLAUDE.md labels "never violate." Read them once as a set; they'll become instinct fast because breaking one always feels wrong once you've internalised the direction.

The five hard rules (apps/fusion-backend/CLAUDE.md)
1domain/ must not import application/, persistence/, or presentation/
2The DDD base primitives in domain/ have zero external NuGet deps; keep it so
3persistence/ implements interfaces defined in domain/application; never the reverse
4application/ orchestrates; it never contains domain logic
5persistence/ never invokes domain behaviour (no Create factories, no calculations)

Naming keeps the layers from colliding. Use cases in application/ are verb-first: SaveFlightNote, GetFlights, RevertDisruptionDecision. Workers and coordinators in domain/ are noun-first: DisruptionCostCalculator, RateLookup. Splitting the naming by layer means an application concept and a domain concept about the same thing don't clash.

Files are grouped by domain concept, not technical role: application/flight-notes/ holds the use case, its request, and its response together, rather than an application/handlers/ bucket. Co-locating by feature is the same instinct that colocates a React component with its test.

Practice

Try it yourself

Do

Kill a banned name

Do the rename that most changes how the code reads.

Tick every step to confirm you did it.

Recall

Verb-first or noun-first

Know which layer names which way.

Application use cases and domain workers are named differently. Which is verb-first, which is noun-first, and why split them?