MCPInstall

ddd-architecture-doc

DDD architecture documentation generation — C4 model diagrams (Context/Container/Component/Code), ADR (Architecture Decision Records), domain model documentation, API documentation, architecture decision log, and team communication templates. Use when user asks about architecture documentation, 架构文档, ADR, C4 diagram, domain model doc, 架构决策记录, or needs to document DDD architecture for team.

Installs
135
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/full-stack-skills/ddd-skills --skill ddd-architecture-doc
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads ddd-architecture-doc automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

DDD Architecture Documentation

Generate comprehensive DDD architecture documentation: C4 model diagrams (L1-L4), ADRs, domain model docs, API docs, decision logs, and team communication templates.

Workflow

Follow this 5-step workflow when generating architecture documentation:

Step 1: Understand Context — Project size, team, tech stack, domain
Step 2: Identify Audiences — Business / dev / ops
Step 3: Select C4 Level — L1 for business, L2 for ops, L3 for dev team
Step 4: Check Decisions — Any existing ADRs? Need to create new ones?
Step 5: Generate Output — Combine diagrams + ADRs + templates into one doc

When info is insufficient: give a best-guess version first based on common patterns (e.g., e-commerce) + list what specific information is still needed. Never just say "请提供更多信息".

Boundary

✅ 擅长处理

  1. C4 模型图生成 — L1 System Context / L2 Container / L3 Component / L4 Code(Mermaid)
  2. ADR 架构决策记录 — 模板 + 索引 + 状态追踪
  3. 领域模型文档 — 聚合描述 + 实体/值对象/事件列表
  4. API 文档 — CQRS 命令/查询分离的 API 规范

⚠️ 需要条件

  1. 已有架构决策 — 需要先有决策才能记录 ADR
  2. 已识别限界上下文 — 至少知道系统有哪些 BC 才能画 C4 L1 图
  3. 技术栈已知 — 需要知道框架/数据库/中间件才能生成 L2 容器图

❌ 超出范围(不适用场景)

  1. 无架构决策 → 先做决策再文档(路由到 ddd-architecture-selector)
  2. 单人项目 → README + 行内注释即可
  3. 需架构选型 → ddd-architecture-selector
  4. 需代码审查 → ddd-code-reviewer

Audience

This skill is designed for: Backend developers (implementing DDD architectures), Software architects (evaluating and selecting patterns), Tech leads (reviewing team implementations), and DDD beginners (learning domain-driven design fundamentals).

Rules

  1. Every architecture decision must be documented as an ADR.
  2. C4 diagrams must follow Level 1→4 hierarchy.
  3. Domain model documentation must reference bounded contexts.
  4. All decision logs must include date, context, options, and rationale.

C4 模型四层

DDD → C4 Mapping

C4 Level     | DDD Context                   | Audience
─────────────┼───────────────────────────────┼────────────────
L1 Context   | All bounded contexts + externals | Business, Architects
L2 Container | Per-BC deployment units        | Architects, DevOps
L3 Component | BC internal layers (Adapter/App/Domain/Infra) | Dev Team
L4 Code      | Aggregate internals (entities, VOs, events) | Developers

L1: System Context — 展示系统与外部关系

graph TB
    Customer["👤 Customer"] --> BC1["Bounded Context 1"]
    Customer --> BC2["Bounded Context 2"]
    Admin["👤 Admin"] --> BC3["Bounded Context 3"]
    BC1 --> PaymentGW["💳 Payment Gateway"]

L2: Container — 单个 BC 的部署单元

graph TB
    Web["Web App"] --> API["API (Spring Boot)"]
    API --> DB[("Database (PostgreSQL)")]
    API --> Queue["Event Queue (RabbitMQ)"]

L3/L4 完整 Mermaid 代码示例见 references/01-c4-examples.md。

When to use each level: L1 for project kickoff, L2 for ops handover, L3 for daily dev reference, L4 for complex aggregates only.

ADR (Architecture Decision Record)

ADR Template

# ADR-{NNN}: {Short Title}

## Status
{Proposed / Accepted / Deprecated / Superseded}

## Context / Decision / Alternatives / Consequences
- **Context**: Why is this decision needed?
- **Decision**: What did we decide?
- **Alternatives**: Options considered with pros/cons, mark chosen
- **Consequences**: Positive + negative impacts
- **Related**: ADR-{NNN}: {related}

