agentleFS
mmccallammccalla/coding-agent-skill-library/skills/ddd-practice/SKILL.md

ddd-practice

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Applies domain-driven design with bounded contexts, aggregates, and ubiquitous language. Use when modelling complex business domains, defining boundaries, or protecting invariants.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    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
  1. Distinctive:

    Use this skill when modelling complex business behaviour, designing service boundaries, refactoring an anemic domain model, defining …

    line 13
  2. Distinctive:

    Create a maintainable domain model that reflects the business language, protects invariants, isolates bounded contexts and separates domain …

    line 17
  3. Distinctive:

    Keep domain logic in the domain layer.

    line 26
  4. Distinctive:

    Use domain events for important state changes that other components need to react to.

    line 27
  5. Distinctive:

    Do not create elaborate DDD structure for CRUD-only or simple scripting problems.

    line 42
  6. Distinctive:

    Do not let database schemas dictate aggregate boundaries by default.

    line 43
  7. Distinctive:

    Do not allow controllers, API handlers, ORM models or LLM prompts to become the only place where business rules live.

    line 44
  8. Very specific:

    Prefer explicit domain terms over generic technical names such as Manager, Processor, Handler or Data.

    line 45
  9. Distinctive:

    Keep bounded contexts independent.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Domain-Driven Design (DDD)

When to use

Use this skill when modelling complex business behaviour, designing service boundaries, refactoring an anemic domain model, defining aggregates, separating subdomains, aligning code with business language, or implementing domain rules that should not leak into infrastructure code.

Objective

Create a maintainable domain model that reflects the business language, protects invariants, isolates bounded contexts and separates domain logic from technical plumbing.

Procedure

  1. Identify the business capability, subdomain and stakeholders.
  2. Capture the ubiquitous language: key terms, events, commands, policies, invariants and ambiguous words.
  3. Define bounded contexts and context boundaries before designing classes or services.
  4. Classify domain concepts as entities, value objects, aggregates, domain services, repositories, domain events or application services.
  5. Define aggregate boundaries around consistency rules, not database tables.
  6. Keep domain logic in the domain layer; keep persistence, messaging, UI and external integrations in adapters or infrastructure.
  7. Use domain events for important state changes that other components need to react to.
  8. Validate the model with examples, tests and, where useful, BDD scenarios.

Tactical modelling guidance

  • Entity: has identity and lifecycle.
  • Value object: immutable description with equality by value.
  • Aggregate: consistency boundary with a root that protects invariants.
  • Repository: persistence abstraction for aggregate roots.
  • Domain service: domain operation that does not naturally belong to one entity or value object.
  • Application service: orchestration layer; it coordinates use cases but should not contain core domain rules.
  • Domain event: fact that something meaningful happened in the domain.

Rules

  • Do not create elaborate DDD structure for CRUD-only or simple scripting problems.
  • Do not let database schemas dictate aggregate boundaries by default.
  • Do not allow controllers, API handlers, ORM models or LLM prompts to become the only place where business rules live.
  • Prefer explicit domain terms over generic technical names such as Manager, Processor, Handler or Data.
  • Keep bounded contexts independent; integration between contexts should use explicit contracts, events or anti-corruption layers.

Related skills

  • bdd-practice — scenarios using ubiquitous language
  • spec-driven-development — bounded context in specs
  • conceptual-data-modeling — link domain concepts to data models

References

Verification

  • Bounded context and key domain terms stated.
  • Aggregate or boundary decisions documented.
  • Invariants protected identified.
  • Modelling assumptions requiring business validation noted.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.