---
name: mermaid-design
description: Generate and standardize Mermaid diagrams with deterministic token-based theming from the repository root mermaid.tokens.json.
Mermaid Design
Use one token source (mermaid.tokens.json at repo root) for all Mermaid outputs.
Supported diagrams
graph
flowchart
sequenceDiagram
classDiagram
stateDiagram
stateDiagram-v2
erDiagram
journey
gantt
pie
mindmap
timeline
gitGraph
quadrantChart
requirementDiagram
kanban
Mandatory preflight
- Resolve repository root.
- Ensure root
mermaid.tokens.json exists.
- If missing, create it using the default token JSON from this file.
- Load
theme and themeVariables before producing Mermaid output.
Root token contract
- Path is always root
mermaid.tokens.json.
- Root file is the source of truth for theme values.
- Every diagram output must include a Mermaid init block using root values.
- If user requests style changes, update root
mermaid.tokens.json first, then generate diagrams.
Default root tokens (create when missing)
{
"theme": "base",
"themeVariables": {
"darkMode": false,
"background": "#f4f4f4",
"fontFamily": "trebuchet ms, verdana, arial",
"fontSize": "16px",
"primaryColor": "#fff4dd",
"primaryTextColor": "#2f2f2f",
"primaryBorderColor": "#e7bf67",
"secondaryColor": "#dff4ff",
"secondaryTextColor": "#17324d",
"secondaryBorderColor": "#83c9ee",
"tertiaryColor": "#e6ffe0",
"tertiaryTextColor": "#1e4026",
"tertiaryBorderColor": "#93cc86",
"lineColor": "#6f7f8a",
"textColor": "#263746",
"noteBkgColor": "#fff5ad",
"noteTextColor": "#333333",
"noteBorderColor": "#d7c25b",
"actorBkg": "#fff4dd",
"actorBorder": "#e7bf67",
"actorTextColor": "#2f2f2f",
"signalColor": "#31424f",
"signalTextColor": "#31424f",
"activationBkgColor": "#dff4ff",
"activationBorderColor": "#83c9ee",
"pie1": "#fff4dd",
"pie2": "#dff4ff",
"pie3": "#e6ffe0",
"pie4": "#ffd9c2",
"pie5": "#d9e7ff",
"pie6": "#f9e1ff",
"pieStrokeColor": "#2f2f2f",
"pieStrokeWidth": "2px"
}
}
Workflow
- Run preflight.
- Read root token file.
- Emit one init block in this shape:
%%{init: {"theme":"<theme>","themeVariables":{...}}}%%
- Generate requested supported diagram.
- Avoid one-off inline style overrides unless explicitly requested.
Failure handling
- If root token file is unreadable or invalid JSON, replace with default tokens and continue.
- If the requested diagram type is unsupported, list supported types and stop.
1---2name: mermaid-design3description: description: Generate and standardize Mermaid diagrams with deterministic token-based theming from the repository root mermaid.tokens.json.4---5
6---
7name: mermaid-design
8description: Generate and standardize Mermaid diagrams with deterministic token-based theming from the repository root `mermaid.tokens.json`.
9---
10
11# Mermaid Design
12
13Use one token source (`mermaid.tokens.json` at repo root) for all Mermaid outputs.
14
15## Supported diagrams
16
17- `graph`
18- `flowchart`
19- `sequenceDiagram`
20- `classDiagram`
21- `stateDiagram`
22- `stateDiagram-v2`
23- `erDiagram`
24- `journey`
25- `gantt`
26- `pie`
27- `mindmap`
28- `timeline`
29- `gitGraph`
30- `quadrantChart`
31- `requirementDiagram`
32- `kanban`
33
34## Mandatory preflight
35
361. Resolve repository root.
372. Ensure root `mermaid.tokens.json` exists.
383. If missing, create it using the default token JSON from this file.
394. Load `theme` and `themeVariables` before producing Mermaid output.
40
41## Root token contract
42
43- Path is always root `mermaid.tokens.json`.
44- Root file is the source of truth for theme values.
45- Every diagram output must include a Mermaid init block using root values.
46- If user requests style changes, update root `mermaid.tokens.json` first, then generate diagrams.
47
48## Default root tokens (create when missing)
49
50```json
51{
52 "theme": "base",
53 "themeVariables": {
54 "darkMode": false,
55 "background": "#f4f4f4",
56 "fontFamily": "trebuchet ms, verdana, arial",
57 "fontSize": "16px",
58 "primaryColor": "#fff4dd",
59 "primaryTextColor": "#2f2f2f",
60 "primaryBorderColor": "#e7bf67",
61 "secondaryColor": "#dff4ff",
62 "secondaryTextColor": "#17324d",
63 "secondaryBorderColor": "#83c9ee",
64 "tertiaryColor": "#e6ffe0",
65 "tertiaryTextColor": "#1e4026",
66 "tertiaryBorderColor": "#93cc86",
67 "lineColor": "#6f7f8a",
68 "textColor": "#263746",
69 "noteBkgColor": "#fff5ad",
70 "noteTextColor": "#333333",
71 "noteBorderColor": "#d7c25b",
72 "actorBkg": "#fff4dd",
73 "actorBorder": "#e7bf67",
74 "actorTextColor": "#2f2f2f",
75 "signalColor": "#31424f",
76 "signalTextColor": "#31424f",
77 "activationBkgColor": "#dff4ff",
78 "activationBorderColor": "#83c9ee",
79 "pie1": "#fff4dd",
80 "pie2": "#dff4ff",
81 "pie3": "#e6ffe0",
82 "pie4": "#ffd9c2",
83 "pie5": "#d9e7ff",
84 "pie6": "#f9e1ff",
85 "pieStrokeColor": "#2f2f2f",
86 "pieStrokeWidth": "2px"
87 }
88}
89```
90
91## Workflow
92
931. Run preflight.
942. Read root token file.
953. Emit one init block in this shape:
96 - `%%{init: {"theme":"<theme>","themeVariables":{...}}}%%`
974. Generate requested supported diagram.
985. Avoid one-off inline style overrides unless explicitly requested.
99
100## Failure handling
101
102- If root token file is unreadable or invalid JSON, replace with default tokens and continue.
103- If the requested diagram type is unsupported, list supported types and stop.