Nw Ddd Tactical
Tactical DDD, aggregate design rules, entities, value objects, domain events...
Install
npx skills add nWave-ai/nWave --skill nw-ddd-tactical -g -a claude-code -y- Repository
- nWave-ai/nWave628
- Category
- Design
- Updated
- 2mo ago
- License
- MIT
- Context cost
- Mediumabout 1,722 tokens
- Runs scripts
- No, instructions only
What it does
Tactical DDD, aggregate design rules, entities, value objects, domain events, repositories, domain services, and anti-pattern detection
Tactical DDD
Implementation patterns within a bounded context. Tactical DDD answers: "How do we structure the domain model?"
Aggregates
An aggregate is a consistency boundary -- a cluster of domain objects that must be transactionally consistent.
Vernon's Four Design Rules
-
Model true invariants in consistency boundaries: Only include elements that MUST be consistent within the same transaction. If two entities don't share an invariant, they belong in separate aggregates.
-
Design small aggregates: ~70% of aggregates contain only a root entity with value-typed properties. Large aggregates create concurrency contention, scalability failures, and memory pressure.
-
Reference other aggregates by identity: Use
ProductIdnotProduct. Direct object references create accidental cross-aggregate transactions and prevent independent scaling. -
Use eventual consistency outside the boundary: Domain events communicate across aggregates. One transaction = one aggregate. If you need to update two aggregates "atomically," reconsider your boundaries.
Aggregate Design Checklist
- Contains only elements sharing true invariants
- Root entity controls all access (no direct child manipulation)
- External references by ID only (no object graphs)
- Small enough for single-transaction performance
- Command produces events (in event-sourced systems) or mutates state (in traditional)
- Business rules validated in command handling, not in persistence layer


