agentleFS
base58edbase58ed/claude_code_files/skills/mermaid-skill/SKILL.md

mermaid-skill

Skill1 starsChanged 3 months agoMITView on GitHub

Mermaid diagram authoring patterns that actually render across GitHub, Mermaid Live, mermaid-js in IDEs, and embedded renderers. Load this skill whenever the user asks to create, modify, or debug a mermaid diagram of any kind (sequence, flowchart, class, state, gantt, ER, gitGraph), whether the diagram lives inside a markdown file as a fenced mermaid code block or as a standalone .mmd file. Trigger generously on mentions of mermaid, sequence diagram, flowchart, architecture diagram, system diagram, state diagram, class diagram, or any diagram-as-code request even when the user does not say the word "mermaid" by name.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Yassimba/loom★ 9same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository18 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 4 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a feature outside the conservative subset is tempting, probe the engine first: render a fenced mermaid block containing only

    line 16
  2. Very specific:

    Standalone .mmd / .mermaid file: no fence — the file starts directly with the diagram type.

    line 33
  3. Distinctive:

    Every rule below applies to both.

    line 37
  4. Very specific:

    Use commas or - instead. If a literal semicolon is required in the text, use the entity escape #59;.

    line 80
  5. Very specific:

    Default to - or / as a separator, or split into two participants.

    line 95
  6. Very specific:

    Arrows: search the block for →, ⇄, ↔, ⇒, ←.

    line 193
  7. Very specific:

    Sequence arrows: search for --), -), -(, --(.

    line 195
  8. Very specific:

    Semicolons: search for ; in Note lines and in message text (after a :).

    line 197
  9. Very specific:

    <br/> in sequence participants: search for participant .* as .*<br/>.

    line 199
  10. Distinctive:

    Reserved ids: search for participant / node ids matching (case-insensitive in sequence diagrams.

    line 202
  11. Very specific:

    Unquoted special chars in labels: search for [ ... ( ... ] patterns and [ ...

    line 210
  12. Distinctive:

    If any check fails, fix before emitting the block.

    line 214

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Authoring Mermaid diagrams that actually render

Mermaid's parser is strict, line-oriented, and not standardized across renderers — GitHub, Mermaid Live, and the mermaid-js versions embedded in various IDEs all differ. The rules below are the conservative subset that renders everywhere. Follow them by default; only deviate when you've verified the target renderer supports a feature.

Verifying the target renderer

When a feature outside the conservative subset is tempting, probe the engine first: render a fenced mermaid block containing only

info

It prints the engine's mermaid version (works on GitHub and Mermaid Live). Interactive features (click links / callbacks) never run in static or sandboxed renderers such as GitHub, regardless of version.

Where the diagram lives

Two wrappers, identical syntax inside:

  • Inside markdown (READMEs, ADRs — the common case): a triple-backtick fence tagged mermaid.
  • Standalone .mmd / .mermaid file: no fence — the file starts directly with the diagram type. Use when the diagram deserves its own file or you'll render it to SVG/PNG via the mmdc CLI and embed it as an image.

Every rule below applies to both.

Hard rules — apply unconditionally

R1. Use only ASCII arrows. Never put unicode arrows in messages or labels.

Some renderers tokenize →, ⇄, ↔, ⇒, ← as arrow operators even inside message text or node labels, which corrupts parsing of the surrounding line.

❌ Bad✅ Good
A->>B: speech → STT → transcriptA->>B: speech to STT to transcript
Note over X,Y: aiortc ⇄ browserNote over X,Y: aiortc to/from browser
participant P as STT → LLM → TTSparticipant P as STT - LLM - TTS

R2. In sequenceDiagram, use only these arrow forms.

FormMeaning
->>solid arrow (sync call)
-->>dashed arrow (reply / async return)
-x / --xwith cross (lost message)
-> / -->plain line (rarely needed)

Avoid by default --), -), -(, --(. These "async open-arrow" forms are rejected only by renderers embedding mermaid <= 8.x (2020-era), with errors like Expecting 'SOLID_OPEN_ARROW'...; all mainstream 2026 renderers (GitHub, Mermaid Live, current IDEs) accept them. When targeting unknown or legacy embedded renderers, replace every --) with -->> (same semantics: dashed async reply).

R3. Never put ; in message text or Note text.

In sequence diagrams, semicolon ends the statement. Everything after it is parsed as a new statement and explodes with Expecting <signal type> or ID, got ';' or Expecting NEWLINE.

❌ Bad✅ Good
Note over A,B: WebRTC up; greeting; bot-readyNote over A,B: WebRTC up, greeting, bot-ready
A->>B: trickle ICE; redundant; non-fatalA->>B: trickle ICE, redundant, non-fatal

Use commas or - instead. If a literal semicolon is required in the text, use the entity escape #59;.

R4. Default to - separators in participant ... as aliases; use <br/> only on verified renderers.

Current mermaid (11.x) supports <br/> line breaks in participant aliases — the official docs document participant Alice as Alice<br/>Johnson as the line-break mechanism for actor names, and it renders as a real two-line label. But some older embedded renderers abort alias parsing on it, and the next token (often a comma in a later Note over A,B) becomes "unexpected."

Conservative (renders everywhere)Mermaid 11.x, verified renderer only
participant HND as offer.py (ours) - Handler (kit)participant HND as offer.py (ours)<br/>Handler (kit)

Default to - or / as a separator, or split into two participants; use <br/> only after confirming the target renderer (see the info probe above). <br/> in flowchart / graph node labels (A[Line 1<br/>Line 2]) is safe everywhere.

R5. Avoid reserved / ambiguous identifiers for participants and nodes.

Mermaid reserves keywords used by its own syntax. The biggest landmine in sequence diagrams: off (used by autonumber off). Sequence-diagram lexing is case-insensitive, so OFF, End, and Box all collide there. Flowcharts are the opposite — ids are case-SENSITIVE: End renders fine while lowercase end is a parse error, and capitalizing end is mermaid's own documented workaround for the flowchart end-keyword collision.

❌ Bad✅ Good
participant OFF as ...participant OFFER as ...
participant END as ...participant FINISH as ...
participant LINK as ... (some renderers)participant CONN as ...

Other words to avoid as IDs: end, class, click, link, note, loop, alt, else, opt, par, and, rect, activate, deactivate, participant, actor, as, over, on, off, default, direction, subgraph, box, critical, break, create, destroy, links, properties, details.

Flowchart edge-decoration gotcha: a node id starting with lowercase o or x directly after an edge is parsed as a circle/cross edge decoration — A---oB silently becomes an o-decorated edge to B. Capitalize or add a space: A---OB or A--- oB.

R6. Style subgraphs with a class statement or style — never the inline ::: shorthand.

class subgraphId styleName works in current mermaid (the class lands on the subgraph's cluster element), and style subgraphId fill:#... works everywhere. The inline shorthand on a subgraph declaration — subgraph id:::styleName — is a parse error. Old embedded renderers (mermaid <= 8.7, bug mermaid-js#1726, fixed Oct 2020) rendered fine but silently dropped the class on subgraphs, so style subgraphId ... remains the safest cross-renderer choice.

❌ Bad✅ Good
subgraph core:::rustclass core rust or style core fill:#f8d7a0

R7. Quote node labels that contain special characters.

In flowchart / graph, wrap labels in double quotes whenever the label contains (, ), {, }, :, ,, /, &, |, <, >, #, or pipe characters.

GOOD:  API["Chat SSE: POST /api/v1/chat/{conv_id}"]
BAD:   API[Chat SSE: POST /api/v1/chat/{conv_id}]

R8. Edge labels with special characters must be quoted.

GOOD:  A -->|"HTTP chat SSE"| B
BAD:   A -->|HTTP chat (SSE)| B

R9. Don't mix link styles into one chain you also try to label individually.

A --> B --> C is fine, but if any link needs a label, write the labeled link on its own line:

A --> B
B -->|"with label"| C

Soft rules — apply by default, relax only when needed

S1. Prefer ASCII punctuation in message text.

Em dashes (—) and curly quotes usually render, but some embedded renderers strip or misinterpret them. When in doubt, use - and straight quotes.

S2. Keep one statement per line. No trailing semicolons.

Even where Mermaid allows ; as a separator, omitting it removes a whole class of bugs.

S3. Keep participant / node ids short and ALL_CAPS or PascalCase.

Short ids are less likely to collide with reserved words and keep diffs readable. Put the long human-readable name in the as alias.

S4. For sequence diagrams, declare every participant explicitly with participant.

Auto-declaration (first appearance) sometimes orders participants unexpectedly and makes reserved-word collisions harder to diagnose.

Pre-flight checklist (run mentally before emitting any Mermaid block)

  1. Arrows: search the block for →, ⇄, ↔, ⇒, ←. Replace with ASCII (to, to/from, etc.).
  2. Sequence arrows: search for --), -), -(, --(. Replace --) with -->>.
  3. Semicolons: search for ; in Note lines and in message text (after a :). Replace with , or -.
  4. <br/> in sequence participants: search for participant .* as .*<br/>. Replace with - unless the target renderer is verified mermaid 11.x (R4).
  5. Reserved ids: search for participant / node ids matching (case-insensitive in sequence diagrams; flowchart ids are case-sensitive) off|end|class|note|loop|link|on|as|over|alt|else|opt|par|and|rect|activate|deactivate|default|direction|subgraph|box|critical|break|create|destroy|links|properties|details. Rename. Also in flowcharts: search for edges directly followed by an id starting with lowercase o/x (e.g. ---oB); capitalize or add a space.
  6. Subgraph styling: in flowchart / graph, no inline ::: on a subgraph declaration — use class subgraphId name on its own line, or style subgraphId fill:#... (safest cross-renderer).
  7. Unquoted special chars in labels: search for [ ... ( ... ] patterns and [ ... : ... ]. Quote those labels: X["..."].
  8. Edge labels with special chars: quote -->|"..."|.

If any check fails, fix before emitting the block.

Error message → fix table (for debugging an existing diagram)

Renderer errorMost likely causeFix
<signal type> or ID expected, got ','Older embedded renderer choked on <br/> in a participant ... as alias upstreamReplace <br/> with - (mermaid 11.x supports it; legacy renderers do not)
Expecting '+', '-', 'ACTOR', got 'off' (or another lowercase word)Participant id is a reserved word (OFF, END, ...)Rename id
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', ..., got ',' or got 'NEWLINE'A previous line had ; in a Note / message and the parser is mid-statement on the next lineReplace ; with ,
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', ... after a line with --)Renderer embeds mermaid <= 8.x and rejects --) async arrowsReplace --) with -->>
Parse error on a subgraph line containing :::Inline :::styleName shorthand applied to a subgraph declarationUse class subgraphId name on its own line, or style subgraphId ...
Parse error ... got 'PS' / got 'PE' in a flowchartUnquoted parentheses inside a node labelQuote the label: X["..."]

Canonical safe templates

Drop one of these in and edit; they all pass the pre-flight checklist by construction.

Sequence diagram

sequenceDiagram
    autonumber
    participant UI as Browser UI
    participant SRV as Server
    participant DB as Database

    UI->>SRV: POST /login (credentials)
    SRV->>DB: SELECT user
    DB-->>SRV: row
    SRV-->>UI: 200 OK, JWT
    Note over UI,SRV: session established, JWT in cookie

Flowchart with subgraphs + styling

flowchart TB
    subgraph client["Client"]
        UI["Browser UI"]
    end

    subgraph server["Server (Rust)"]
        API["POST /api/v1/x"]
        SVC["Service layer"]
    end

    UI -->|"HTTPS"| API
    API --> SVC

    classDef rust fill:#f8d7a0,stroke:#c47f17
    class API,SVC rust
    style server fill:#fff7e6,stroke:#c47f17

State diagram

stateDiagram-v2
    [*] --> Idle
    Idle --> Active: start
    Active --> Idle: end_turn
    Active --> Cancelling: barge_in
    Cancelling --> Idle: drained
    Active --> PermissionPending: tool needs auth
    PermissionPending --> Active: decided

Class diagram

classDiagram
    class Order {
        +UUID id
        +Money total
        +place()
        +cancel()
    }
    class Item {
        +UUID sku
        +int quantity
    }
    Order "1" *-- "many" Item

A note on other diagram types

Mermaid also supports erDiagram, gantt, gitGraph, journey, pie, mindmap, timeline, quadrantChart, sankey, xychart, architecture-beta, block, kanban, packet, radar, and treemap. The rules above (no unicode arrows, no ; in text, quote special-char labels, avoid reserved ids) apply uniformly. For type-specific syntax see the Mermaid docs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.