ddd
Skill0 starsChanged 5 months agoMITView on GitHub
Domain-driven design (Evans-style). Use when modelling domains, structuring modules, naming things, or reviewing domain model design. TRIGGER when: user asks about domain modelling, bounded contexts, aggregates, entities vs value objects, or ubiquitous language. DO NOT TRIGGER when: purely algorithmic code with no domain model.
21 other projects use a version of this.
Adopted by
Most recently taken up by
- tcztzy/skillstheir own version, first seen Nov 8, 2026
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- usetemi/skillstheir own version, first seen Nov 8, 2026
- zdanovichnick/dotnet-pilottheir own version, first seen Nov 6, 2026
- svngoku/coding-agents-skillstheir own version, first seen Nov 1, 2026
- fabiandistler/agentstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use convention-learner, opentelemetry and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
codewithmukeshSkillconvention-learner
Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".
Also in 3 projects that use this
codewithmukeshSkillopentelemetry
OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".
Also in 3 projects that use this
MovGP0Skillmodern-csharp
Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.
Also in 3 projects that use this
MicrosoftSkillresilience
Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.
Also in 3 projects that use this
hongyuancSkillvertical-slice
Build and evaluate a production-quality vertical slice before advancing from Pre-Production to Production.
Also in 3 projects that use this
wpankSkillcaching
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Also in 3 projects that use this
Other versions21 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 21
- rome-os/rome★ 894same name
- codewithmukesh/dotnet-claude-kit★ 808same name
- systeminit/swamp★ 695same name
- Resgrid/Core★ 238same name
- NTCoding/living-architecture★ 139same name
- romiluz13/mifal★ 44same name
- DGouron/review-flow★ 42same name
- grndlvl/software-patterns★ 17same name
- jackjin1997/ClawForge★ 12same name
- svngoku/coding-agents-skills★ 12same name
11 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- clean-codeSkill
- create-design-briefSkill
- goosSkill
- ingest-designSkill
- kaizenSkill
- panelSkill
- researchSkill
- review-loopSkill
- software-designSkill
- sopSkill
- synthesizeSkill
- tddSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. 0 are common, 29 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 19 edited versions we read keep these.
29
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Every class, method, parameter, and module name must come from the domain language -- the terms the user (domain expert) would use.
- Distinctive: line 14
If a name in the code does not map to a concept a domain expert would recognise, rename it.
- Distinctive: line 15
If two different concepts share a name, you have a Bounded Context problem (see Strategic Design below).
- Distinctive: line 20
When introducing a domain concept, classify it using this table:
- Distinctive: line 31
Default to Value Object: Only use Entity when identity matters independent of attributes.
- Distinctive: line 37
Keep Entities lean -- push attribute-heavy logic into Value Objects owned by the Entity.
- Distinctive: line 42
Immutable: no setters, no mutation. All operations return new instances.
- Distinctive: line 45
Use VOs for: measurements, quantities, ranges, money, dates, addresses, coordinates, descriptions, identifiers (when identity itself is a …
- Very specific: line 46
When an Entity has a cluster of related attributes (e.g., street/city/zip), extract a Value Object.
- Distinctive: line 50
Use a Domain Service when an operation:
- Distinctive: line 56
Do not put domain logic in application Services.
- Distinctive: line 64
Every Aggregate has exactly one root Entity.
- Distinctive: line 67
Only the root may be retrieved from a Repository.
- Distinctive: line 72
All invariants within the boundary are enforced on every state change -- the boundary is the transaction boundary.
- Distinctive: line 77
Keep Aggregates small: Prefer a single Entity root with Value Objects.
- Distinctive: line 82
When defining an Aggregate:
- Distinctive: line 93
No query technology leaks into the domain layer -- no SQL, no ORM query builders, no storage-specific types.
- Distinctive: line 99
Use a Factory when constructing an Aggregate requires assembling multiple parts or enforcing invariants that a simple constructor cannot …
- Distinctive: line 101
Every object produced by a Factory must satisfy all invariants -- an Aggregate that exists is valid.
- Distinctive: line 102
Do not use Factories for reconstitution from storage.
- Distinctive: line 118
If a name requires a comment to explain, rename it.
- Distinctive: line 123
Place as much domain logic as possible in functions on Value Objects -- these are naturally side-effect-free.
- Distinctive: line 124
When a command is necessary, keep it simple and do not return domain data from it.
- Distinctive: line 134
If adding a feature requires modifying many unrelated classes, your contours are wrong.
- Distinctive: line 148
When domain logic is buried in conditionals, boolean flags, or string comparisons, a concept is implicit.
- Distinctive: line 163
When you notice the same term meaning different things in different parts of the codebase, you have discovered a context boundary.
- Distinctive: line 184
When wrapping an external system:
- Distinctive: line 213
When code is hard to extend, suspect the model first, not the code structure.
- Distinctive: line 214
When domain experts describe a concept the code cannot express, add the concept to the model.
- Distinctive: line 215
When a name feels wrong, it is wrong.
“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DDD -- Domain-Driven Design
You structure domain code using Evans-style domain-driven design. Follow these rules exactly.
Ubiquitous Language
Every class, method, parameter, and module name must come from the domain language -- the terms the user (domain expert) would use. When you introduce a new domain concept, name it in the language of the problem, not the language of the solution.
- If a name in the code does not map to a concept a domain expert would recognise, rename it.
- If two different concepts share a name, you have a Bounded Context problem (see Strategic Design below).
- A change to the naming is a change to the model. Treat it as such.
Choosing Building Blocks
When introducing a domain concept, classify it using this table:
| If the concept... | It is a... | Key design rule |
| Has a lifecycle and must be tracked across state changes | Entity | Define identity explicitly. Equality by identity, not attributes. |
| Is defined entirely by its attributes, with no lifecycle | Value Object | Make immutable. Equality by all attributes. Operations return new instances. |
| Is an operation that does not belong to any Entity or VO | Domain Service | Make stateless. Name from domain. Interface uses domain types only. |
| Is a cluster of objects with consistency rules between them | Aggregate | Define a root Entity. Enforce invariants at the boundary. |
| Is a rule or predicate about a domain object | Specification | Make a first-class object. Compose with AND/OR/NOT. |
| Is an interchangeable algorithm for a domain goal | Policy/Strategy | Use Strategy pattern. Name from domain ("OverbookingPolicy"), not pattern. |
Default to Value Object. Only use Entity when identity matters independent of attributes. Value Objects are simpler, safer, and easier to test.
Entities
- Define identity with a single, stable, unique identifier. Do not use mutable attributes as identity.
- Implement equality and hashing based on identity only.
- Keep Entities lean -- push attribute-heavy logic into Value Objects owned by the Entity.
- An Entity's primary responsibility is maintaining identity continuity and enforcing invariants on its lifecycle transitions.
Value Objects
- Immutable: no setters, no mutation. All operations return new instances.
- Equality by attributes: two VOs with identical attributes are interchangeable.
- Self-validating: reject invalid state at construction time. A VO that exists is valid.
- Use VOs for: measurements, quantities, ranges, money, dates, addresses, coordinates, descriptions, identifiers (when identity itself is a value -- e.g. ISBN, SSN).
- When an Entity has a cluster of related attributes (e.g., street/city/zip), extract a Value Object.
Domain Services
Use a Domain Service when an operation:
- Involves multiple Aggregates and does not naturally belong to any one of them.
- Is expressed as a verb phrase in the Ubiquitous Language (e.g., "transfer funds between accounts").
- Is stateless -- it depends only on its arguments and injected Repositories/Services.
Do not put domain logic in application Services. Application Services orchestrate (load Aggregate, call domain method, save); domain logic lives in Entities, VOs, and Domain Services.
Aggregates
Aggregates enforce consistency boundaries. These rules are non-negotiable:
Boundary Rules
- Every Aggregate has exactly one root Entity.
- External objects may hold references only to the root. Never expose internal objects.
- Internal objects may hold references to other Aggregate roots.
- Only the root may be retrieved from a Repository. Internal objects are reached by traversal.
- Deleting the root deletes everything inside the boundary.
Invariant Rules
- All invariants within the boundary are enforced on every state change -- the boundary is the transaction boundary.
- Invariants that span Aggregates use eventual consistency, not transactional consistency.
Sizing Rules
- Keep Aggregates small. Prefer a single Entity root with Value Objects. Add child Entities only when an invariant demands it.
- Reference other Aggregates by identity (store the ID), not by direct object reference.
Design Procedure
When defining an Aggregate:
- Identify the invariants. What rules must always be true?
- Find the smallest cluster of objects needed to enforce those invariants. That is your boundary.
- Choose the root -- the Entity that owns the invariants and is the entry point.
- Everything outside the boundary references the root by identity.
Repositories
- Provide one Repository per Aggregate root. Never for internal objects.
- The interface is pure domain language:
find_by_tracking_id(tracking_id), notSELECT * FROM .... - No query technology leaks into the domain layer -- no SQL, no ORM query builders, no storage-specific types.
- A Repository provides the illusion of an in-memory collection. Methods:
add,remove,find_by_*. - Reconstitution (loading from storage) is distinct from creation (use a Factory for creation of new Aggregates).
Factories
- Use a Factory when constructing an Aggregate requires assembling multiple parts or enforcing invariants that a simple constructor cannot express.
- A Factory method can live on the Aggregate root (for creating related objects), on a standalone Factory, or on another domain object that naturally participates in creation.
- Every object produced by a Factory must satisfy all invariants -- an Aggregate that exists is valid.
- Do not use Factories for reconstitution from storage. Repositories handle that.
Modules
- Name modules from the Ubiquitous Language, not from technical roles.
shipping,billing,pricing-- notservices,models,utils. - Low coupling between modules, high cohesion within.
- Module boundaries tell a story about the domain. If you need to explain why two concepts are in the same module, they probably should not be.
Supple Design
Apply these patterns to make domain code easy to use and change:
Intention-Revealing Interfaces
- Name every class and method to state what it does and why, not how. A caller should never need to read the implementation.
- Method name = domain verb phrase. Class name = domain noun.
- If a name requires a comment to explain, rename it.
Side-Effect-Free Functions
- Separate queries (return a result, no side effects) from commands (change state, return nothing).
- Place as much domain logic as possible in functions on Value Objects -- these are naturally side-effect-free.
- When a command is necessary, keep it simple and do not return domain data from it.
Assertions
- State post-conditions and invariants explicitly in docstrings or type contracts.
- Tests should assert invariants, not just outputs. If an Aggregate has a rule "quantity must be positive", test that the rule holds after every operation that touches quantity.
Conceptual Contours
- Decompose along the natural grain of the domain. Elements that change together belong together; elements that change independently should be separate.
- If adding a feature requires modifying many unrelated classes, your contours are wrong.
Standalone Classes
- Reduce dependencies to the minimum. Every dependency is a burden on understanding.
- The ideal: a class that can be understood and tested by reading only its own file plus language primitives.
Closure of Operations
- Where possible, define operations whose argument and return type match the type they are defined on:
Money.add(Money) -> Money,Specification.and(Specification) -> Specification. - Closed operations create composable, self-contained algebras.
Making Implicit Concepts Explicit
When domain logic is buried in conditionals, boolean flags, or string comparisons, a concept is implicit. Surface it:
| Smell | Concept to extract | Implementation |
| Complex conditional selecting/filtering objects | Specification | Object with is_satisfied_by(candidate) -> bool. Compose with and_spec, or_spec, not_spec. |
| Business rule limiting values or combinations | Constraint | Named method or object that raises on violation. |
| If/else selecting between algorithms | Policy/Strategy | Interface + named implementations. Inject the active policy. |
| Multi-step process described by domain experts | Domain Service / Process | Named operation with steps expressed in domain terms. |
| A concept domain experts mention but code lacks | Missing model element | Add it. The model is wrong if it cannot express what domain experts say. |
Strategic Design
Bounded Context
- A model is valid only within its Bounded Context. The same real-world thing may be modelled differently in different contexts.
- When you notice the same term meaning different things in different parts of the codebase, you have discovered a context boundary. Make it explicit.
- Each Bounded Context has its own Ubiquitous Language, its own model, and its own module structure.
Context Map (Solo Dev Adaptation)
Even as a solo developer, map the boundaries between:
- Your domain modules (which may have different models for related concepts).
- External systems you integrate with (APIs, databases, libraries that impose their own model).
- For each boundary, decide the relationship:
| Situation | Pattern | Action |
| You control both sides and they share concepts | Shared Kernel | Extract shared model into a common module. Changes require updating both sides. |
| You depend on an external system you cannot change | Anti-Corruption Layer | Build a translation layer. Your domain never references external types directly. |
| External model is good enough and fighting it adds no value | Conformist | Adopt the external model as-is in your code. |
| Integration cost exceeds value | Separate Ways | Do not integrate. Duplicate if necessary. |
| You expose your model for others to consume | Open Host + Published Language | Define a stable API/schema. Insulate your internal model from the published interface. |
Anti-Corruption Layer
When wrapping an external system:
- Facade: Simplified interface to the external system's API.
- Adapter: Maps between your calling conventions and the external system's protocol.
- Translator: Maps between the external system's model and your domain model.
Your domain code calls the ACL. The ACL calls the external system. Domain types never appear in the external system's namespace and vice versa.
Core Domain Vs Generic Subdomain
- Core Domain: the code that makes the application distinctive. If you removed it, the software would be generic. Invest design effort here. Apply supple design. Refactor toward deeper insight.
- Generic Subdomain: necessary but not distinctive (e.g., money, date arithmetic, authentication). Separate into its own module. Use libraries or published models. Do not over-invest in design -- good enough is sufficient.
Decision test: "If I replaced this module with an off-the-shelf equivalent, would the application lose its distinctive value?" If no, it is a Generic Subdomain.
Layered Architecture
Separate domain logic from everything else. Minimal layers for a solo-dev codebase:
| Layer | Responsibility | Depends on |
| Application | Orchestration. Load Aggregates, call domain methods, save results. | Domain |
| Domain | All domain logic. Entities, VOs, Services, Specifications, Repositories (interfaces). | Nothing above it |
| Infrastructure | Implements domain interfaces (Repository impls, external system clients). | Domain (via interfaces) |
The domain layer has zero dependencies on infrastructure, frameworks, or UI. It depends only on language primitives and its own types. Infrastructure implements domain-defined interfaces (dependency inversion).
Refactoring Toward Deeper Insight
- When code is hard to extend, suspect the model first, not the code structure.
- When domain experts describe a concept the code cannot express, add the concept to the model.
- When a name feels wrong, it is wrong. Rename until the code reads like a domain conversation.
- Prioritise refactoring in the Core Domain. A refactoring in the Core has more leverage than one in a Generic Subdomain.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

