ddd-tactical-patterns
Installation
SKILL.md
Entities
Entities have persistent identity that survives state changes. Identity is intrinsic, not derived from attributes.
Rules:
- Identity is immutable and established at creation
- State changes only through explicit methods that enforce invariants
- Equality by identity, not by attribute values
- Raise domain events at meaningful state transitions
class Order
events: List<DomainEvent>
Id: OrderId // Identity — never changes
CustomerId: CustomerId
Status: OrderStatus
DomainEvents: readonly list of events