New to Claude Skills? Learn how to install them →

Ttech-leads-club on GitHub

Tactical DDD

Free

Transform anemic domain models into rich, encapsulated structures.

Get this skill

Free · Opens the source repo

What Tactical DDD does

Tactical DDD is a skill designed for developers and designers who want to enhance their domain-driven design practices. This skill focuses on detecting anemic domain models, which are often characterized by a lack of encapsulation and behavior, and refactoring them into rich domain models that adhere to tactical DDD principles. By leveraging this skill, users can ensure that their code aligns with best practices in domain modeling, improving maintainability and clarity.

The skill operates in three distinct phases. In the first phase, it scans the provided code for signs of anemia, producing a severity score and identifying affected classes. This diagnostic phase helps users understand the current state of their domain models. In the second phase, the skill assesses each affected class to determine the appropriate building block, such as Entities, Value Objects, or Aggregates, based on specific criteria. This structured approach promotes thoughtful design decisions that prioritize encapsulation and proper modeling.

If the user opts for refactoring, the skill enters its third phase, applying a series of recommended changes to enhance the domain model. These include replacing setter chains with expressive methods, moving service logic into the relevant Aggregates, and implementing business guards. The skill emphasizes the importance of encapsulation and behavior within domain models, guiding users toward a more robust implementation of DDD principles.

This skill is particularly useful for developers working on complex systems where domain modeling is critical. By detecting and addressing anemic models, it helps teams maintain a clear and effective domain language, ultimately leading to better software design and implementation.

When to use it

Use this skill when you need to validate, review, or refactor domain models and DDD code, particularly when terms like 'anemic model' or 'rich domain' are mentioned.

When not to use it

This skill is not suitable for module or service boundary design, architectural decomposition, or code outside the domain layer such as DTOs or infrastructure adapters.

What you can build with it

Validating Domain Models

Use this skill to check if your domain models adhere to DDD principles and identify any areas needing improvement.

Refactoring Anemic Models

Apply this skill to refactor identified anemic domain models into rich structures that encapsulate behavior and state.

Improving DDD Practices

Leverage this skill to reinforce your team's understanding of tactical DDD patterns and improve overall code quality.

How to install Tactical DDD

View source

1. Install with the skills CLI

npx skills add tech-leads-club/agent-skills/tactical-ddd --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by tech-leads-club

Tactical DDD — Rich Domain Modeling

Workflow

Determine the user's intent first:

IntentPhases 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
YesEntity
NoValue Object
Yes (root) + children with shared invariantsYesAggregate
Operation spans multiple Aggregates/doesn't belong to anyDomain 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:

  1. Replace setter chains with a single expressive method
  2. Move service logic into the Aggregate that owns it
  3. Add business guards at the top of each method
  4. Publish a Domain Event after each successful state change
  5. 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

  1. Behaviour with data — Objects own both state and the operations that change it
  2. Ubiquitous Language — Method names come from the domain, not CRUD (commitTo, not setStatus)
  3. Small Aggregates — Root + Value Objects by default; add child Entities only for true invariants
  4. One transaction = one Aggregate — Cross-Aggregate rules use eventual consistency via Domain Events
  5. Reference by ID — Never hold object references to other Aggregates
  6. Value Objects first — Use Entities only when individual identity is essential
  7. Domain Services sparingly — Excessive services → anemic model
  8. 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.

Frequently asked questions about Tactical DDD

Similar skills