Skip to content
Skills Library
Programming · Review & audit

ddd

/ddd

The DDD layout that the harness packs ddd and ddd-es check, with the id of each rule. Also the conventions to write a context: use cases, aggregates, repositories, events, wiring, the edge, API contracts, tests, porting and style. Use when you create, move, write or review a file in a bounded context, or set up the lint rules of a DDD project.

Repository
harness ↗
Licence
MIT
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
17
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: ddd_test.go

What it does and when to use it

The DDD layout that the harness packs ddd and ddd-es check, with the id of each rule. Also the conventions to write a context: use cases, aggregates, repositories, events, wiring, the edge, API contracts, tests, porting and style. Use when you create, move, write or review a file in a bounded context, or set up the lint rules of a DDD project.

Arguments

/ddd [language]
Original author description

The DDD layout that the harness packs ddd and ddd-es check, with the id of each rule. Also the conventions to write a context: use cases, aggregates, repositories, events, wiring, the edge, API contracts, tests, porting and style. Use when you create, move, write or review a file in a bounded context, or set up the lint rules of a DDD project.

How it works

  1. Decision tree
  2. Language
  3. Contexts
  4. Layers
  5. Dependencies
  6. Application
  7. Domain model
  8. Naming
  9. Event sourcing
  10. Coverage
Original SKILL.md headings · 109 lines, 1,068 words
SKILL.md preview
---
name: ddd
description: "The DDD layout that the harness packs ddd and ddd-es check, with the id of each rule. Also the conventions to write a context: use cases, aggregates, repositories, events, wiring, the edge, API contracts, tests, porting and style. Use when you create, move, write or review a file in a bounded context, or set up the lint rules of a DDD project."
argument-hint: "[language]"
---

# DDD layout

Be specific about the structure and agnostic about the tools. Keep the model rich, not anemic. Use immutable values. Let handlers orchestrate. Let errors propagate. Place mappers beside the store adapters. Write architecture tests.

The harness checks a domain driven design project with the rules of the packs ddd and ddd-es. This page gives the layout that those rules expect, with the rule id beside each rule. It names no language: the folder names, the file names and the tool of each language are in `references/`.

Language: `$ARGUMENTS`.

## Decision tree

```
What do you need?
├── the folder names, the file names or the tool of one language: read only that file
│   ├── TypeScript → references/typescript.md
│   ├── PHP → references/php.md
│   ├── Python → references/python.md
│   └── Go → references/go.md
├── the name of a context, an aggregate or an event → "Language"
├── a new context, or a call between two contexts → "Contexts", then "Dependencies", then references/contexts.md
├── events or calls across contexts → references/contexts.md
├── the layer of a new file → "Layers", then "Naming"
├── whether an import is allowed → "Dependencies"
├── a command, a query, a handler or a bus → "Application", then references/use-cases.md
├── an aggregate, a value object or a domain error → "Domain model", then references/aggregates.md
├── a repository, a mapper or a store → references/repositories-and-mappers.md
├── an event or an event handler → references/events.md
├── an event sourced aggregate or a projection → "Event sourcing", then references/events.md
├── the wiring of a module, the kernel or a shared module → references/composition-root.md
├── a controller, a consumer, a CLI command or a job → references/delivery-edge.md
├── a wire shape, a version or an error body → references/api-contracts.md
├── a test, a mother or an architecture test → references/tests.md
├── code to port from a legacy project → references/porting-legacy.md
├── names, comments or the shape of a class → references/style.md
└── which rules the harness checks in this language → "Coverage"
```

## Language

Read `CONTEXT.md`, the glossary or `docs/adr/` of the project first, when one exists. Name each context, aggregate, command and event with the terms of that file. An event name is a fact in the past tense, such as order placed (`ddd/event-past-tense`).

## Contexts

- The business root holds the bounded contexts, the `shared` folders and one kernel.
- A folder with layer folders, or with a module at its top level, is a context. Another folder is a group of contexts.
- A context splits its code in the layers `domain`, `application` and `infrastructure`. A context with only one of them is a finding (`ddd/context-layers`).
- Each context has exactly one module at its root. The module wires the context and is its public entry point (`ddd/module-per-context`).
- The business root has exactly one kernel, which wires the modules (`ddd/one-kernel`).
- A group holds contexts, groups and a `shared` folder, and no code of its own (`ddd/parent-no-code`).
- Each source file and each dependency belongs to a known context or layer. A file that the tool cannot place is a finding, never a silent pass (`ddd/src-roots`).

## Layers

| Layer | Holds |
|---|---|
| `domain` | aggregates, entities, value objects, domain events, errors and the repository ports |
| `application` | commands, queries, their handlers and the event handlers |
| `infrastructure` | the repository adapters, the mappers, the controllers, the schemas and the other adapters |

- A `shared` folder holds only the three layers (`ddd/shared-layers`).
- The root `shared` domain holds only the base types and the integration event interfaces (`ddd/shared-base-only`). The base types are aggregate root, entity, value object, domain event and error.

## Dependencies

```
infrastructure ──> application ──> domain ──> shared domain, allowed libraries
```

