tactical-ddd
What it does
This skill has the AI review software models for business rules that are missing or scattered, then refactor them so the rules live inside the objects. It is for developers who want their domain code to protect its own rules.
When to use it
- βWhen you ask the AI to review or check domain models for weak design.
- βWhen your domain objects are only data holders and the rules sit in other services.
- βWhen you want to refactor code into entities, value objects or aggregates.
Skill link
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/tactical-ddd/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCheck our order and invoice classes and tell me if they are just data bags, and what to do about it.β
5 new skills a week. 1 minute to read.
How it works
The AI first detects weak models and scores them, then decides which design piece fits each class, and refactors step by step if you ask.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Tactical DDD β Rich Domain Modeling
Workflow
Determine the user's intent first:
| Intent | Phases to run |
|---|---|
| "validate / review / check / is this correct?" | Phase 1 + 2 only β report findings, ask before refactoring |
| "fix / refactor / improve / clean up" | Phase 1 + 2 + 3 |
| "how should I design / model this?" | Load reference.md directly |
Phase 1 β Detect
Load detection.md and scan the target code for anemia signals. Produce a severity score and list of affected classes.
Phase 2 β Assess
For each affected class, determine the correct building block:
| Has unique identity tracked over time? | Has invariants tying multiple objects? | β Building Block |
|---|---|---|
| Yes | β | Entity |
| No | β | Value Object |
| Yes (root) + children with shared invariants | Yes | Aggregate |
| Operation spans multiple Aggregates/doesn't belong to any | β | Domain Service |
Prefer Value Objects over Entities. Prefer small Aggregates over large ones.
If intent was validate/review: stop here. Report findings using the output format below. Ask "Would you like me to apply these fixes?" before proceeding.
Phase 3 β Refactor
Load refactoring.md for step-by-step moves. Apply in this order:
- Replace setter chains with a single expressive method
- Move service logic into the Aggregate that owns it
- Add business guards at the top of each method
- Publish a Domain Event after each successful state change
- Replace primitive types with Value Objects
For deep pattern questions (boundary design, event modeling, service vs. entity decision), load reference.md.
Quick Anemia Signals (scan first)
public setX() / public setY() β behaviour should be encapsulated
service.doX(entity, ...) β logic likely belongs in entity
entity.setA(); entity.setB(); ... β setter chain = missing intent method
no domain methods beyond getters β pure data bag
Golden Rules
- Behaviour with data β Objects own both state and the operations that change it
- Ubiquitous Language β Method names come from the domain, not CRUD (
commitTo, notsetStatus) - Small Aggregates β Root + Value Objects by default; add child Entities only for true invariants
- One transaction = one Aggregate β Cross-Aggregate rules use eventual consistency via Domain Events
- Reference by ID β Never hold object references to other Aggregates
- Value Objects first β Use Entities only when individual identity is essential
- Domain Services sparingly β Excessive services β anemic model
- Protect invariants β The Aggregate is the last line of defence; never trust the caller
Output Format
When reviewing code, report:
## Anemia Diagnosis: <ClassName>
Severity: [None | Mild | Moderate | Severe]
Issues:
- <description of problem>
Recommended refactoring:
- <specific move from refactoring.md>
When refactoring, show a before/after diff for each class touched.
FAQ
Will it change code without asking?
No. If you ask for a review, it reports findings and waits before making changes.
What is an anemic model?
It is a class that holds data but leaves all the business rules somewhere else.
What are value objects?
Small objects without their own identity, such as an amount of money or an address.
Details
Original description by the author
Detects anemic domain models, validates and refactors them into rich domain models, and enforces tactical DDD patterns (Entities, Value Objects, Aggregates, Domain Services, Domain Events). Use when the user asks to validate, review, or check domain models or DDD code; detect anemia; refactor domain objects; improve encapsulation; or mentions terms like "anemic model", "rich domain", "aggregate", "value object", "domain event", "ubiquitous language", "is this good DDD", "does this follow DDD", or "check my domain". Do NOT use for module or service boundary design, architectural decomposition,
Popularity
- GitHub stars
- 7.1k
- Ranking position
- #13512
- License
- β
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
component-common-domain-detection
7.1kHelps your agent find business logic that is repeated across several parts of a codebase and suggests how to combine it.
component-flattening-analysis
7.1kHelps your agent find misplaced code and flatten messy component folder structures, so each piece sits where it belongs.
component-identification-sizing
7.1kHelps your agent map the parts of a codebase and measure their size, to find which module to split first.
coupling-analysis
7.1kHelps your agent check how tightly parts of a codebase depend on each other, and which connections to loosen first.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.