/craft:ddd-principlesfrom craft
Guides domain layer design in OOP languages using DDD principles: bounded contexts, aggregates, value objects, ports/adapters, and dependency direction. Activates for domain, DDD, hexagonal architecture.
Ships in craft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The rules below are language-agnostic OOP-style DDD. Language-specific examples (forbidden imports, Symbol tokens, module structure) live in:
php-ddd-conventions(PHP / Symfony)nest-ddd-conventions(TypeScript / NestJS)For functional-style DDD (immutable records, curried operations, Result pipelines), see
craft:ddd-fp-principles.
The domain layer contains business logic only. Infrastructure leaks into the domain are the most common architectural violation — they make the domain untestable without the framework and impossible to reuse.
Request, Response, framework UploadedFile, etc.)@Injectable, @Module, @Inject, etc.)packages/shared or equivalent)Criterion: if the domain layer compiles WITHOUT the framework, it's pure.
The boundary between domain and infrastructure is a set of interfaces (ports) defined in the domain, implemented as adapters in the infrastructure.
Controllers / HTTP → Use Cases → Domain Services → Domain Ports
↑
Infrastructure Adapters (DB, HTTP clients, …) ───────────────────┘
(implement the domain ports)
Rule: dependencies always flow inward toward the domain. Outer layers know about inner layers; inner layers know nothing about outer layers.
A bounded context is a clearly delimited part of the system with its own ubiquitous language. Each bounded context maps to a separate module / namespace / directory.
An aggregate is a state-bearing cluster of domain objects with:
Value objects are defined by their attributes, not by an identity:
readonly / final readonly / equivalent).| Rule | Principle |
|---|---|
| Domain purity | No framework / ORM / HTTP in the domain layer |
| Ports & adapters | Interfaces in domain, implementations in infrastructure |
| Dependency direction | Always inward toward the domain |
| Bounded context | 1 module / namespace / directory per context |
| Aggregate | Single transactional boundary + identified root |
| Value object | Immutable, equality by attributes, may enforce invariants |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fabiensalles/claude-marketplace --plugin craft8 skills in this plugin
/code-style-principlesACTIVATE whenever writing or modifying production code in src/, in any language — this is the base layer these rules build on. ACTIVATE for code review, formatting questions, or 'coding standards'. Covers cross-language code style: control-structure spacing, early-return pattern, continue-vs-if/else in loops, explicit (non-truthy/falsy) checks, flattening nested null checks, parameter ordering. These rules go BEYOND standard linters. Language-specific syntax (no-empty in PHP, template literals in TS, nowdoc, optional chaining vs nullsafe) lives in php-code-conventions / ts-code-conventions, which apply on top of this skill rather than instead of it. DO NOT use for: language-specific syntax already covered by php-code-conventions / ts-code-conventions (see php:php-code-conventions + typescript:ts-code-conventions for PHP/TS specifics)./ddd-fp-principlesACTIVATE when modeling DDD aggregates, value objects and domain logic using functional patterns — immutable records, curried operations, Result types, validation/enrichment pipelines, handler orchestration. ACTIVATE for 'aggregate', 'smart constructor', 'make*', 'validation pipeline', 'enrichment', 'domain handler' in a functional context. Provides cross-language functional DDD principles. For OOP-style DDD (classes, decorators, module-bounded contexts) see craft:ddd-principles. Companion examples: ddd-ts-fp.Other plugins' skills for the same job