Best use case
domain-driven-design is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
DDD tactical and strategic patterns. Use for complex domains.
Teams using domain-driven-design should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/domain-driven-design/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How domain-driven-design Compares
| Feature / Agent | domain-driven-design | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
DDD tactical and strategic patterns. Use for complex domains.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Domain-Driven Design (DDD)
DDD is a software design approach focusing on modeling software to match a domain according to input from that domain's experts. It is essential for tackling high complexity in the heart of software.
## When to Use
- Complex business domains (e.g., Insurance, Banking, Logistics) where logic is intricate.
- When there is a communication gap between developers and business experts.
- decomposing a Monolith into Microservices (defining boundaries).
## Quick Start
```java
// Aggregate Root
public class Order {
private OrderId id;
private Money totalAmount;
private OrderStatus status;
private List<OrderItem> items; // Aggregates items
// Behaviors (Rich Model), not just Getters/Setters
public void addItem(Product product, int quantity) {
if (this.status != OrderStatus.DRAFT) {
throw new DomainException("Cannot modify confirmed order");
}
this.items.add(new OrderItem(product, quantity));
recalculateTotal();
}
public void confirm() {
if (items.isEmpty()) throw new DomainException("Order empty");
this.status = OrderStatus.CONFIRMED;
// Raise Domain Event
DomainEvents.publish(new OrderConfirmed(this.id));
}
}
```
## Core Concepts
### Ubiquitous Language
A common, rigorous language shared by developers and domain experts. If the expert calls it a "Policy", the code must call it `Policy`, not `UserPlan` or `Subscription`.
### Bounded Context
The specific boundary within which a particular domain model is defined and applicable. Ideally maps to a Microservice or a Module.
### Aggregates
A cluster of associated objects treated as a unit for data changes. External objects can only hold references to the **Aggregate Root**.
## Common Patterns
### Value Objects
Immutable objects defined by their attributes, not identity (e.g., `Money`, `Address`, `Email`). Two `Money(5)` objects are equal.
### Domain Events
Something that happened in the domain that domain experts care about (`OrderShipped`, `AccountDebited`). Used to decouple side effects.
### Anti-Corruption Layer (ACL)
A layer that translates models from an external system (or legacy subsystem) into the model of the current Bounded Context to prevent pollution.
## Best Practices
**Do**:
- Focus on **Behaviors**, not just Data (Anemic Domain Model vs Rich Domain Model).
- Use **Event Storming** sessions to discover the domain events and boundaries.
- Ensure **Transactional Consistency** within an Aggregate, and **Eventual Consistency** between Aggregates.
**Don't**:
- Don't apply DDD to simple CRUD domains (it's overkill).
- Don't let Aggregates reference each other by Object Pointer; use IDs.
## Troubleshooting
| Error | Cause | Solution |
| :------------ | :-------------------------- | :--------------------------------------------------------------------- |
| `God Class` | Aggregate knowing too much. | Split Aggregates; use Domain Events to coordinate. |
| `Performance` | Loading huge Aggregates. | Lazy load is tricky; prefer smaller Aggregates tailored to invariants. |
## References
- [Domain-Driven Design (Eric Evans)](https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215)
- [Implementing Domain-Driven Design (Vaughn Vernon)](https://img.shields.io/badge/book-red)Related Skills
event-driven
Event-driven architecture with pub/sub and message queues. Use for reactive systems.
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.