Produces C4 context, container and optionally component diagrams as Mermaid, PlantUML or Structurizr DSL from a codebase or description, with a legend and stated assumptions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Write C4 Diagram?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hermes-hq-write-c4-diagram)
---
name: write-c4-diagram
description: Produces C4 context, container and optionally component diagrams as Mermaid, PlantUML or Structurizr DSL from a codebase or description, with a legend and stated assumptions.
license: CC0-1.0
arguments:
- system_description
- levels
- notation
argument-hint: <system_description> [levels] [notation]
disable-model-invocation: true
metadata:
version: 1.0.0
kind: prompt
category: architecture
source: https://hermes-ide.com/prompts/write-c4-diagram
catalog: 2026.1014.1
---
# Write C4 architecture diagrams
## Inputs
- `system_description` (required): The system to diagram, as a description, or a pointer to the repo or folders to read (manifests, deploy config, service entry points).
- `levels` (optional; one of: context, container, component; default: container): How deep to go. context draws only the system context; container adds the container diagram; component adds one component diagram for the most important container.
- `notation` (optional; one of: mermaid, plantuml, structurizr; default: mermaid): Diagram-as-code notation to output.
Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.
<context>
The C4 model describes software at four zoom levels: system context (the system, its users and the external systems it talks to), containers (separately deployable or runnable things such as web apps, APIs, workers, databases and queues), components (the major building blocks inside one container) and code. Most teams need only the first two. Diagrams go wrong in predictable ways: boxes with no technology or responsibility, unlabelled arrows, a library drawn as a container, a database shared by everything with no owner shown, and elements that exist only in someone's memory, not in the code. A useful C4 diagram is accurate, readable in a minute and states what it does not know.
</context>
<task>
Produce C4 diagrams down to the "$levels" level, written in $notation, for:
<system>
$system_description
</system>
1. Gather the facts. If you were pointed at a repo, read what reveals the architecture: build manifests, Dockerfiles and compose files, deployment and infrastructure config, service entry points, environment variable names, HTTP and queue clients, and database migrations. Cite the file each element comes from. If you have only a description, use it and mark anything you inferred.
2. Identify the elements:
- **People:** user roles and operators, by role not by name.
- **Software systems:** the system in scope and every external system it calls or is called by, with direction.
- **Containers** (for the container level and below): each runnable or deployable unit and each data store, with its technology and one-line responsibility. Libraries and modules are not containers.
- **Components** (for the component level): the main building blocks of the single most important container, which you name and justify, or the one the user indicated.
3. Label every relationship with what flows and how, for example "Places orders [JSON over HTTPS]" or "Publishes OrderPlaced [Kafka]". Every arrow has a direction, a verb phrase and, at container level and below, a protocol.
4. Write the diagrams in $notation:
- mermaid: Mermaid C4 syntax (`C4Context`, `C4Container`, `C4Component`) with `Person`, `System`, `System_Ext`, `Container`, `ContainerDb`, `Component` and `Rel`. Mention that Mermaid's C4 support is still experimental in some renderers.
- plantuml: the C4-PlantUML standard library (`!include <C4/C4_Context>`, `<C4/C4_Container>`, `<C4/C4_Component>`) with `SHOW_LEGEND()`.
- structurizr: one Structurizr DSL `workspace` containing the model once and a view per level (`systemContext`, `container`, `component`) with `autoLayout`.
One fenced block per diagram (one block in total for Structurizr), each with a title.
5. Keep each diagram readable: at most about 15 elements. If the system is bigger, group or split and say how.
6. Add a legend explaining shapes, colours, line styles and the meaning of external elements, unless the notation renders one (then say so).
</task>
<constraints>
- Do not invent services, data stores, external systems or protocols. Anything not found in the code or description is either left out or marked as assumed in the element catalogue.
- Use the C4 vocabulary correctly: a container is something that runs or stores data, not a Docker container by definition and not a code module.
- The output must render as written: check identifiers are unique, quotes are balanced and every relationship refers to a defined element.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
</constraints>
<output_format>
## Scope
The system in scope, the levels drawn, and for a component diagram which container and why. At most 4 lines.
## Diagrams
One fenced code block per diagram (or one Structurizr workspace), each preceded by its title.
## Legend
Bullets, or "Rendered by the notation".
## Element catalogue
Table: element, C4 type, technology, responsibility, source (file path or "description" or "assumed").
## Assumptions and gaps
Numbered. What you inferred or could not find, and what to check to confirm it.
</output_format>