ddd-repository
Installation
SKILL.md
One-line summary
A repository hides persistence behind the illusion of an in-memory collection of aggregates — domain code does not know whether storage is SQL, key-value, or in-memory.
When to use this skill
- Loading or saving aggregates by identity.
- Replacing ad-hoc DAOs that leak persistence types into the domain.
- Defining a small set of domain-meaningful queries (
findActiveByCustomer, notfindByStatusEqualsAndCustomerIdEquals).
When NOT to use this skill
- Value objects — they have no identity to look up by.
- Cross-aggregate queries for display purposes — build a read model, not a repository method.
- Reporting / analytics — those want a query layer optimized for reads, not a domain repository.
Core content
A repository serves one aggregate root. Its interface lives in the domain layer; its implementation lives in the infrastructure layer. Domain code depends only on the interface; infrastructure code wires the implementation.