Principle
Diagrams should clarify, not complicate. Start simple, add detail only when needed. A 5-box flowchart beats a 50-node sprawl.
When User Describes a System or Flow
- Identify diagram type — Is this a flow, architecture, sequence, or data model?
- Choose format — Mermaid (default), PlantUML (complex), ASCII (inline), SVG (custom)
- Draft minimal version — Core elements only, no decoration
- Iterate — Add detail based on feedback
Diagram Types
| Type |
Use For |
Format |
| Flowchart |
Processes, decisions, workflows |
Mermaid flowchart |
| Sequence |
API calls, interactions, protocols |
Mermaid sequenceDiagram |
| Architecture |
System components, infrastructure |
Mermaid flowchart or C4 |
| ER/Data model |
Database schemas, relationships |
Mermaid erDiagram |
| Class |
Object structure, inheritance |
Mermaid classDiagram |
| State |
Lifecycles, status transitions |
Mermaid stateDiagram-v2 |
| Timeline |
Project phases, history |
Mermaid timeline |
| Mindmap |
Brainstorming, concept mapping |
Mermaid mindmap |
Output Methods
| Method |
When |
| Mermaid code block |
User can render (docs, GitHub, Notion) |
| Render to PNG/SVG |
User needs image file |
| ASCII inline |
Quick sketch in chat |
| HTML + Mermaid.js |
Interactive viewing |
Rendering Mermaid to Image
# Using mmdc (mermaid-cli)
npx -y @mermaid-js/mermaid-cli mmdc -i diagram.mmd -o diagram.png -b transparent
# Or via browser tool
# Write HTML with Mermaid, screenshot the rendered diagram
Mermaid Quick Reference
Flowchart:
flowchart LR
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
Sequence:
sequenceDiagram
User->>API: Request
API->>DB: Query
DB-->>API: Result
API-->>User: Response
ER Diagram:
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ ITEM : contains
Style Guidelines
- Left-to-right (LR) for processes, top-to-bottom (TB) for hierarchies
- Max 10-15 nodes per diagram, split if larger
- Consistent naming — all caps for systems, lowercase for actions
- Subgraphs to group related components
- Color sparingly — highlight critical paths only
Common Requests
| Request |
Interpret As |
| "Draw my API flow" |
Sequence diagram: client → API → services |
| "Show the architecture" |
Flowchart with subgraphs for components |
| "Database schema" |
ER diagram with relationships |
| "How the auth works" |
Sequence or flowchart depending on complexity |
| "User journey" |
Flowchart with decision points |
Anti-Patterns
- ❌ Too many nodes (split into multiple diagrams)
- ❌ Decorative icons without meaning
- ❌ Mixing abstraction levels (database tables next to business concepts)
- ❌ Arrows in all directions (confuses flow)
- ❌ Labels too long (use short names, add legend if needed)
1---
2name: diagram
3description: Generate diagrams from descriptions with Mermaid, PlantUML, or ASCII for architecture, flows, sequences, and data models.
4metadata:
5 source: https://skillmd.com/skills/modbender/diagram
6---
7
8## Principle
9
10Diagrams should **clarify, not complicate**. Start simple, add detail only when needed. A 5-box flowchart beats a 50-node sprawl.
11
12## When User Describes a System or Flow
13
141. **Identify diagram type** — Is this a flow, architecture, sequence, or data model?
152. **Choose format** — Mermaid (default), PlantUML (complex), ASCII (inline), SVG (custom)
163. **Draft minimal version** — Core elements only, no decoration
174. **Iterate** — Add detail based on feedback
18
19## Diagram Types
20
21| Type | Use For | Format |
22|------|---------|--------|
23| Flowchart | Processes, decisions, workflows | Mermaid `flowchart` |
24| Sequence | API calls, interactions, protocols | Mermaid `sequenceDiagram` |
25| Architecture | System components, infrastructure | Mermaid `flowchart` or `C4` |
26| ER/Data model | Database schemas, relationships | Mermaid `erDiagram` |
27| Class | Object structure, inheritance | Mermaid `classDiagram` |
28| State | Lifecycles, status transitions | Mermaid `stateDiagram-v2` |
29| Timeline | Project phases, history | Mermaid `timeline` |
30| Mindmap | Brainstorming, concept mapping | Mermaid `mindmap` |
31
32## Output Methods
33
34| Method | When |
35|--------|------|
36| Mermaid code block | User can render (docs, GitHub, Notion) |
37| Render to PNG/SVG | User needs image file |
38| ASCII inline | Quick sketch in chat |
39| HTML + Mermaid.js | Interactive viewing |
40
41### Rendering Mermaid to Image
42
43```bash
44# Using mmdc (mermaid-cli)
45npx -y @mermaid-js/mermaid-cli mmdc -i diagram.mmd -o diagram.png -b transparent
46
47# Or via browser tool
48# Write HTML with Mermaid, screenshot the rendered diagram
49```
50
51## Mermaid Quick Reference
52
53**Flowchart:**
54```mermaid
55flowchart LR
56 A[Start] --> B{Decision}
57 B -->|Yes| C[Action]
58 B -->|No| D[End]
59```
60
61**Sequence:**
62```mermaid
63sequenceDiagram
64 User->>API: Request
65 API->>DB: Query
66 DB-->>API: Result
67 API-->>User: Response
68```
69
70**ER Diagram:**
71```mermaid
72erDiagram
73 USER ||--o{ ORDER : places
74 ORDER ||--|{ ITEM : contains
75```
76
77## Style Guidelines
78
79- **Left-to-right (LR)** for processes, **top-to-bottom (TB)** for hierarchies
80- **Max 10-15 nodes** per diagram, split if larger
81- **Consistent naming** — all caps for systems, lowercase for actions
82- **Subgraphs** to group related components
83- **Color sparingly** — highlight critical paths only
84
85## Common Requests
86
87| Request | Interpret As |
88|---------|--------------|
89| "Draw my API flow" | Sequence diagram: client → API → services |
90| "Show the architecture" | Flowchart with subgraphs for components |
91| "Database schema" | ER diagram with relationships |
92| "How the auth works" | Sequence or flowchart depending on complexity |
93| "User journey" | Flowchart with decision points |
94
95## Anti-Patterns
96
97- ❌ Too many nodes (split into multiple diagrams)
98- ❌ Decorative icons without meaning
99- ❌ Mixing abstraction levels (database tables next to business concepts)
100- ❌ Arrows in all directions (confuses flow)
101- ❌ Labels too long (use short names, add legend if needed)