tactical-ddd

Detects anemic domain models and refactors them into rich tactical DDD building blocks.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Peterson-Benhame/agent-skills --skill tactical-ddd-peterson-benhame
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tactical-ddd
Source: https://github.com/Peterson-Benhame/agent-skills/tree/main/packages/skills-catalog/skills/%28architecture%29/tactical-ddd
Command: npx skills add https://github.com/Peterson-Benhame/agent-skills --skill tactical-ddd-peterson-benhame

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Domain code often degrades into anemic models where entities are pure data bags with public setters and all business logic leaks into services, making invariants unenforceable and behaviour hard to trace. This Skill diagnoses that anemia with a weighted severity score and guides the refactoring into rich domain models using tactical DDD patterns. ## Core Features & Use Cases - Anemia Detection: Scans code for signals like public setters, setter chains, coordinator services, and primitive obsession, producing a severity score from None to Severe. - Building Block Classification: Determines whether each class should be an Entity, Value Object, Aggregate, or Domain Service based on identity and invariant rules. - Guided Refactoring: Applies ordered moves such as replacing setter chains with intent methods, pulling service logic into Aggregates, extracting Value Objects, adding business guards, and publishing Domain Events. - Use Case: When reviewing an Order class manipulated by an OrderService through three setters, the Skill flags it as anemic and refactors it into an order.confirm() method with guards and an OrderConfirmed domain event. ## Quick Start Ask the assistant to review your domain model classes for anemic patterns and refactor them following tactical DDD principles.

Frequently Asked Questions about tactical-ddd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect an anemic domain model in my code?

Scan for public setters, setter chains performing one operation, classes with only getters and setters, and services that fetch entities then mutate them. Each signal carries a weight; a summed score of 7 or higher indicates a severe anemic model needing full redesign.

How to refactor setter chains into rich domain methods?

Replace multiple setter calls with a single expressive method named from the Ubiquitous Language, such as order.confirm(userId). Place business guards at the top of the method, mutate state, then publish a past-tense Domain Event like OrderConfirmed.

When should I use a Value Object instead of an Entity?

Use a Value Object when the concept is defined by its attributes and needs no individual identity, such as Money, EmailAddress, or CustomerId. Value Objects must be fully immutable, validate on construction, compare by value equality, and return new instances from methods.

What is the difference between a Domain Service and an Application Service?

A Domain Service holds stateless business rules spanning multiple Aggregates, like authentication across Tenant and User. An Application Service only coordinates: loading Aggregates from repositories, managing transactions, calling Domain Services, and mapping to DTOs.

When should this DDD skill not be used?

Do not use it for module or service boundary design, strategic DDD context mapping, or architectural decomposition. It also excludes code outside the domain layer such as DTOs, controllers, and infrastructure adapters.