domain-driven-design
Skill11 starsChanged 11 days agoMITView on GitHub
Apply Domain-Driven Design to complex business logic and module boundaries. Use when modeling domains, bounded contexts, aggregates, value objects, repositories, domain services, policies, domain events, ubiquitous language, or refactoring toward clearer domain behavior. Do not use for focused audits of an existing domain model; use domain-modeling. Avoid simple CRUD or data-centric work without meaningful domain pressure.
25 other projects use a version of this.
Adopted by
Most recently taken up by
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- AntonioMellies/claude-code-skillstheir own version, first seen Nov 1, 2026
- sbrudz/agent-skillstheir own version, first seen Nov 1, 2026
- conjurer-rich/skillstheir own version, first seen Oct 25, 2026
- hugo082/skillstheir own version, first seen Oct 22, 2026
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
Used with
Projects with it also use clean-code and review.
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.
xenitV1Skillclean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
Also in 4 projects that use this
SentrySkillreview
Fixture review skill.
Also in 3 projects that use this
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- ciembor/agent-rules-books★ 2.8ksame name
- wondelai/skills★ 2.6ksame name
- rrezartprebreza/spring-boot-skills★ 344same name
- techygarg/lattice★ 209same name
- fatonh/symfony-skills★ 35same name
- d-padmanabhan/agent-engineering-handbook★ 17same name
- G1Joshi/Agent-Skills★ 15same name
- eralmansouri/skills★ 9same name
- reddygopalkrishna/developer-agent-skills★ 8same name
- bernard-ng/skills★ 4same name
15 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 repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adversarial-reviewSkill
- api-designSkill
- architecture-reviewSkill
- behavior-driven-developmentSkill
- brainstormingSkill
- ci-release-engineeringSkill
- clean-architectureSkill
- code-reviewSkill
- container-engineeringSkill
- create-agent-skillSkill
- csharp-dotnet-engineeringSkill
- css-scss-stylingSkill
- data-platform-engineeringSkill
- dependency-supply-chain-reviewSkill
- digital-asset-managementSkill
- documentation-engineeringSkill
- domain-modelingSkill
- donsetch-web-researchSkill
- gherkinSkill
- git-commitSkill
- git-workflowsSkill
- hexagonal-architectureSkill
- impeccableSkill
- internationalization-localizationSkill
- javascript-typescript-engineeringSkill
- justfilesSkill
- mcp-server-engineeringSkill
- mysql-mariadb-sql-engineeringSkill
- observability-engineeringSkill
- onion-architectureSkill
- parallelism-engineeringSkill
- performance-reviewSkill
- playwright-e2eSkill
- postgresql-sql-engineeringSkill
- prompt-engineering-reviewSkill
- python-antipatternsSkill
- python-design-patternsSkill
- python-engineeringSkill
- random-data-identifiersSkill
- release-readinessSkill
- review-verification-protocolSkill
- root-cause-analysisSkill
- ruby-engineeringSkill
- rust-antipatternsSkill
- rust-async-webSkill
- rust-code-reviewSkill
- rust-design-patternsSkill
- rust-desktop-guiSkill
- rust-engineeringSkill
- rust-persistence-sqlSkill
- rust-testing-qualitySkill
- script-engineeringSkill
- security-review-evidenceSkill
- security-reviewSkill
- semantic-versioningSkill
- sql-engineeringSkill
- sqlite-sql-engineeringSkill
- suggest-lucide-iconsSkill
- svelte-sveltekit-engineeringSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 16 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 23 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use DDD to make important domain behavior explicit, correctly named, and protected from infrastructure concerns.
- Distinctive: line 15
Use DDD when the work involves:
- Distinctive: line 26
Avoid heavy DDD when:
- Distinctive: line 44
Prefer terms used by domain experts and product behavior over technical convenience names.
- Distinctive: line 50
Look for bounded contexts where the same word means different things or where rules change by workflow, team, product area, or integration.
- Distinctive: line 52
Keep context boundaries visible in module names, APIs, tests, and docs when they affect maintainability.
- Distinctive: line 67
Put invariants and decisions in domain types or services, not controllers, resolvers, UI components, SQL snippets, serializers, or job …
- Distinctive: line 70
Keep persistence models separate from domain models when storage shape would leak or weaken invariants.
- Distinctive: line 72
Do not let framework types become part of the core domain API unless the project intentionally treats them as domain primitives.
- Distinctive: line 76
Test invariants, transitions, policies, and domain events at the narrowest useful level.
- Distinctive: line 78
Use integration tests for repository mappings and boundary contracts.
- Distinctive: line 79
Prefer behavior names in tests over implementation names.
- Distinctive: line 82
When implementation begins, load the matching language engineering skill and any data skill needed for persistence, schema, query, or …
- Distinctive: line 92
Before reporting implementation or refactor work complete, run focused checks for the changed behavior, invariants, and boundary mappings.
- Distinctive: line 126
Keep aggregates small; do not load a whole graph just because objects are related.
- Distinctive: line 128
Use domain events for meaningful facts, not as generic callbacks.
“Common” is measured: kept by at least 6 in 10 of the 23 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
Domain-Driven Design
Use DDD to make important domain behavior explicit, correctly named, and protected from infrastructure concerns. Apply it where the domain has enough business meaning to justify modeling; do not turn simple CRUD or unclear ideas into ceremony prematurely.
When to Use
Use DDD when the work involves:
- Business rules, invariants, lifecycle transitions, policies, permissions, or workflows that need durable names.
- Multiple concepts that are easy to confuse without a shared vocabulary.
- Internal logic whose correctness matters beyond a single endpoint, UI screen, job, or database query.
- Refactoring modules so domain behavior is easier to test and maintain.
- Breaking changes that improve domain clarity and the project does not require backwards compatibility.
Avoid heavy DDD when:
- The change is a simple adapter, presentation tweak, migration, or one-off script with little domain behavior.
- The domain language is not yet known; start with simple code and preserve refactoring room.
- Introducing aggregates, repositories, or events would create abstractions with no current rule to protect.
For photo/video catalog work, use
digital-asset-management to establish
the media lifecycle vocabulary before choosing bounded contexts or aggregates.
Workflow
- Discover the language.
- Extract nouns, verbs, states, roles, and constraints from the user request, existing tests, docs, logs, UI copy, APIs, and database names.
- Prefer terms used by domain experts and product behavior over technical convenience names.
- Record ambiguities as questions or assumptions before encoding them.
- Find the boundaries.
- Identify the domain and subdomains involved.
- Look for bounded contexts where the same word means different things or where rules change by workflow, team, product area, or integration.
- Keep context boundaries visible in module names, APIs, tests, and docs when they affect maintainability.
- Choose tactical patterns only where they earn their keep.
- Entity: has identity and continuity across changes.
- Value object: immutable descriptive value whose equality is by value.
- Aggregate: consistency boundary that protects invariants through one root.
- Repository: collection-like access to aggregates, hiding persistence shape.
- Domain service: stateless domain operation that does not belong on one entity or value object.
- Policy/specification: named decision rule that may vary independently.
- Domain event: fact that something meaningful already happened in the domain.
- Separate domain from delivery and storage.
- Put invariants and decisions in domain types or services, not controllers, resolvers, UI components, SQL snippets, serializers, or job handlers.
- Let infrastructure translate into and out of domain concepts.
- Keep persistence models separate from domain models when storage shape would leak or weaken invariants.
- Do not let framework types become part of the core domain API unless the project intentionally treats them as domain primitives.
- Preserve behavior through tests.
- Test invariants, transitions, policies, and domain events at the narrowest useful level.
- Use integration tests for repository mappings and boundary contracts.
- Prefer behavior names in tests over implementation names.
- Implement with the matching mechanics.
- When implementation begins, load the matching language engineering skill and any data skill needed for persistence, schema, query, or transaction work.
Review And Verification
DDD remains discovery, design, and refactor guidance. For a focused tactical
model audit, load domain-modeling with
code-review and
review-verification-protocol.
Before reporting implementation or refactor work complete, run focused checks for the changed behavior, invariants, and boundary mappings; then run broader repository checks when the change warrants them. Report failed or skipped checks and residual domain, boundary, or migration risk.
Relationship To Architecture Skills
DDD helps define what belongs inside the business-centered core; Hexagonal
Architecture, Clean Architecture, and Onion Architecture help keep that core
isolated from external mechanisms. Load
hexagonal-architecture when domain
modeling turns into decisions about ports, adapters, external actors, or
headless core tests. Load
clean-architecture when use cases,
interactors, presenters, and interface-adapter responsibilities are the main
design issue. Load onion-architecture when
domain/application rings around a protected domain model are the clearest
framing.
- Repositories in DDD are collection-like access to aggregates; in a hexagonal design they are usually outbound ports implemented by persistence adapters, not generic database helper layers.
- Application services/use cases orchestrate workflows around domain objects; they should not absorb invariants that belong on entities, value objects, aggregates, or domain services.
- These architectures are optional. Keep simple CRUD, one-off scripts, and immature domains simpler until real boundaries, testability needs, or infrastructure leakage justify extra layers.
Modeling Guidance
- Make invalid states unrepresentable when the language and type system allow it.
- Name operations after domain actions, not data mutations: prefer
accept_invitationoverupdate_invitation_statuswhen acceptance has rules. - Keep aggregates small; do not load a whole graph just because objects are related.
- Use domain events for meaningful facts, not as generic callbacks.
- Let module boundaries follow cohesive behavior, not database tables by default.
- Refactor toward clearer bounded contexts incrementally when it improves tests, naming, or ownership.
Ubiquitous Language Checklist
- Domain terms are consistent across code, tests, API names, docs, and UI copy where they describe the same concept.
- Different meanings use different names, even if legacy code conflates them.
- Public errors and validation messages explain domain rules in user-relevant language.
- New abstractions protect real invariants or decisions.
- Infrastructure names do not replace domain names in core logic.
Common Pitfalls
- Anemic models: entities that only store data while services or handlers hold all domain decisions.
- Pattern cargo culting: repositories, events, factories, or aggregates added before there is behavior for them to protect.
- Leaky persistence: database IDs, joins, or ORM constraints dictating domain language without a domain reason.
- Over-preserving compatibility: keeping misleading names or boundaries when the project allows breaking changes and clarity is worth the migration.
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.