ADR Status Tracking Table

| ADR# | Title | Status | Date | Superseded By |
|------|-------|:------:|:----:|:----:|
| 001 | Choose COLA Architecture | Accepted | 2024-03-15 | — |
| 002 | CQRS Strategy L2 | Accepted | 2024-03-20 | — |
| 003 | MySQL over PostgreSQL | Deprecated | 2024-02-01 | ADR-005 |

Domain Model Documentation

Document each aggregate:

## Aggregate: {Name}
- **Root**: {ClassName} | **Id**: {IdType}
- **Entities**: Table of entity / owner / lifecycle
- **Value Objects**: Table of VO / fields / immutable
- **Domain Events**: Table of event / trigger / consumer
- **Invariants**: 1. {Invariant 1}
- **State Machine**: ```mermaid stateDiagram-v2```

API Documentation — CQRS 命令/查询分离

API TypeMethodExampleCQRS Model
CommandPOST/PUT/DELETEPOST /ordersCommand Model
QueryGETGET /orders?status=PAIDQuery Model

Command API: triggers domain behavior, publishes domain events, idempotent key required. Query API: reads from query model (may be separate read DB), no side effects.

Architecture Decision Log

Maintain a central index:

docs/adrs/
├── README.md          ← Auto-generated ADL index
├── ADR-001-title.md
└── ...

Best practices: one ADR file = one decision; ADR in the same repo as code; CI auto-generates the index.

文档维护策略

策略频率谁负责
PR 时同步更新 ADR + 图每次代码变更开发者
C4 图季度审计每季度架构师
ADL 索引自动生成每次 ADR 变更CI
全量架构文档 Review每月架构组

Golden rule: if code changes the architecture, the doc changes in the same PR.

Gotchas — Common Pitfalls

  1. C4 层级乱用 — 每层有明确定义,不要混用。
  2. ADR 写太晚 — 决策时同步记录,哪怕只写一句话。
  3. 文档与代码不同步 — 每次架构变更后必须更新。
  4. 只画图不写决策理由 — C4 展示 What,ADR 解释 Why。
  5. 图过于复杂 — 每张图 5-7 节点为限。
  6. 过度文档 — 聚焦"别人需要知道什么才能开发"。
  7. ADR 不写备选 — 必须记录为什么没选其他方案。
  8. 忽略受众 — 不同受众用不同 C4 级别。

FAQ

Q1: 文档应该用什么工具? 先用 Mermaid,复杂度上升后考虑 Structurizr。

Q2: 需要画哪些 C4 层级? L1 + L2 是必须的,L3 视团队规模(>5 人推荐)。

Q3: 怎么保证文档不过期? PR 勾选框 + CI 检查 ADR 一致性 + 月度 Review。

Q4: 遗留系统没有文档怎么办? 先画 AS-IS 的 L1 图 → 记录关键 ADR → 每 sprint 完善一个 BC。

Q5: ADR 需要写多详细? 至少包含背景、决策、备选方案(≥2 个)和影响。

Q6: 多人同时改一个 BC 的文档怎么处理? Git 冲突解决机制即可,PR Review 时同步 Review 文档。

Security & Safety

This skill is pure documentation. It does not collect user data, does not access external services or networks, and contains no executable scripts.

Keywords

  • Keywords: architecture documentation, 架构文档, ADR, C4 diagram, C4 模型, architecture decision record, 架构决策记录, domain model doc, 领域模型文档, 技术文档, 架构图, system context, container diagram, component diagram, code diagram, 架构评审, 文档模板, architecture decision log

References

FileContentWhen to Reference
references/01-c4-examples.mdFull C4 L1-L4 Mermaid examples for e-commerceUser needs complete C4 diagrams to copy-paste
references/02-adr-templates.md3 ADR template variants (standard, lightweight, tech)User needs to write a new ADR
references/03-doc-templates.md3 architecture doc templates (full, lightweight, onboarding)User needs a document structure to start with
references/04-toolchain.mdTool recommendations (Structurizr, Mermaid, PlantUML, ArchUnit)User asks about tools or automation
references/05-team-templates.mdTeam communication templates (review request, change notice)User needs to notify or review with team
references/06-arch-decision-log.mdADL index format + CI automationUser needs to maintain or automate ADR tracking
references/07-domain-model-doc.mdAggregate/BC documentation patternsUser needs to document domain models
references/08-api-doc-patterns.mdCQRS API documentation patterns + OpenAPI specUser needs to document APIs with CQRS
references/09-trace-anti-patterns.mdArchitecture doc anti-patterns (5 categories)User needs to avoid common documentation mistakes
references/10-faq-deep.mdIn-depth FAQ (microservices ADR, legacy systems, security)User has advanced or edge-case questions

