Visual Communication
A diagram is not decoration — it is compression. If three paragraphs describe the same flow a diagram shows in 20 seconds, the diagram wins. If a diagram takes ten minutes to read, the paragraphs won.
When a diagram beats prose
| Signal |
Diagram |
| The reader needs to understand a process with branches |
Flowchart |
| The reader needs to see who talks to whom and when |
Sequence diagram |
| The reader needs to understand state transitions |
State diagram |
| The reader needs to see what depends on what |
Component / dependency diagram |
| The reader needs the data model |
ER diagram |
| The reader needs the big picture of a system |
C4 diagram |
| The reader needs a 2×2 trade-off / matrix |
Quadrant / matrix |
When a diagram does NOT beat prose:
- Simple linear sequences (1 → 2 → 3) — a list is clearer.
- Content-heavy ideas — diagrams force compression that loses nuance.
- When the diagram would have 30+ nodes — split or describe.
- When the reader needs exact values — a table beats a chart.
Picking the right diagram
Flow-oriented (what happens in what order)?
├── With branches/decisions → flowchart
├── Between actors/components over time → sequence diagram
└── With explicit states → state diagram
Structure-oriented (how is it organized)?
├── Data → ER diagram
├── Code → class diagram
├── System at high level → C4 diagram
└── Components + dependencies → dependency graph
Comparison-oriented?
├── 2 dimensions, 4 quadrants → quadrant chart
└── N options, M criteria → matrix / table (often not a diagram)
Full decision tree with worked examples in references/diagram-selection-matrix.md.
Mermaid is the default
Mermaid is the best default for engineering diagrams because:
- Text-based → versionable in git.
- Renders natively in GitHub, GitLab, Notion, Obsidian, VS Code.
- Low cost to edit; no image file to re-export.
- Adequate for 90% of diagrams engineering teams draw.
Use PNG/SVG diagrams only when Mermaid cannot express the idea (complex physical diagrams, highly custom layouts).
Mermaid templates
Flowchart
flowchart TD
Start([Start]) --> Check{Is input valid?}
Check -->|No| Error[Return 400]
Check -->|Yes| Lookup[Lookup in cache]
Lookup --> Hit{Cache hit?}
Hit -->|Yes| Return[Return cached]
Hit -->|No| Fetch[Fetch from DB]
Fetch --> Store[Store in cache]
Store --> Return
Return --> End([End])
Error --> End
Rules:
TD (top-down) or LR (left-right). Avoid BT / RL — readers expect top-down or left-right.
- Decision nodes
{} have explicit |Yes| / |No| labels.
- Start and end nodes use
().
- Node IDs short; labels readable.
Sequence diagram
sequenceDiagram
autonumber
participant U as User
participant API as API Server
participant DB as Database
participant Cache as Redis
U->>API: POST /login
API->>Cache: Get session
alt Cache hit
Cache-->>API: session
else Cache miss
API->>DB: Query user
DB-->>API: user row
API->>Cache: Set session
end
API-->>U: 200 OK + token
Rules:
autonumber adds step numbers — makes the diagram referenceable.
- Use
alt / else for branches, loop for retries, par / and for parallelism.
- Arrows:
->> solid (sync), -->> dashed (async/return).
State diagram
stateDiagram-v2
[*] --> Draft
Draft --> Reviewing: submit
Reviewing --> Draft: reject
Reviewing --> Accepted: approve
Accepted --> Superseded: new ADR
Accepted --> [*]
Superseded --> [*]
Rules:
[*] = start/end.
- Transition labels name the event that triggers the transition.
- Every state has at least one outbound transition or is terminal.
ER diagram
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
ORDER }o--|| ADDRESS : "ships to"
USER {
uuid id PK
string email UK
string name
}
ORDER {
uuid id PK
uuid user_id FK
timestamp created_at
}
Cardinality:
||--o{ one-to-many (1 to 0-or-more)
||--|{ one-to-many (1 to 1-or-more)
||--|| one-to-one
}o--o{ many-to-many
Full Mermaid cheat sheet with class, gitGraph, pie, and quadrant in references/mermaid-cheatsheet.md.
The C4 model
C4 structures software architecture diagrams at four zoom levels:
| Level |
Shows |
Audience |
| Context |
Your system + users + external systems |
Any stakeholder |
| Container |
Applications / services inside your system |
Tech leads, architects |
| Component |
Major components inside a container |
Developers |
| Code |
Classes / modules inside a component |
Developers (rarely needed) |
Rules:
- Most teams need only Context + Container. Component diagrams for complex services. Code-level rarely.
- Each level should fit on one screen. If not, the scope is wrong.
- Legend required — what is a box, what is an arrow, what are the styles.
C4 can be rendered in Mermaid using C4Context / C4Container, or via dedicated tools like Structurizr. See references/c4-model-guide.md for the four levels with worked examples.
Diagram-as-code principles
- Checked into the repo with the code it describes. Diagrams drift faster than code; proximity helps.
- Updated in the PR that changes the system. Reviewers catch staleness.
- Consistent style across diagrams. Same shape = same concept.
- Labeled arrows — an unlabeled arrow is a puzzle.
- Direction matters — request arrows point one way, data flow another; pick conventions and stick to them.
Anti-patterns
- Decoration diagrams — added because docs look incomplete without one. If the diagram conveys nothing, delete it.
- Mystery boxes — boxes without labels or with jargon-only labels. Every box has a purpose that must be readable.
- Unlabeled arrows — arrows without direction semantics. The reader guesses.
- Everything-on-one-diagram — 40 boxes, 80 arrows, unreadable. Split into zoom levels (C4) or per-flow diagrams.
- Wrong diagram type — a sequence diagram where a flowchart was needed, or vice versa. Match diagram to the question.
- Out-of-date diagrams — worse than no diagram. Readers act on stale information.
- Image files instead of code — PNG/JPG in the repo. Nobody updates them.
- C4 without legend — readers don't know what the shapes mean.
Workflow
- Decide whether a diagram helps. If prose is ≤3 paragraphs and linear, skip.
- Pick the diagram type. Flow? Sequence? State? Structure? Use the decision tree.
- Draft in Mermaid. Simple case first — no styling.
- Review for readability. Can a reader unfamiliar with the system follow it in 60 seconds?
- Label everything. Arrows, nodes, groups. No orphans.
- Check the diagram into the repo next to the code it describes.
- Update with the PR that changes the system.
References
| File |
Contents |
references/mermaid-cheatsheet.md |
Full Mermaid syntax for flowchart, sequence, state, ER, class, gitGraph, pie, quadrant |
references/diagram-selection-matrix.md |
When to use which diagram type; worked examples; when NOT to diagram |
references/c4-model-guide.md |
The four C4 levels, when to stop, worked examples, Mermaid templates |
Related skills
- structured-writing — diagrams inside a BLUF-style doc.
- stakeholder-alignment — architecture diagrams inside RFCs.
- documentation-discipline — when to check a diagram into the repo.
- frontend-design — UI/UX mockups and visual design (different domain).
- frontend-slides — slide decks and presentations.
1---2name: visual-communication3description: Communicate systems and flows visually using Mermaid (flowchart, sequence, state, ER, class), the C4 model, and diagram-as-code. Use when the user asks to draw a flow, sequence diagram, state machine, ER diagram, C4 model, architecture diagram, or wants Mermaid code for a system, wants to pick a diagram type, or wants to visualize a process as a flowchart. NOT for UI/UX mockups or visual design (use frontend-design). NOT for slide graphics or presentations (use frontend-slides). NOT for wireframes or design systems (use frontend-design).4---56# Visual Communication78A diagram is not decoration — it is compression. If three paragraphs describe the same flow a diagram shows in 20 seconds, the diagram wins. If a diagram takes ten minutes to read, the paragraphs won.910## When a diagram beats prose1112| Signal | Diagram |13|---|---|14| The reader needs to understand a process with branches | Flowchart |15| The reader needs to see *who talks to whom and when* | Sequence diagram |16| The reader needs to understand state transitions | State diagram |17| The reader needs to see *what depends on what* | Component / dependency diagram |18| The reader needs the data model | ER diagram |19| The reader needs the big picture of a system | C4 diagram |20| The reader needs a 2×2 trade-off / matrix | Quadrant / matrix |2122When a diagram does NOT beat prose:2324- Simple linear sequences (1 → 2 → 3) — a list is clearer.25- Content-heavy ideas — diagrams force compression that loses nuance.26- When the diagram would have 30+ nodes — split or describe.27- When the reader needs exact values — a table beats a chart.2829## Picking the right diagram3031```32Flow-oriented (what happens in what order)?33├── With branches/decisions → flowchart34├── Between actors/components over time → sequence diagram35└── With explicit states → state diagram3637Structure-oriented (how is it organized)?38├── Data → ER diagram39├── Code → class diagram40├── System at high level → C4 diagram41└── Components + dependencies → dependency graph4243Comparison-oriented?44├── 2 dimensions, 4 quadrants → quadrant chart45└── N options, M criteria → matrix / table (often not a diagram)46```4748Full decision tree with worked examples in `references/diagram-selection-matrix.md`.4950## Mermaid is the default5152Mermaid is the best default for engineering diagrams because:5354- Text-based → versionable in git.55- Renders natively in GitHub, GitLab, Notion, Obsidian, VS Code.56- Low cost to edit; no image file to re-export.57- Adequate for 90% of diagrams engineering teams draw.5859Use PNG/SVG diagrams only when Mermaid cannot express the idea (complex physical diagrams, highly custom layouts).6061## Mermaid templates6263### Flowchart6465```mermaid66flowchart TD67 Start([Start]) --> Check{Is input valid?}68 Check -->|No| Error[Return 400]69 Check -->|Yes| Lookup[Lookup in cache]70 Lookup --> Hit{Cache hit?}71 Hit -->|Yes| Return[Return cached]72 Hit -->|No| Fetch[Fetch from DB]73 Fetch --> Store[Store in cache]74 Store --> Return75 Return --> End([End])76 Error --> End77```7879Rules:80- `TD` (top-down) or `LR` (left-right). Avoid `BT` / `RL` — readers expect top-down or left-right.81- Decision nodes `{}` have explicit `|Yes|` / `|No|` labels.82- Start and end nodes use `()`.83- Node IDs short; labels readable.8485### Sequence diagram8687```mermaid88sequenceDiagram89 autonumber90 participant U as User91 participant API as API Server92 participant DB as Database93 participant Cache as Redis9495 U->>API: POST /login96 API->>Cache: Get session97 alt Cache hit98 Cache-->>API: session99 else Cache miss100 API->>DB: Query user101 DB-->>API: user row102 API->>Cache: Set session103 end104 API-->>U: 200 OK + token105```106107Rules:108- `autonumber` adds step numbers — makes the diagram referenceable.109- Use `alt` / `else` for branches, `loop` for retries, `par` / `and` for parallelism.110- Arrows: `->>` solid (sync), `-->>` dashed (async/return).111112### State diagram113114```mermaid115stateDiagram-v2116 [*] --> Draft117 Draft --> Reviewing: submit118 Reviewing --> Draft: reject119 Reviewing --> Accepted: approve120 Accepted --> Superseded: new ADR121 Accepted --> [*]122 Superseded --> [*]123```124125Rules:126- `[*]` = start/end.127- Transition labels name the event that triggers the transition.128- Every state has at least one outbound transition or is terminal.129130### ER diagram131132```mermaid133erDiagram134 USER ||--o{ ORDER : places135 ORDER ||--|{ LINE_ITEM : contains136 ORDER }o--|| ADDRESS : "ships to"137 USER {138 uuid id PK139 string email UK140 string name141 }142 ORDER {143 uuid id PK144 uuid user_id FK145 timestamp created_at146 }147```148149Cardinality:150- `||--o{` one-to-many (1 to 0-or-more)151- `||--|{` one-to-many (1 to 1-or-more)152- `||--||` one-to-one153- `}o--o{` many-to-many154155Full Mermaid cheat sheet with class, gitGraph, pie, and quadrant in `references/mermaid-cheatsheet.md`.156157## The C4 model158159C4 structures software architecture diagrams at four zoom levels:160161| Level | Shows | Audience |162|---|---|---|163| **Context** | Your system + users + external systems | Any stakeholder |164| **Container** | Applications / services inside your system | Tech leads, architects |165| **Component** | Major components inside a container | Developers |166| **Code** | Classes / modules inside a component | Developers (rarely needed) |167168Rules:169- Most teams need only Context + Container. Component diagrams for complex services. Code-level rarely.170- Each level should fit on one screen. If not, the scope is wrong.171- Legend required — what is a box, what is an arrow, what are the styles.172173C4 can be rendered in Mermaid using `C4Context` / `C4Container`, or via dedicated tools like Structurizr. See `references/c4-model-guide.md` for the four levels with worked examples.174175## Diagram-as-code principles176177- **Checked into the repo** with the code it describes. Diagrams drift faster than code; proximity helps.178- **Updated in the PR that changes the system.** Reviewers catch staleness.179- **Consistent style** across diagrams. Same shape = same concept.180- **Labeled arrows** — an unlabeled arrow is a puzzle.181- **Direction matters** — request arrows point one way, data flow another; pick conventions and stick to them.182183## Anti-patterns184185- **Decoration diagrams** — added because docs look incomplete without one. If the diagram conveys nothing, delete it.186- **Mystery boxes** — boxes without labels or with jargon-only labels. Every box has a purpose that must be readable.187- **Unlabeled arrows** — arrows without direction semantics. The reader guesses.188- **Everything-on-one-diagram** — 40 boxes, 80 arrows, unreadable. Split into zoom levels (C4) or per-flow diagrams.189- **Wrong diagram type** — a sequence diagram where a flowchart was needed, or vice versa. Match diagram to the question.190- **Out-of-date diagrams** — worse than no diagram. Readers act on stale information.191- **Image files instead of code** — PNG/JPG in the repo. Nobody updates them.192- **C4 without legend** — readers don't know what the shapes mean.193194## Workflow1951961. **Decide whether a diagram helps.** If prose is ≤3 paragraphs and linear, skip.1972. **Pick the diagram type.** Flow? Sequence? State? Structure? Use the decision tree.1983. **Draft in Mermaid.** Simple case first — no styling.1994. **Review for readability.** Can a reader unfamiliar with the system follow it in 60 seconds?2005. **Label everything.** Arrows, nodes, groups. No orphans.2016. **Check the diagram into the repo** next to the code it describes.2027. **Update with the PR** that changes the system.203204## References205206| File | Contents |207|---|---|208| `references/mermaid-cheatsheet.md` | Full Mermaid syntax for flowchart, sequence, state, ER, class, gitGraph, pie, quadrant |209| `references/diagram-selection-matrix.md` | When to use which diagram type; worked examples; when NOT to diagram |210| `references/c4-model-guide.md` | The four C4 levels, when to stop, worked examples, Mermaid templates |211212## Related skills213214- **structured-writing** — diagrams inside a BLUF-style doc.215- **stakeholder-alignment** — architecture diagrams inside RFCs.216- **documentation-discipline** — when to check a diagram into the repo.217- **frontend-design** — UI/UX mockups and visual design (different domain).218- **frontend-slides** — slide decks and presentations.