codewithmukesh/dotnet-claude-kit/ddd
Claude Code and agent skill by codewithmukesh/dotnet-claude-kit
- community
Checking that the SKILL.md file is still in the repository.
Domain-Driven Design tactical patterns for .NET applications. Covers aggregates, aggregate roots, value objects, domain events, domain services, strongly-typed IDs, and repository patterns for aggregate persistence. Load this skill when implementing DDD, working with aggregates, value objects, domain events, bounded contexts, or when the architecture-advisor recommends DDD + Clean Architecture. Pair with the clean-architecture skill.
Install
npx vskill@latest install codewithmukesh/dotnet-claude-kit/dddSKILL.md
The same SKILL.md was published earlier as codewithmukesh/dotnet-claude-kit/ddd.
Domain-Driven Design (DDD)
Core Principles
- Aggregates define consistency boundaries — An aggregate is a cluster of entities and value objects treated as a single unit for data changes. All invariants within an aggregate are enforced in a single transaction. Cross-aggregate consistency is eventual.
- Value objects over primitives — Replace primitive obsession with value objects.
Money,EmailAddress,OrderNumberare not strings — they carry validation, equality, and behavior. Use C# records for immutable value objects. - Domain events decouple side effects — When something meaningful happens in the domain (OrderPlaced, PaymentReceived), raise a domain event. Side effects (send email, update read model, notify another aggregate) subscribe to these events. The aggregate stays focused on its own rules.
- Aggregate root is the sole entry point — External code accesses an aggregate only through its root entity. Child entities are never loaded or modified independently. The root enforces all invariants for the entire aggregate.
- Repositories persist aggregates, not entities — One repository per aggregate root. The repository loads and saves the entire aggregate as a unit. No repository for child entities. The Infrastructure implementation uses
DbContextinternally — this is a DDD tactical pattern for aggregate boundaries, not a generic CRUD wrapper.
Patterns
Aggregate Root
The aggregate root owns all access to its children and enforces invariants:
Value Objects as Records
Use C# records for immutable value objects with structural equality:
Strongly-Typed IDs with EF Core Converters
Prevent mixing up GUIDs from different entities:
Domain Event Dispatching
Raise events in the aggregate, dispatch in SaveChangesAsync:
Domain Services
For logic that does not belong to a single aggregate:
Anti-patterns
Oversized Aggregates
Domain Events for Intra-Aggregate Logic
Value Objects with Identity
Anemic Aggregates
Decision Guide
| Scenario | Recommendation | |
|---|---|---|
| When to use DDD | Complex domain with business rules that go beyond CRUD | |
| When to use value objects | Any concept with validation rules or equality based on attributes, not identity | |
| Aggregate size | Keep small — typically 1 root entity + 0-3 child entities. Load the whole aggregate every time | |
| Domain events vs integration events | Domain events: within bounded context, same transaction. Integration events: cross-context, via message bus | |
| Strongly-typed IDs | Always for aggregate root IDs that cross boundaries. Optional for child entity IDs | |
| When NOT to use DDD | Simple CRUD, settings, audit logs, read models — use plain entities | |
| Repository vs DbContext | Repository per aggregate root for complex aggregates; IAppDbContext for simpler queries | |
| Domain services | Only when logic requires multiple aggregates or external data the aggregate should not know about |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ddd/SKILL.md
Popularity
- Repository stars
- 655
- Repository forks
- 150
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/codewithmukesh/dotnet-claude-kit/ddd)