- The domain uses only itself, the shared domain and the libraries that the project allows. It never uses the application layer, the infrastructure layer, a framework, an ORM or the event bus (`ddd/domain-purity`).
- The application layer uses the domain, never the infrastructure layer (`ddd/layer-direction`).
- A context imports another context only in two ways (`ddd/cross-context`). A module imports the module of another context, and an event handler imports an event of another context.
- By convention, an event handler imports only the integration event interfaces of the shared domain. A reviewer checks for a foreign domain event by reading the code.

## Application

- The application layer holds only three kinds of folder: commands, queries and event handlers (`ddd/cqrs-folders`).
- Each command or query folder holds exactly one message and one handler (`ddd/handler-pair`).
- A command handler returns nothing (`ddd/command-handler-returns`).
- A query handler writes nothing: no save, delete, persist, publish or dispatch (`ddd/query-handler-no-write`).
- A command handler publishes the events after the repository saves the aggregate (`ddd/publish-after-save`).

## Domain model

- An aggregate exposes no public writable state (`ddd/aggregate-encapsulation`).
- A value object has an `equals` method (`ddd/value-object-equals`) and a factory, never a public constructor (`ddd/value-object-factory`).
- An event is immutable (`ddd/event-readonly`).
- The repository port is in `domain`, and its adapter is in `infrastructure` (`ddd/repository-port`).
- A mapper is in `infrastructure` (`ddd/mapper-location`).

## Naming

A file in a layer tells its role in its name (`ddd/file-suffix`). The roles are command, query, handler, event, aggregate, entity, value object, repository, mapper, error, module, controller, adapter, schema, projection, spec and mother. A repository adapter also names its store, such as an order repository on a SQL store.

## Event sourcing

The pack ddd-es adds three rules on top of ddd:

- Each event that an aggregate records has an apply method on that aggregate (`ddd-es/apply-handler`).
- Each event has a version field (`ddd-es/event-version`).
- A projection only reads: it uses no repository port, no aggregate and no command (`ddd-es/projection-read-only`).

## Coverage

- TypeScript: the harness engines check every rule of the packs ddd and ddd-es.
- Another language: the native tool of the project checks the catalogue ids `ddd/src-roots`, `ddd/domain-purity`, `ddd/layer-direction`, `ddd/cross-context` and `ddd/file-suffix`.
- `harness lint catalogue` prints them. A tool that checks only imports waives `ddd/file-suffix`, so a reviewer checks the file names by reading the code.
- The other rules of this page are the convention in every language. A reviewer checks them by reading the code.
- A reference file states each rule that its language maps in another way. An example is a composition root in place of a module for each context.
Files in this package (17)
  • SKILL.md 7 KB
  • ddd_test.go 6 KB
  • references/aggregates.md 3 KB
  • references/api-contracts.md 2 KB
  • references/composition-root.md 3 KB
  • references/contexts.md 3 KB
  • references/delivery-edge.md 3 KB
  • references/events.md 4 KB
  • references/go.md 4 KB
  • references/php.md 3 KB
  • references/porting-legacy.md 2 KB
  • references/python.md 4 KB
  • references/repositories-and-mappers.md 2 KB
  • references/style.md 2 KB
  • references/tests.md 3 KB
  • references/typescript.md 6 KB
  • references/use-cases.md 3 KB

Versions

RepositoryScoreLicence
This page · 90p-labs/harness100MIT
svngoku/coding-agents-skills100MIT
claude-dev-suite/claude-dev-suite100MIT
usetemi/skills100MIT
jirayusueb/egm-stack90Apache-2.0

Database snapshot: 13.11.2026 · package version 42f1b13c2e6f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100ddd-principles
    ACTIVATE when designing the domain layer in OOP languages — bounded contexts, aggregates, value objects, layer purity, ports/adapters, dependency direction. ACTIVATE for 'domain', 'DDD', 'hexagonal', 'ports and adapters', 'domain purity', 'bounded context', 'aggregate'. Provides…
  • 100clean-architecture
    Clean and Hexagonal Architecture with DDD tactical patterns: layers, dependency rule, entities, aggregates, repositories. Use to design or evaluate application structure.
  • 100ddd-lifecycle
    DDD 全流程开发规范(语言无关):从零搭建工程的领域建模、六边形架构落地,与开发过程中的 DDD 抉择判断。当用户要开始新项目或新模块的领域建模、建立或维护统一语言(spec-dev 词汇表)、划分限界上下文(context mapping)、定义实体/值对象/聚合、设计领域事件与仓储、搭建分层/端口适配器(六边形)架构、判断某决策是否值得写 ADR、或需要评审领域模型与业务规则的一致性时使用。适用于任何编程语言与框架。
  • 95architecture-domain-driven-design
    Use this skill when the user says 'DDD', 'domain-driven design', 'bounded context', 'aggregate', 'aggregate root', 'ubiquitous language', 'context map', 'anti-corruption layer', 'event storming', 'value object'. Applies strategic DDD (subdomains, bounded contexts, context maps)…
  • 96ddd-context
    Create and manage a DDD bounded context with standard directory structure. Use when starting a new subdomain, splitting a monolith into bounded contexts, or scaffolding the domain/application/infrastructure layout for a fresh module.
  • 100ddd-architect
    Comprehensive Domain-Driven Design analysis and architecture generation — use when designing bounded contexts, defining aggregates, creating context maps, or decomposing systems into microservices or modular monolith. Triggers: DDD, domain-driven design, bounded context,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.