DDD — ubiquitous language, bounded contexts and context maps, aggregates and invariants, entities and value objects, domain events, anti-corruption layers, strategic vs tactical design. Use to model a domain, draw service or module boundaries, or design aggregates (DDD, bounded context, aggregate, ubiquitous language, context map, domain events).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Domain Driven Design?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/vectora-os-domain-driven-design)
---
name: domain-driven-design
description: DDD — ubiquitous language, bounded contexts and context maps, aggregates and invariants, entities and value objects, domain events, anti-corruption layers, strategic vs tactical design. Use to model a domain, draw service or module boundaries, or design aggregates (DDD, bounded context, aggregate, ubiquitous language, context map, domain events).
metadata:
category: design-patterns
---
# Domain-driven design
## Purpose
Align software structure with the business domain so that boundaries and rules are explicit.
**Use when:** modelling complex business rules or deciding module/service boundaries.
**Not for:** CRUD-only areas where DDD overhead does not pay off.
## Inputs
- Domain knowledge, glossary, business rules.
## Outputs
- Context map, aggregate designs with invariants, glossary additions.
## Read first
- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "domain-driven design"` for prior decisions, patterns and anti-patterns.
- [Glossary](../../../docs/glossary.md)
- [Architecture standard](../../../standards/architecture.md)
## Steps
1. **Language.** Collect terms with domain experts; add to the glossary.
Done when terms are unambiguous within a context.
2. **Contexts.** Identify bounded contexts and draw the context map (partnership, customer/supplier, ACL, shared kernel).
Done when every context has an owner and relationships.
3. **Aggregates.** Design aggregates around invariants that must be consistent in one transaction; keep them small.
Done when each aggregate lists its invariants.
4. **Events.** Define domain events for cross-aggregate and cross-context reactions.
Done when events are past-tense facts with payload contracts.
## Best practices
- Reference other aggregates by id, not object.
- One aggregate per transaction.
- Use an anti-corruption layer against legacy or external models.
## Common mistakes
- Anemic models with logic in services.
- Giant aggregates causing contention.
- One "Customer" model shared across all contexts.
## Example
Ordering vs Billing contexts: `Order` aggregate enforces line-item rules; `OrderPlaced` event drives invoice creation in Billing through an ACL.
## Reusable prompt
```text
Apply the Domain-driven design skill (.agents/skills/domain-driven-design/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Produce the ubiquitous language, context map and aggregate designs with invariants and domain events for the described domain.
Return: Context map, aggregate designs with invariants, glossary additions..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```