Skip to main content
skill CX Codex

tactical-ddd — Claude Code skill: what it does, how to install

Audits domain models for anemia and refactors them into rich aggregates using tactical DDD patterns in Claude Code.

MIT ★ 7,191 updated 2026-10-24

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add tech-leads-club/agent-skills --skill tactical-ddd -a claude-code
Open on GitHub

What tactical-ddd does

The skill inspects domain code across three distinct phases. First, it detects signs of anemia, such as setter chains and service methods that mutate external state. Next, it classifies each affected class into an Entity, Value Object, Aggregate, or Domain Service.

When asked to refactor, the skill replaces naked setters with expressive domain methods and pulls logic from services into aggregates. It adds business guards and emits domain events on successful state changes. The agent presents findings first and asks before changing any file.

This tool stops strictly at the domain boundary. It will not decompose microservices or build strategic context maps, and it deliberately ignores DTOs, controllers, and infrastructure adapters.

What it helps with

  • Spot anemic domain models and public setter chains in domain logic
  • Move business logic from domain services into owning aggregates
  • Replace primitive data fields with dedicated Value Objects
  • Emit domain events after valid entity state transitions

Example prompts for the agent

  • Check the Order class for domain model anemia
  • Refactor our cart entity to follow tactical DDD patterns
  • Review this aggregate and suggest how to protect its invariants

How to install tactical-ddd

1Skills CLI (Vercel)

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

2Manually: put the files in place

~/.claude/skills/tactical-ddd/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tactical-ddd/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tactical-ddd

How to install tactical-ddd in Claude Code?

Run the command npx skills add tech-leads-club/agent-skills --skill tactical-ddd -a claude-code.

What does tactical-ddd do?

It scans domain code for anemia signals, classifies components into tactical DDD building blocks, and rewrites data bags into encapsulated models with business methods.

What code is outside the scope of this skill?

It does not handle strategic DDD context mapping, service boundary decomposition, or layers outside the domain such as DTOs, HTTP controllers, and persistence adapters.

Source text

SKILL.md · MIT
---
name: tactical-ddd
description: 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, strategic DDD context mapping, or code outside the domain layer (DTOs, controllers, infrastructure adapters).
---

# 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](reference.md) directly |

### Phase 1 — Detect
Load [detection.md](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](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](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.

© tech-leads-club · MIT · tech-leads-club/agent-skills

Similar skills

All skills for Code review and refactoring →

From the same set130

The whole set →
state-lift-state state-lift-state — a Claude Code rule that moves React state into a provider component, so siblings outside the main UI read and update it without prop drilling or refs. CX Codex +1 ★ 7,191repo stars js-batch-dom-css js-batch-dom-css prevents layout thrashing by separating style updates from layout queries. Helps Claude write performant DOM and React code. CX Codex +1 ★ 7,191repo stars docs-writer The docs-writer skill creates, edits, and reviews project documentation. Use it for READMEs, Markdown files, and pages under docs/. CX Codex +1 ★ 7,191repo stars perf-astro The perf-astro Claude Code skill tunes Astro builds with inlined critical CSS, minification, non-blocking fonts and an LCP preload, aiming for 95+ Lighthouse scores. CX Codex +1 ★ 7,191repo stars nx-workspace nx-workspace — a skill for exploring an Nx monorepo from the CLI: list projects, read resolved config, find affected projects and wire affected commands into CI. CX Codex +1 ★ 7,191repo stars perf-web-optimization perf-web-optimization guides front-end performance tuning by shrinking JS bundles, deferring heavy scripts, and configuring cache headers. Best when pages load slowly or fail speed benchmarks. CX Codex +1 ★ 7,191repo stars state-context-interface The state-context-interface rule separates a component’s UI from its state implementation with a context split into state, actions, and meta. Use it when the same UI needs to work with different providers. CX Codex +1 ★ 7,191repo stars learning-opportunities learning-opportunities adds optional 10–15 minute exercises to a Claude session, so the person who shipped the code can still explain how it works. CX Codex +1 ★ 7,191repo stars

Project sponsors

Companies that keep this analytics open