Interactively co-build a software architecture using Simon Brown's C4 model (Context, Container, Component, Code). The skill detects the usage mode (greenfield design, retro-documenting from code or prose, review/explanation, update), runs a structured framing dialogue, proposes incremental drafts, and iterates until explicit user validation. Output format is negotiated (default Mermaid C4 + Markdown; alternatives Structurizr DSL, PlantUML, images). Destination is negotiated too: local filesystem by default, or connected MCP (Notion, Google Drive, Linear documents…). Use this skill whenever the user asks for a C4 diagram, modèle C4, architecture diagram, container diagram, system context, diagramme d'architecture, wants to brainstorm/design a system architecture, shares code or prose wanting it documented, or wants to review/update an existing C4. Trigger proactively whenever an architecture overview or system documentation would clearly help — even without an explicit "C4" mention.
Ships in c4-skills. 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.
Read when SKILL.md points to them.
Simon Brown's C4 model (c4model.com) describes a software architecture through four hierarchical levels of abstraction. This skill covers the full cycle around a C4 diagram: design, retro-documentation, review, update.
| Level | Diagram | Mermaid | Zoom | Audience |
|---|---|---|---|---|
| 1 | Context | C4Context | System + actors / external systems | Everyone (technical and non-technical) |
| 2 | Container | C4Container | Applications, services, internal data stores | Technical team (dev, ops, architecture) |
| 3 | Component | C4Component | Internal components of a container | Developers of that container |
| 4 | Code | classDiagram (UML) | Classes/functions of a component | Developers (often generated by the IDE) |
Simon Brown's golden rule: "Context + Container diagrams are sufficient for most software development teams." Only generate levels 3 and 4 when the user explicitly asks for them or when they bring genuine value (complex container, onboarding, high-risk zone). When in doubt, produce levels 1 and 2 and propose to go deeper.
C4 also supports supporting diagrams: System Landscape, Deployment, Dynamic. See supporting-diagrams.md.
Always start by identifying the mode. If it's not obvious from the user's message, ask one question:
"Do you want to: (a) design a new architecture, (b) retro-document an existing system (code or prose), (c) review or explain an existing diagram, or (d) update a C4 that's already in place?"
| User signal | Mode |
|---|---|
| Path to a repo, code snippet pasted, "here's my codebase" | Document-code |
| README, ADR, spec, meeting transcript pasted | Document-prose |
| Diagram (Mermaid/PlantUML/Structurizr) pasted + "what is this?" / "is this good?" | Review |
| Existing diagram + "add/remove/change X" | Update |
| Vague idea, no artifact, "I want to design…" | Design |
Once the mode is known, read the corresponding file to apply its detailed flow:
| Mode | File |
|---|---|
| Design | mode-design.md |
| Document-code | mode-document-code.md |
| Document-prose | mode-document-prose.md |
| Review | mode-review.md |
| Update | mode-update.md |
| Supporting (Landscape/Deployment/Dynamic) | supporting-diagrams.md |
The rules in the Common contract section below apply to every mode that produces or modifies a diagram.
Default: one Markdown document per level, with the diagram embedded as Mermaid C4. Mermaid C4 renders in most Markdown viewers that support Mermaid — GitHub and GitLab render it natively; Obsidian supports it natively; Notion supports Mermaid with varying compatibility for C4-specific syntax; VS Code requires the Markdown Preview Mermaid Support extension. Always verify C4 rendering in the target viewer, since Mermaid marks C4 syntax as experimental.
Alternatives negotiated with the user:
mermaid-cli on the user's sideConfirm the format during framing. Never assume.
Default: local filesystem, in docs/architecture/ (or another path if the user prefers). Alternatives when an MCP is connected in the session:
List only the external tool integrations actually available in the session, never invent. If several are available, ask which one. Inline output (rendered in the conversation without persistence) is also valid for a quick review or exploration.
Rules derived from the C4 model. They apply to every diagram produced or corrected by the skill:
Diagram
Elements
Relationships
BiRel, split it into two Rels)Invariant: never deliver a bare diagram without the document that accompanies it — the diagram must remain self-standing, but the document describes the why (context, trade-offs, assumptions). This rule holds regardless of the output format.
Default structure (local filesystem):
docs/architecture/
├── 01-context.md # Level 1 — always
├── 02-container.md # Level 2 — always
├── 03-component-<container-name>.md # Level 3 — one per zoomed container
└── 04-code-<component-name>.md # Level 4 — rare, on demand
On an MCP destination, granularity stays identical: one page/document per level, linked via the "Links to other levels" section of the template.
Each document follows level-template.md:
For filled-out examples, see examples/.
Before any delivery, run through review-checklist.md — Simon Brown's official checklist plus the C4-specific additions introduced by this skill.
Mermaid natively supports C4Context, C4Container, C4Component, C4Dynamic, C4Deployment. Level Code uses classDiagram (classical UML).
Complete, authoritative reference:
mermaid-c4-syntax.md(exhaustive signatures, nested boundaries, styles, directions, Context/Dynamic/Deployment examples, unsupported features).
# Actors and systems
Person(alias, "Label", "Description")
Person_Ext(alias, "Label", "Description")
System(alias, "Label", "Description")
System_Ext(alias, "Label", "Description")
SystemDb(alias, "Label", "Description")
SystemQueue(alias, "Label", "Description")
# Containers (level 2)
Container(alias, "Label", "Technology", "Description")
ContainerDb(alias, "Label", "Technology", "Description")
ContainerQueue(alias, "Label", "Technology", "Description")
# Components (level 3)
Component(alias, "Label", "Technology", "Description")
# Boundaries
Enterprise_Boundary(alias, "Enterprise") { ... } # at the Context level
System_Boundary(alias, "System") { ... } # at the Container level
Container_Boundary(alias, "Container") { ... } # at the Component level
# Relationships
Rel(from, to, "Intent label", "Technology/Protocol")
Rel_U / Rel_D / Rel_L / Rel_R # direction hints
C4Container
title Container diagram for Internet Banking System
Person(customer, "Banking Customer", "A customer of the bank.")
System_Boundary(banking, "Internet Banking System") {
Container(spa, "Single-Page App", "JavaScript, Angular", "Provides all of the Internet banking functionality to customers via their web browser.")
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet banking functionality to customers via their mobile device.")
Container(api, "API Application", "Java, Docker Container", "Provides Internet banking functionality via a JSON/HTTPS API.")
ContainerDb(db, "Database", "Oracle Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
}
System_Ext(mail_system, "E-mail System", "The internal Microsoft Exchange e-mail system.")
System_Ext(mainframe, "Mainframe Banking System", "Stores all of the core banking information.")
Rel(customer, spa, "Views account balances, makes payments using")
Rel(customer, mobile, "Views account balances, makes payments using")
Rel(spa, api, "Makes API calls to", "JSON/HTTPS")
Rel(mobile, api, "Makes API calls to", "JSON/HTTPS")
Rel(api, db, "Reads from and writes to", "JDBC")
Rel(api, mail_system, "Sends e-mail using", "SMTP")
Rel(api, mainframe, "Makes API calls to", "XML/HTTPS")
Mermaid has no native C4Code type. Use classDiagram — consistent with C4 practice.
classDiagram
class SignInController {
-SecurityComponent security
+signIn(username, password)
}
class SecurityComponent {
-UserRepository users
+authenticate(username, password) User
}
SignInController --> SecurityComponent
Rel(A, B, "..."), both A and B MUST be defined in the diagram. If you reference an undefined alias, Mermaid crashes with Cannot read properties of undefined (reading 'x').{ to System() or Container(). To group elements, you MUST use System_Boundary() or Container_Boundary(). Doing otherwise causes Mermaid parse errors.Documentation for the selected mode (load with Read after detection):
mode-design.md — greenfield design, 5 dialogued phasesmode-document-code.md — retro-doc from a repo (with delegation to sub-agents or deep scanning if needed)mode-document-prose.md — retro-doc from README/ADR/specmode-review.md — critique or explanation of a diagrammode-update.md — evolving an existing C4supporting-diagrams.md — System Landscape, C4Deployment, C4DynamicCross-cutting references (consult as needed):
mermaid-c4-syntax.md — complete Mermaid C4 syntax (sourced from the official docs mermaid.js.org/syntax/c4.html)review-checklist.md — Simon Brown's review checklist (c4model.com/diagrams/checklist)level-template.md — Markdown template to use for each levelexamples/ — filled-out example deliverables (Internet Banking System)examples/01-context.example.md (opens in a new tab)examples/02-container.example.md (opens in a new tab)level-template.md (opens in a new tab)mermaid-c4-syntax.md (opens in a new tab)mode-design.md (opens in a new tab)mode-document-code.md (opens in a new tab)mode-document-prose.md (opens in a new tab)mode-review.md (opens in a new tab)mode-update.md (opens in a new tab)review-checklist.md (opens in a new tab)supporting-diagrams.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/c4-skills:c4-modelfrom c4-skills
c4-skills@dev-stack is listed by miguelrumbo/dev-stack — review the source before installing
npx claudepluginhub miguelrumbo/dev-stack --plugin c4-skills2 skills in this plugin