一键导入
common-domain-driven-design
Guides the agent through applying Domain-Driven Design principles when modeling, structuring, and implementing business logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guides the agent through applying Domain-Driven Design principles when modeling, structuring, and implementing business logic.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | common-domain-driven-design |
| description | Guides the agent through applying Domain-Driven Design principles when modeling, structuring, and implementing business logic. |
Apply Domain-Driven Design (DDD) to model complex business domains, enforce clear boundaries, and produce maintainable, intent-revealing code.
Use this skill when:
| Building block | Purpose |
|---|---|
| Entity | An object with a unique identity that persists over time. |
| Value Object | An immutable object defined only by its attributes, no identity. |
| Aggregate | A cluster of entities/value objects with a single root entity as entry. |
| Aggregate Root | The only entity through which external code may reference the aggregate. |
| Domain Event | A record of something meaningful that happened in the domain. |
| Repository | Abstracts persistence; retrieves and stores aggregates. |
| Domain Service | Stateless operation that doesn't naturally belong to an entity or VO. |
| Application Service | Orchestrates use cases; delegates to domain objects, no business logic. |
| Factory | Encapsulates complex creation logic for aggregates or entities. |
Identify the bounded context. Before writing code, determine which bounded context you are working in. Name it explicitly. If one does not exist yet, propose one using the ubiquitous language.
Define the ubiquitous language. List the key domain terms relevant to the task. Use these terms consistently in code, comments, commit messages, and documentation.
Model aggregates carefully.
Use value objects liberally.
Money, EmailAddress, DateRange).Raise domain events for side effects.
OrderPlaced, PaymentReceived).Separate layers clearly.
Repository rules.
Apply context mapping when crossing boundaries.
Folder/module structure. Organize code to mirror bounded contexts:
src/
<bounded-context>/
domain/
model/ # Aggregates, entities, value objects
event/ # Domain events
service/ # Domain services
repository/ # Repository interfaces
application/
command/ # Command handlers / use cases
query/ # Query handlers / read models
infrastructure/
persistence/ # Repository implementations
messaging/ # Event bus adapters
presentation/ # Controllers, DTOs
Validate the design.
Defines the analyse-plan-execute workflow that the agent must follow for non-trivial tasks.
Defines a strict code review process where the agent validates quality through linting, tests, complexity analysis, and critical challenge of design decisions.
Guides the agent through creating a new AI skill following the agentskills.io format and this repository's conventions.
Guides the agent to always write commit messages following the Conventional Commits 1.0.0 specification, ensuring structured, parseable, and semantically meaningful commit history.
Guides the agent through applying Hexagonal Architecture (Ports & Adapters) to isolate domain logic from external concerns within a service.
Guides the agent to apply consistent, meaningful naming conventions across all code — variables, functions, classes, files, and infrastructure — ensuring readability and predictability.