Architecture Documentation
Help the user create and maintain architecture documentation that is version-controlled, multi-layered, and useful. Good architecture docs answer "what exists and how does it connect?" — not by drawing everything, but by drawing the right things at the right abstraction level.
Workflow
Step 1: Assess Documentation Scope
Understand what exists and what's needed before creating anything:
- Current state: Are there existing diagrams, READMEs with architecture sections, or whiteboard photos? Scan the repo for
docs/, architecture/, .puml, .d2, or Mermaid blocks in markdown.
- Audience: Who will read this? New hires need conceptual overviews. Ops teams need runtime topology. Architects need structural boundaries.
- System complexity: How many services, data stores, and external dependencies? This determines which abstraction levels are worth creating.
A simple monolith may only need one conceptual diagram. A distributed system with 5+ services likely needs canonical and runtime levels too.
Step 2: Choose Abstraction Levels
Architecture documentation works at three distinct levels. Not every system needs all three — apply YAGNI.
| Level |
Purpose |
Answers |
Stability |
| Canonical |
What exists structurally |
"What are the building blocks?" |
Stable — changes with architecture |
| Runtime |
How it behaves operationally |
"How does data flow? Where does code run?" |
Medium — changes with deployment |
| Conceptual |
How to explain it |
"What's the mental model?" |
Ephemeral — changes with audience |
Guidelines for selection:
- Always start with Conceptual — even a quick sketch helps align understanding
- Add Canonical when the system has multiple services, teams, or bounded contexts
- Add Runtime when deployment topology, data flows, or infrastructure matter for operations
See references/abstraction-levels.md for detailed guidance on each level, traceability rules, and the promotion model.
Step 3: Select Tooling and Establish Conventions
Choose tools that fit the team's stack. The framework is tool-agnostic — what matters is consistent usage, not specific tools.
Recommended defaults by level:
| Level |
Recommended Tools |
Alternatives |
| Canonical |
C4-PlantUML, Structurizr DSL |
Mermaid C4 extension, Ilograph |
| Runtime |
D2, Mermaid |
PlantUML sequence/deployment, Diagrams-as-code (Python) |
| Conceptual |
Mermaid, Excalidraw |
Whiteboard photos, ASCII diagrams |
Conventions to establish:
- Shared vocabulary: Create a glossary of system names. Every diagram must use these names exactly — no aliasing or renaming per diagram.
- File naming: Use a consistent pattern like
{level}-{scope}.{ext} (e.g., canonical-system-context.puml, runtime-checkout-flow.d2)
- Repository structure: Set up
docs/architecture/ using the template at templates/architecture-doc.md
- Docs-as-code: All diagrams must be text-based, version-controlled, and reviewable in PRs
See references/diagram-tooling.md for tool comparison and syntax examples.
Step 4: Create Diagrams
Work top-down — start at the highest level and add detail only where needed:
- System Context (canonical): The system as a black box, showing users and external dependencies. This is the single most valuable diagram.
- Container diagram (canonical): Zoom into the system — services, data stores, message brokers, frontends.
- Runtime views (as needed): Data flow diagrams, sequence diagrams for key interactions, deployment/infrastructure topology.
- Component diagrams (rarely): Internal structure of a single service. Only create when a service is complex enough to warrant it.
Per diagram:
- Define scope — one diagram, one concern
- Identify elements and relationships
- Add brief annotations explaining non-obvious connections
- Ensure traceability: every element in a detailed diagram should trace to a parent in a higher-level diagram
Linking to decisions: When an ADR changes architecture, reference the affected diagrams in the ADR and update them. For ADR creation, use the architecture-design skill.
Step 5: Validate
Run through the validation checklist before considering documentation complete:
Step 6: Establish Maintenance Governance
Documentation that isn't maintained becomes misleading. Define when and how diagrams get updated:
Update triggers:
- New service or data store added
- Service boundary changed or service split/merged
- New external dependency integrated
- ADR accepted that affects architecture (use
architecture-design skill)
Promotion model: Diagrams mature over time:
Conceptual sketch (idea / RFC)
↓ proves valuable, referenced repeatedly
Runtime diagram (structured, tooled)
↓ represents stable structural change
Canonical diagram (source of truth)
Review cadence:
- Canonical diagrams: review quarterly or after major architecture changes
- Runtime diagrams: review when deployment topology changes
- Conceptual diagrams: no formal review — treat as disposable
Principles Applied
- KISS: Start with one system context diagram. Add layers only when they serve a clear audience.
- YAGNI: A monolith doesn't need four C4 levels. Document what exists, not what might exist.
- Separation of Concerns: Each abstraction level serves a different purpose. Don't mix structural truth with runtime behavior in the same diagram.
- DRY: Canonical diagrams are the single source of truth for system structure. Other diagrams reference — never redefine — those elements.
Cross-Skill References
- architecture-design: For making and documenting architectural decisions (ADRs). Use when a documentation effort reveals undocumented or contested decisions.
- project-documentation: For README, CONTRIBUTING, API docs, and other non-architecture documentation.
- infrastructure-as-code: For aligning runtime/deployment diagrams with actual IaC definitions.
- containerization: For Kubernetes-specific topology diagrams that align with actual manifests.
1---2name: architecture-documentation3description: Design and maintain architecture documentation with multi-level diagrams (C4) and docs-as-code. Triggers: architecture diagram, document the architecture, C4 diagram, system context, container diagram, component diagram, architecture docs, docs-as-code, PlantUML, Structurizr, D2, Mermaid architecture, infrastructure diagram, runtime flow. Use architecture-design for ADRs.4---56# Architecture Documentation78Help the user create and maintain architecture documentation that is version-controlled, multi-layered, and useful. Good architecture docs answer "what exists and how does it connect?" — not by drawing everything, but by drawing the right things at the right abstraction level.910## Workflow1112### Step 1: Assess Documentation Scope1314Understand what exists and what's needed before creating anything:1516- **Current state**: Are there existing diagrams, READMEs with architecture sections, or whiteboard photos? Scan the repo for `docs/`, `architecture/`, `.puml`, `.d2`, or Mermaid blocks in markdown.17- **Audience**: Who will read this? New hires need conceptual overviews. Ops teams need runtime topology. Architects need structural boundaries.18- **System complexity**: How many services, data stores, and external dependencies? This determines which abstraction levels are worth creating.1920A simple monolith may only need one conceptual diagram. A distributed system with 5+ services likely needs canonical and runtime levels too.2122### Step 2: Choose Abstraction Levels2324Architecture documentation works at three distinct levels. Not every system needs all three — apply YAGNI.2526| Level | Purpose | Answers | Stability |27|-------|---------|---------|-----------|28| **Canonical** | What exists structurally | "What are the building blocks?" | Stable — changes with architecture |29| **Runtime** | How it behaves operationally | "How does data flow? Where does code run?" | Medium — changes with deployment |30| **Conceptual** | How to explain it | "What's the mental model?" | Ephemeral — changes with audience |3132**Guidelines for selection:**33- **Always start with Conceptual** — even a quick sketch helps align understanding34- **Add Canonical** when the system has multiple services, teams, or bounded contexts35- **Add Runtime** when deployment topology, data flows, or infrastructure matter for operations3637See [references/abstraction-levels.md](references/abstraction-levels.md) for detailed guidance on each level, traceability rules, and the promotion model.3839### Step 3: Select Tooling and Establish Conventions4041Choose tools that fit the team's stack. The framework is tool-agnostic — what matters is consistent usage, not specific tools.4243**Recommended defaults by level:**4445| Level | Recommended Tools | Alternatives |46|-------|------------------|--------------|47| Canonical | C4-PlantUML, Structurizr DSL | Mermaid C4 extension, Ilograph |48| Runtime | D2, Mermaid | PlantUML sequence/deployment, Diagrams-as-code (Python) |49| Conceptual | Mermaid, Excalidraw | Whiteboard photos, ASCII diagrams |5051**Conventions to establish:**52- **Shared vocabulary**: Create a glossary of system names. Every diagram must use these names exactly — no aliasing or renaming per diagram.53- **File naming**: Use a consistent pattern like `{level}-{scope}.{ext}` (e.g., `canonical-system-context.puml`, `runtime-checkout-flow.d2`)54- **Repository structure**: Set up `docs/architecture/` using the template at [templates/architecture-doc.md](templates/architecture-doc.md)55- **Docs-as-code**: All diagrams must be text-based, version-controlled, and reviewable in PRs5657See [references/diagram-tooling.md](references/diagram-tooling.md) for tool comparison and syntax examples.5859### Step 4: Create Diagrams6061Work top-down — start at the highest level and add detail only where needed:62631. **System Context** (canonical): The system as a black box, showing users and external dependencies. This is the single most valuable diagram.642. **Container diagram** (canonical): Zoom into the system — services, data stores, message brokers, frontends.653. **Runtime views** (as needed): Data flow diagrams, sequence diagrams for key interactions, deployment/infrastructure topology.664. **Component diagrams** (rarely): Internal structure of a single service. Only create when a service is complex enough to warrant it.6768**Per diagram:**69- Define scope — one diagram, one concern70- Identify elements and relationships71- Add brief annotations explaining non-obvious connections72- Ensure traceability: every element in a detailed diagram should trace to a parent in a higher-level diagram7374**Linking to decisions:** When an ADR changes architecture, reference the affected diagrams in the ADR and update them. For ADR creation, use the `architecture-design` skill.7576### Step 5: Validate7778Run through the validation checklist before considering documentation complete:7980- [ ] All services/systems in the codebase appear in canonical diagrams81- [ ] Runtime diagrams reference only elements defined in canonical diagrams (infrastructure-only components like load balancers are exceptions)82- [ ] Naming is consistent across all diagrams and matches the glossary83- [ ] ADRs that changed architecture reference affected diagrams84- [ ] Diagrams are version-controlled and render correctly85- [ ] Conceptual diagrams are clearly labeled as non-canonical86- [ ] A new team member can orient themselves using only these docs8788### Step 6: Establish Maintenance Governance8990Documentation that isn't maintained becomes misleading. Define when and how diagrams get updated:9192**Update triggers:**93- New service or data store added94- Service boundary changed or service split/merged95- New external dependency integrated96- ADR accepted that affects architecture (use `architecture-design` skill)9798**Promotion model:** Diagrams mature over time:99```100Conceptual sketch (idea / RFC)101 ↓ proves valuable, referenced repeatedly102Runtime diagram (structured, tooled)103 ↓ represents stable structural change104Canonical diagram (source of truth)105```106107**Review cadence:**108- Canonical diagrams: review quarterly or after major architecture changes109- Runtime diagrams: review when deployment topology changes110- Conceptual diagrams: no formal review — treat as disposable111112## Principles Applied113114- **KISS**: Start with one system context diagram. Add layers only when they serve a clear audience.115- **YAGNI**: A monolith doesn't need four C4 levels. Document what exists, not what might exist.116- **Separation of Concerns**: Each abstraction level serves a different purpose. Don't mix structural truth with runtime behavior in the same diagram.117- **DRY**: Canonical diagrams are the single source of truth for system structure. Other diagrams reference — never redefine — those elements.118119## Cross-Skill References120121- **architecture-design**: For making and documenting architectural decisions (ADRs). Use when a documentation effort reveals undocumented or contested decisions.122- **project-documentation**: For README, CONTRIBUTING, API docs, and other non-architecture documentation.123- **infrastructure-as-code**: For aligning runtime/deployment diagrams with actual IaC definitions.124- **containerization**: For Kubernetes-specific topology diagrams that align with actual manifests.