Related Skills

  • ddd-architecture-selector — Architecture selection (before you document, make decisions). Install: npx skills add full-stack-skills/ddd-skills --skill ddd-architecture-selector.
  • ddd-architecture-evaluator — Periodic architecture health check. Install: npx skills add full-stack-skills/ddd-skills --skill ddd-architecture-evaluator.
  • ddd-code-reviewer — Code-level DDD compliance check. Install: npx skills add full-stack-skills/ddd-skills --skill ddd-code-reviewer.
  • ddd-cqrs-architecture — CQRS detail for API documentation. Install: npx skills add full-stack-skills/ddd-skills --skill ddd-cqrs-architecture.
  • ddd-architecture-awesome — DDD concept overview. Install: npx skills add full-stack-skills/ddd-skills --skill ddd-architecture-awesome.

FAQ

What does the ddd-architecture-doc skill do?

DDD architecture documentation generation — C4 model diagrams (Context/Container/Component/Code), ADR (Architecture Decision Records), domain model documentation, API documentation, architecture decision log, and team communication templates. Use when user asks about architecture documentation, 架构文档, ADR, C4 diagram, domain model doc, 架构决策记录, or needs to document DDD architecture for team.

How do I install ddd-architecture-doc?

Run npx skills add https://github.com/full-stack-skills/ddd-skills --skill ddd-architecture-doc in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ddd-architecture-doc/ (personal) or .claude/skills/ddd-architecture-doc/ (project).

Which AI agents can use ddd-architecture-doc?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is ddd-architecture-doc safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains ddd-architecture-doc?

It is published by full-stack-skills in full-stack-skills/ddd-skills. It has 135 recorded installs.

More from full-stack-skills/ddd-skills

View all →

ddd-code-reviewer

full-stack-skills/ddd-skills

DDD code review and anti-pattern detection — anemia model detection, layered compliance checking, aggregate design review, rich model verification, scoring system (5 dimensions), and ArchUnit automated validation. Use when user asks about code review, 代码审查, DDD review, 架构审查, anti-pattern detection, 反模式检测, or needs to check if code follows DDD.

ddd-api-designer

full-stack-skills/ddd-skills

API design from domain model — CQRS command/query separation, REST API endpoint design, data object conversion chain (PO→DO→DTO→VO), unified response format, OpenAPI/Swagger generation, BFF pattern, API versioning, and security design. Use when user asks about API design, REST API, OpenAPI, BFF, DTO design, 接口设计, or data object conversion.

Backend & APIs139 installs

ddd-domain-designer

full-stack-skills/ddd-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design133 installs

ddd-devops-integration

full-stack-skills/ddd-skills

DDD DevOps integration — CI/CD pipeline with ArchUnit automated architecture validation, multi-module build optimization for DDD projects, containerized deployment with Docker/K8s for layered/hexagonal/clean architectures, database migration strategies for domain events, and monitoring domain health. Use when user asks about DevOps, CI/CD, DDD deployment, ArchUnit CI, or needs to automate DDD project builds.

DevOps & Cloud131 installs

ddd-architecture-hexagonal

full-stack-skills/ddd-skills

Comprehensive guidance for Hexagonal Architecture (Ports & Adapters) — Alistair Cockburn's hexagonal architecture with domain core, port definitions, adapter implementations, and full Java/Spring Boot implementation steps. Covers primary/driving adapters, secondary/driven adapters, use case ports, repository ports, and dependency injection configuration. Use when user asks about hexagonal architecture, 六边形架构, ports and adapters, 端口适配器, Alistair Cockburn, or needs DDD with clean separation.

ddd-event-storming

full-stack-skills/ddd-skills

Open the skill to read its SKILL.md instructions.

127 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.