/diagrams:mermaidfrom diagrams
Author Mermaid diagrams for GitHub-rendered markdown and technical docs - architecture flowcharts, sequence diagrams for auth and API flows, entity-relationship diagrams for database design, state diagrams, and class diagrams. Use whenever adding a diagram to a README, repo doc, PR description, or any markdown that GitHub renders, or when the user says mermaid, flowchart, sequence diagram, ERD, or state diagram. Enforces the house rule that node labels must contain no parentheses or special characters, and covers light/dark theming and local rendering to SVG/PNG via mermaid-cli.
Ships in diagrams. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Mermaid is the workhorse for repo documentation: it renders natively on GitHub, lives in the markdown itself, and diffs like code. Default to Mermaid for any diagram destined for a .md file.
No parentheses or special characters in node labels — they break rendering.
This is a standing rule, not a suggestion. (, ), and other special characters ({, }, [, ], #, ;, ", <, >, &) inside node labels cause silent or hard rendering failures depending on the renderer version. Rewrite the label instead:
flowchart LR
A[API Gateway] --> B[Auth Service JWT]
B[Auth Service (JWT)]B[Auth Service JWT] or B[Auth Service - JWT]Structural diagrams only. Data charts → the dataviz skill (do not use Mermaid pie/xychart for real data viz). Provider-icon cloud architecture → the diagrams skill. Tool selection guide → the diagrams skill.
| Type | Use for | Opening line |
|---|---|---|
| Flowchart | Architecture, data flow, decision logic | flowchart TD or flowchart LR |
| Sequence | Auth flows, API call chains, message passing | sequenceDiagram |
| ER diagram | Database schema design | erDiagram |
| State | Lifecycles, status machines | stateDiagram-v2 |
| Class | Object models, module structure | classDiagram |
flowchart TD
Client[Client App] --> GW[API Gateway]
GW --> Auth[Auth Service]
GW --> API[Core API]
API --> DB[(Postgres)]
subgraph Azure Platform
GW
Auth
API
DB
end
TD top-down for hierarchies; LR left-right for pipelines and flows.[box], (rounded), {diamond decision}, [(database)], ((circle)).--> arrow, --- line, -. dashed .->, == thick ==>, -->|label|.subgraph Name ... end; subgraph titles obey the house rule too.sequenceDiagram
participant U as User
participant App as Web App
participant IdP as Identity Provider
participant API as Backend API
U->>App: Sign in
App->>IdP: Redirect - authorize request
IdP-->>App: Auth code
App->>IdP: Exchange code for tokens
IdP-->>App: ID token + access token
App->>API: Request with bearer token
API-->>U: Protected resource
->> solid arrow (request), -->> dashed (response), -) async.activate/deactivate or +/- suffixes show lifelines; Note over A,B: text annotates.alt/else/end for branches, loop ... end for retries.erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER_LINE : contains
PRODUCT ||--o{ ORDER_LINE : appears_in
CUSTOMER {
uuid id PK
string email
datetime created_at
}
ORDER {
uuid id PK
uuid customer_id FK
string status
}
Cardinality: || exactly one, o| zero or one, }o zero or more, }| one or more. Left symbol pair = left entity's side.
stateDiagram-v2
[*] --> Draft
Draft --> InReview : submit
InReview --> Approved : approve
InReview --> Draft : request_changes
Approved --> Published : publish
Published --> [*]
GitHub renders Mermaid with the viewer's theme automatically — don't hardcode colors unless necessary, and never assume a white page background.
%%{init: {"theme": "neutral"}}%%
neutral is the safest single theme (readable on both light and dark). default, dark, forest, base also exist; base + themeVariables for fine control.style N fill:#fff one-offs — hardcoded light fills go invisible on dark GitHub. If you must color, pick mid-tone fills with dark text (see the light/dark guidance in the diagrams skill).GitHub needs no rendering step. For decks and standalone artifacts, render with the bundled script (resolve scripts/render.sh beside this file; no global install needed):
scripts/render.sh arch.mmd diagrams/01-arch.svg
scripts/render.sh arch.mmd diagrams/01-arch.png -s 2 -b white
mermaid-cli ships no headless browser, and without one every render fails with Error: Could not find chrome-headless-shell (ver. <version>) (example version, it varies); the script resolves mermaid-cli once through npx (offline-first), runs the one-time browser download into the puppeteer cache from that same install, then renders. Call mermaid-cli directly only after that.
-s 2 scale factor keeps PNG crisp for slides; -b white avoids transparent-background surprises.diagrams skill (numbered files in the artifact's diagrams/ folder).| Symptom | Cause | Fix |
|---|---|---|
| Diagram silently blank on GitHub | Special character in a label | Apply the house rule — strip () and friends |
Syntax error in text | Reserved word as bare node id — end, class, or any other Mermaid keyword | Give it a distinct id and put the reserved word in the label instead (see "Reserved words as node ids" below) |
| Edge label breaks parse | ` | ` label containing special chars |
| Renders in IDE, not on GitHub | Newer syntax than GitHub's Mermaid version | Stick to the core types above; avoid bleeding-edge features |
| Subgraph arrows ignored | Edge declared inside wrong subgraph scope | Declare nodes in subgraphs, edges at top level |
| Unreadable on dark mode | Hardcoded light fills | Remove styles or use theme: neutral |
Mermaid reserves words like end, class, subgraph, state, and click for its own grammar; a bare node id matching one breaks the parser. The rule is easy to lose exactly when it matters: if the user's own domain vocabulary supplies a stage, entity, or state called end or class, the instinct is to use that name verbatim as the id — that instinct is the trap, not an exception to the rule.
Give the node its own id and keep the domain term as the label:
load --> endload --> fin[end]fin is an arbitrary id; [end] keeps the real stage name visible in the rendered diagram. The same pattern applies to any other keyword: class becomes cls[class], state becomes st[state].
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub hsb3/dotfiles-agents --plugin diagrams4 skills in this plugin
/diagramsCreate technical architecture diagrams using Python's diagrams library (mingrammer/diagrams) or raw Graphviz dot. Use when users need to create cloud architecture diagrams with provider icons (Azure, GCP, AWS, Kubernetes, on-prem), system design diagrams, infrastructure visualizations, data flow diagrams, dependency graphs, org or process trees, or any structural diagram showing relationships between components. Also the hub for choosing the right diagram tool (Python diagrams vs Mermaid vs draw.io vs Excalidraw) and for the SVG plus PNG output pipeline that feeds GitHub markdown, PowerPoint decks and exec briefings, and standalone architecture docs. Includes iterative review loop and custom Graphviz attributes for professional formatting. Self-improving - accumulates learnings in memory file to avoid repeating mistakes. Structural diagrams only - data charts and plots belong to the dataviz skill, deck theming to presentations./drawioRead, convert, and export draw.io / diagrams.net files. Use when the user has legacy .drawio or .drawio.png/.drawio.svg files to inspect, extract content from, convert to Mermaid or another format, or export headlessly to PNG/SVG from the command line - or asks about drawio, diagrams.net, or mxGraph XML. Covers the compressed and uncompressed XML formats, a Python decompression recipe, and the desktop app's CLI export flags./excalidrawCreate sketch-style, hand-drawn-look architecture diagrams as Excalidraw files. Use when the user asks for an excalidraw diagram, a whiteboard-style or sketchy diagram, or wants a .excalidraw file created or edited. Works with or without the Excalidraw MCP tools - when the MCP tools are unavailable, author the .excalidraw JSON scene directly. Covers the scene JSON schema, element and arrow-binding essentials, an offline headless render-and-lint loop that screenshots a scene and names its defects, and export to SVG/PNG.Other plugins' skills for the same job