This repository contains production-ready DDD skills designed specifically for use with Claude Code, Anthropic's official CLI for Claude.
Universal Applicability: While explained using C# and .NET, these patterns apply to any object-oriented programming language (Java, TypeScript, Python, etc.). The principles of DDD and hexagonal architecture are language-agnostic.
This is a skills library for object-oriented development with Claude Code, focusing on:
- Domain-Driven Design (DDD) patterns (language-agnostic principles)
- Data Persistence implementations (demonstrated with one ORM approach)
- BDD-Style Unit Testing with in-memory database support
- Hexagonal Architecture (Ports and Adapters) patterns
- CQRS command and query separation
- Production-tested code from real-world projects
This repository serves as a reference and pattern library for Claude Code when working on object-oriented projects. The skills contained here provide:
- Comprehensive documentation of DDD, data persistence, and unit testing patterns
- Code templates for common scenarios (in C#, adaptable to other languages)
- Best practices and anti-patterns to avoid
- Quick reference guides for implementation
- Production-proven examples from real projects
You can install these skills as plugins directly in Claude Code using the /plugin command:
/plugin marketplace add https://github.com/nesbo/dotnet-claude-code-skillsThis will install all available skills (ddd-dotnet, data-dotnet, bdd-dotnet, and add-serena) from this repository, making them immediately available in your Claude Code sessions.
When working with Claude Code on your .NET project, reference skills from this repository:
"Using the patterns from dotnet-claude-code-skills/ddd-dotnet, create a new aggregate for Product"
"Following the data-dotnet skill, implement the repository for Product"
"Using the bdd-dotnet skill, write unit tests for the CreateProduct command handler"
"Review this code against the patterns in dotnet-claude-code-skills"
Clone this repository to have the skills available as reference material:
git clone https://github.com/nesbo/dotnet-claude-code-skills.git
cd dotnet-claude-code-skillsThen reference the skills in your Claude Code sessions by providing the path to the skill files.
Copy relevant skill documentation into your own project's documentation folder for project-specific reference.
Complete guide to implementing Domain-Driven Design in .NET with:
- Aggregate and Entity patterns
- Command and Query handlers (CQRS)
- Repository interfaces
- Domain exceptions
- Time control patterns (IClock)
- Quick reference templates
Read: ddd-dotnet/SKILL.md
Complete guide to implementing data persistence as an adapter layer (demonstrated with one ORM approach):
- Data context configuration
- Entity-to-storage mapping
- Repository implementations
- Unit of Work pattern
- Auto-registration with DI
- Migration workflows
Read: data-dotnet/SKILL.md
Complete guide to BDD-style unit testing for domain layer handlers:
- Testing philosophy (hybrid approach with real repositories)
- TestDataBuilder and TestContextFactory patterns
- Fluent aggregate builders for test data
- Fake implementations (FakeClock, FakeUnitOfWork, etc.)
- Arrange-Act-Assert pattern
- NUnit conventions and assertions
- Testing patterns for commands, queries, workflows, and errors
Read: bdd-dotnet/SKILL.md
Complete guide to adding Serena MCP for IDE-like semantic code understanding:
- Per-project configuration with true multi-project support
- Interactive setup (language, version control, permissions)
- Portable helper script approach
- Symbol-level navigation and LSP integration
- Project-specific memory and state management
- Decision guides for team vs personal configuration
- Troubleshooting and migration guides
Read: add-serena/SKILL.md
These skills implement Hexagonal Architecture (Ports and Adapters):
┌─────────────────────────────────┐
│ Adapters (Infrastructure) │
│ - Web API │
│ - Blazor Apps │
│ - Data Persistence ◄──────┼─── data-dotnet/
│ - Service Clients │
└─────────────────────────────────┘
▲
│ implements
▼
┌─────────────────────────────────┐
│ Ports (Domain Layer) │
│ - Aggregates & Entities ◄─────┼─── ddd-dotnet/
│ - Command Handlers │
│ - Query Handlers │
│ - Repository Interfaces │
└─────────────────────────────────┘
▲
│ tests
│
┌───────────────┐
│ Unit Tests │ ◄──────────────── bdd-dotnet/
└───────────────┘
Key Principle: The domain layer (ports) defines interfaces. The infrastructure layer (adapters) implements them. Dependencies flow inward. Tests verify domain behavior using real repositories.
These skills are demonstrated using:
- .NET 8+ with C# 12 (primary constructors, collection expressions)
- One ORM approach for data persistence examples
- NUnit 3+ for unit testing examples
- Paramore.Brighter for CQRS command handling (one implementation approach)
- PostgreSQL examples (patterns work with any database)
The underlying DDD and hexagonal architecture patterns apply to any OOP language and technology stack.
Here are example prompts to use with Claude Code when referencing these skills:
"Using the ddd-dotnet skill patterns, create a new Order aggregate that tracks order status changes"
"Review my ShoppingCart aggregate against the ddd-dotnet best practices"
"Implement a command handler for UpdateInventory following the ddd-dotnet patterns"
"Following data-dotnet patterns, create data persistence configurations for the Order aggregate"
"Implement write and query repositories for Product using the data-dotnet skill"
"Review my data persistence configurations against data-dotnet best practices"
"Using the bdd-dotnet skill, write unit tests for the CreateProduct command handler"
"Following bdd-dotnet patterns, create a test data builder for the Order aggregate"
"Using the bdd-dotnet skill, write tests for workflow state transitions in ImportWorkflow"
"Review my unit tests against the bdd-dotnet best practices"
"Using the add-serena skill, add Serena MCP to my current project"
"Using add-serena, set up Serena with per-project configuration for this project"
"Following the add-serena skill, add Serena to multiple projects independently"
"Using the add-serena skill, troubleshoot why Serena MCP is not loading"
"Review my Serena configuration against the add-serena best practices"
"Using ddd-dotnet, data-dotnet, and bdd-dotnet skills, implement a complete feature for managing product inventory including:
1. Domain aggregate and entities
2. Command and query handlers
3. Data persistence configurations
4. Repositories
5. Unit tests for all handlers"
"Using add-serena skill, add Serena MCP to my project for semantic code understanding"
"Using add-serena and ddd-dotnet skills, set up my project with per-project Serena MCP and foundational DDD patterns"
"Using ddd-dotnet, data-dotnet, bdd-dotnet, and add-serena skills, help me set up a complete .NET project with DDD architecture and semantic code understanding"
These skills are based on production code and are continuously refined. They reflect:
- Modern .NET best practices
- Real-world architectural patterns
- Lessons learned from production systems
- Industry-standard approaches to DDD and CQRS
Important: This repository is NOT a package or framework to install. It's a knowledge base and pattern library designed to:
- Guide Claude Code in generating consistent, high-quality OOP code
- Provide reference implementations for common patterns (shown in C#)
- Document best practices and anti-patterns
- Serve as templates for your own implementations (in any OOP language)
These skills can be extended with additional patterns:
- API layer patterns
- Authentication and authorization patterns
- Background job processing
- Event-driven architectures
- Integration and E2E testing patterns
- Alternative ORM implementations
- Other language implementations (Java, TypeScript, Python)
Follow the existing format when adding new skills:
- Create a new folder with descriptive name
- Add
SKILL.mdwith comprehensive documentation - Add
README.mdwith overview - Update main
README.mdto reference the new skill
This repository is provided for educational and professional development purposes. The patterns and code examples are based on real production code but are presented as generic, reusable patterns.
Made for: Software Engineers using Claude Code Focus: Domain-Driven Design, CQRS, Hexagonal Architecture (language-agnostic) Demonstrated in: .NET 8+ and C# 12 Applicable to: Any OOP language (Java, TypeScript, Python, etc.)