# Domain Driven Design

> Use when: model a complex domain with a shared language, bounded contexts, and clear aggregates.

- Skill: `kimtth/domain-driven-design` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kimtth/domain-driven-design`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kimtth/domain-driven-design/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: kimtth (https://skillmd.com/u/kimtth)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kimtth/domain-driven-design

---


Goal: software whose structure mirrors the business domain.

Use for:
- complex domains with rich rules and vocabulary
- untangling a tangled model into clear boundaries
- aligning code with how the business actually speaks

Workflow:
1. Build a ubiquitous language with domain experts.
2. Identify bounded contexts and their boundaries.
3. Model aggregates that enforce invariants as a unit.
4. Separate entities (identity) from value objects (equality by value).
5. Keep domain logic in the model, not in services or controllers.
6. Map context relationships explicitly.

Building blocks:
- entities, value objects, and aggregates
- domain events for cross-aggregate effects
- repositories for aggregate persistence
- anti-corruption layers between contexts

Rules:
- one ubiquitous language per bounded context
- aggregates protect their own invariants
- do not leak domain logic into infrastructure
- keep contexts decoupled; translate at the edges

