agentleFS
grndlvlgrndlvl/software-patterns/.claude/skills/ddd/SKILL.md

ddd

Skill17 starsChanged 9 months agoMITView on GitHub

Reference for domain modeling concepts from Eric Evans' "Domain-Driven Design: Tackling Complexity in the Heart of Software." Use this skill when discussing: - Domain modeling and ubiquitous language - Bounded contexts and context mapping - Entities vs value objects - Aggregates and aggregate roots - Repository and factory patterns - Domain events and event storming - Anti-corruption layers Based on concepts from "Domain-Driven Design" by Eric Evans.

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use convention-learner, opentelemetry and 10 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.
  • codewithmukeshSkill

    convention-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

  • codewithmukeshSkill

    opentelemetry

    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

  • MovGP0Skill

    modern-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

  • MicrosoftSkill

    resilience

    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

  • hongyuancSkill

    vertical-slice

    Build and evaluate a production-quality vertical slice before advancing from Pre-Production to Production.

    Also in 3 projects that use this

  • wpankSkill

    caching

    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

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 2

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

    Use this skill when discussing:

    line 7
  2. Distinctive:

    Reference by identity: - Don't hold direct references to other aggregates

    line 66

“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.

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

Domain-Driven Design Skill

Reference for domain modeling concepts from Eric Evans' "Domain-Driven Design: Tackling Complexity in the Heart of Software."

Activation Triggers

Use this skill when discussing:

  • Domain modeling and ubiquitous language
  • Bounded contexts and context mapping
  • Entities vs value objects
  • Aggregates and aggregate roots
  • Repository and factory patterns
  • Domain events and event storming
  • Anti-corruption layers

Quick Reference

Strategic DDD Patterns

PatternPurposeWhen to Use
Bounded ContextDefine clear boundariesDifferent teams, different models
Ubiquitous LanguageShared vocabularyAlways within a context
Context MapShow relationshipsMultiple bounded contexts
Anti-Corruption LayerProtect from external modelsIntegrating legacy/external systems

Tactical DDD Patterns

PatternCharacteristicsIdentity
EntityMutable, lifecycle, identity mattersHas unique ID
Value ObjectImmutable, no identity, equality by attributesNo ID needed
AggregateConsistency boundary, transactional unitHas aggregate root
Domain EventSomething that happened, immutableNamed in past tense

Building Blocks

BlockResponsibility
EntityModel with identity and lifecycle
Value ObjectDescribe characteristics
AggregateEnforce invariants, transactional boundary
RepositoryPersist and retrieve aggregates
FactoryComplex object creation
Domain ServiceStateless domain operations
Application ServiceOrchestrate use cases
Domain EventCapture something that happened

Context Mapping Relationships

RelationshipDescription
PartnershipTwo teams cooperate
Shared KernelShared subset of model
Customer-SupplierUpstream/downstream dependency
ConformistDownstream conforms to upstream
Anti-Corruption LayerTranslate between models
Open Host ServicePublished API for many consumers
Published LanguageWell-documented interchange format
Separate WaysNo integration

Aggregate Design Rules

  1. Protect invariants - Aggregate root enforces all rules
  2. Design for consistency - One aggregate per transaction
  3. Reference by identity - Don't hold direct references to other aggregates
  4. Use eventual consistency - Between aggregates, not within
  5. Keep aggregates small - Focused on true invariants

Entity vs Value Object Decision

Does identity matter beyond its attributes?
├── YES → Entity (e.g., User, Order, Product)
└── NO → Value Object (e.g., Address, Money, DateRange)

Will instances be shared?
├── YES → Entity (needs identity for references)
└── NO → Value Object (can be replaced/copied)

Directory Structure

ddd/
├── SKILL.md
├── strategic/
│   ├── ubiquitous-language.md
│   ├── bounded-contexts.md
│   ├── context-mapping.md
│   └── anti-corruption-layer.md
├── tactical/
│   ├── entities.md
│   ├── value-objects.md
│   ├── aggregates.md
│   ├── domain-services.md
│   └── domain-events.md
├── patterns/
│   ├── repositories.md
│   ├── factories.md
│   └── specifications.md
└── practices/
    ├── event-storming.md
    └── model-exploration.md

Usage Examples

Modeling a Domain

Question: "How should I model orders?"

Consider:
1. Define Ubiquitous Language - See strategic/ubiquitous-language.md
2. Identify Entities vs Value Objects - See tactical/
3. Find Aggregates - See tactical/aggregates.md
4. Design Repositories - See patterns/repositories.md

Integrating Systems

Question: "How do I integrate with legacy system?"

Consider:
- Define Bounded Context boundary
- Use Anti-Corruption Layer
- Map contexts with Context Map

Based on concepts from "Domain-Driven Design" by Eric Evans.

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.