Update Flowchart
When to use this skill
Use this skill when creating a new Mermaid flowchart or updating an existing one. This covers syntax for nodes, shapes, links, subgraphs, and styling.
Instructions
- Start with
flowchart: Every flowchart must start with this keyword followed by the direction.flowchart TD(Top-Down)flowchart LR(Left-Right)flowchart BT(Bottom-Top)flowchart RL(Right-Left)
- Define Nodes:
- Metadata Syntax:
id@{ shape: <shape-name>, label: "label text" } - Common Shapes:
rect: Rectangle (default)rounded: Rounded Rectanglestadium: Stadiumsubroutine: Subroutinecyl: Cylinder (Database)circ: Circledbl-circ: Double Circlediam: Diamond (Decision)hex: Hexagonlean-r/lean-l: Parallelogram (Lean Right/Left)trap-b/trap-t: Trapezoid (Base Bottom/Top)odd: Odd Shapeevent: Eventproc: Processdoc: Documentmanual-input: Manual Inputmanual-file: Manual Filecard: Cardstored-data: Stored Data
- Note: Legacy syntax (e.g.,
id[text]) is still supported but metadata syntax is preferred for newer features.
- Metadata Syntax:
- Define Links:
- Solid:
A --> B - Dotted:
A -.-> B - Thick:
A ==> B - Open:
A --- B - With text:
A -->|text| BA -- text --> BA -. text .-> BA == text ==> B
- Solid:
- Special Characters:
- Use quotes for text with special characters:
id["Text with (special) chars"] - For multi-line labels, use
<br/>instead of\n:id["Line 1<br/>Line 2"]
- Use quotes for text with special characters:
- Subgraphs:
subgraph Title direction TB A --> B end - Styling:
style id fill:#f9f,stroke:#333,stroke-width:4pxclassDef className fill:#f9f,stroke:#333class id className
Example
flowchart LR
A@{ shape: rect, label: "Start" } --> B@{ shape: diam, label: "Is it working?" }
B -- Yes --> C@{ shape: rect, label: "Great!" }
B -- No --> D@{ shape: rect, label: "Debug" }
D --> B
subgraph SubSystem
direction TB
E@{ shape: cyl, label: "Database" } <--> F@{ shape: rounded, label: "API" }
end
C --> F