/zaksak:mermaid-diagramsfrom zaksak
Author or fix Mermaid diagrams that render correctly on GitHub. Use whenever writing, editing, or debugging a ```mermaid block — flowchart, sequence, state, ER, class, gantt — or when a diagram shows "Unable to render rich display" / a parse error. Encodes the exact escaping, quoting, ID, and block-balance rules that keep GitHub's strict renderer from failing.
Ships in zaksak. 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.
None: SKILL.md is the whole skill.
GitHub renders ```mermaid fenced blocks with a strict, sandboxed build (securityLevel: strict; JS/click disabled; HTML in labels sanitized). One syntax error fails the whole
block — it shows "Unable to render rich display." No partial render, no warning.
Golden rule: keep text plain and reword around special characters instead of escaping
them. The breakers are a small set — < > & ; [ ] { } ( ) — and rewording wins every time,
because escaping itself breaks some contexts (see below).
Every piece of text in a diagram is either quoted or bare, and they have opposite rules:
| Context | Where it appears | Rule for < > & |
|---|---|---|
| Quoted | inside "…" — id["…"], A -->|"…"| B, participant P as "…" | content is literal; you may entity-escape: < > & |
| Bare | sequence message after :, unquoted labels, alt/condition text | never entity-escape — reword to remove < > & instead |
Why bare text can't be escaped: ; is a statement separator in Mermaid, and every HTML
entity ends in ;. So escaping <id> → <id> in a sequence message makes the parser
split the line at each ; into invalid fragments → "Parse error … Expecting arrow, got
NEWLINE." In bare text write (id) or id — never <id>.
Fence + type line. Open with only ```mermaid, close with ```. The first content
line declares the type (flowchart TB, sequenceDiagram, stateDiagram-v2, erDiagram,
classDiagram, gantt); no blank line before it.
Quote every label that isn't a single plain word — id["…"] for nodes, A -->|"…"| B for
edge labels. Quoting neutralizes spaces, (), :, /, *, ., ,, '. Quote by default —
it's free.
Reword to avoid < > & ; in text. Placeholder → id or (id), not <id>;
conjunction → "and", not &; comparison → "ge"/"le" or the Unicode ≥/≤, not >=/<. A
literal ; in bare text always ends the statement — never write one. Only inside a
quoted label may you use </>/& (and only if rewording won't do); never
in sequence-message text.
No [ ] { } inside a label, even quoted — a bracket opens another shape and breaks the
lexer. Reword ("env overlay", not "env[...] overlay"); if truly needed, quoted labels only:
[ ] { }.
Parentheses break unquoted flowchart labels/edges — quote the label. (They're fine inside quotes and in sequence-message text.)
n["step (optional)"] ✅ A -->|"forward (all)"| B ❌ A -->|forward (all)| BIDs are [A-Za-z_][A-Za-z0-9_]* — letters, digits, underscore; no spaces, hyphens, dots, or
slashes. The pretty name goes in the label. Don't name a bare node end (it closes a
subgraph).
web_host["Web host"] ❌ web-host[...] ❌ web.host[...]Balance every block. Each subgraph/alt/opt/loop/par/critical needs an end;
else lives inside an alt. Balance quotes and brackets too.
Line break inside a label is <br/> — never a real newline.
| Construct | Fix |
|---|---|
X->>Y: build <id> — entity in a sequence message (the ; splits the line) | reword: X->>Y: build (id) |
n["a env[...] b"] — brackets inside a label | reword: n["a env-overlay b"] |
A -->|step (x)| B — parens in an unquoted edge label | A -->|"step (x)"| B |
n[build <id>] — raw <…> dropped as HTML in a flowchart label | quote + entity: n["build <id>"] |
subgraph my-group[...] — hyphen in an ID | subgraph my_group["…"] |
node named end collapses a subgraph | rename (done/End) or quote ["end"] |
| blank / "Unable to render" with no obvious cause | check subgraph/alt ↔ end balance and stray " |
flowchart — declare a direction (TB/LR/TD/RL/BT). Shapes: id["rect"],
id(["stadium"]), id[("database")], id{"rhombus"} — the label inside still obeys rules 3–5.
A & B --> C node lists are valid (escape any & in a label). subgraph id["Title"] … end; an
edge may target a subgraph by its id; inside one you can set direction LR.
sequenceDiagram — message text after the first : is bare (rule 3 and the ; warning bite
hardest here); a : within the message is fine. Quote a participant alias that has special
chars: participant P as "Pretty (name)". Balance alt/else/end, opt/end, loop/end,
par/and/end.
stateDiagram-v2 / erDiagram / classDiagram / gantt — rules 3 (reword/escape) and 7 (balance)
still apply. classDiagram generics are ~T~ (e.g. List~int~), not <T>. erDiagram
entity names obey rule 6 (no hyphens).
Read the block top-to-bottom and confirm each box:
```mermaid + a valid type on line 1; closes with ```.alt/conditions) has no <, >, &, or ; — reworded, not entity-escaped.< > &) appear only inside "quoted" labels, if at all.[ ] { } inside any label; parentheses appear only inside quotes or sequence messages."quoted"; every special-char edge label is |"…"|.[A-Za-z_][A-Za-z0-9_]* (no - . space); no node is bare end.subgraph/alt/opt/loop/par has a matching end; all quotes and brackets balanced.What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/ascii-uiGenerate consistent, pixel-perfect ASCII UI wireframe mockups for specs and PRDs. Use when the user asks to draw a wireframe, mockup, UI diagram, or ASCII layout. Also use when fixing alignment in existing ASCII diagrams./writing-claude-mdGuidelines for writing effective CLAUDE.md files and .claude/rules/ — invoke when creating or editing CLAUDE.md or rule filesOther plugins' skills for the same job
npx claudepluginhub zakattack9/agentic-coding --plugin zaksak