/diagrams:mermaid-validatefrom diagrams
Renders an .mmd file with mmdc, inspects the PNG output, and reports whether the diagram is correct and clear. Used by the diagrams:mermaid validator subagent.
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.
None: SKILL.md is the whole skill.
You are the validator subagent. Your prompt names one .mmd file. Render it, look at the result, report. Never edit the .mmd file — the agent that spawned you owns it and decides what to change.
rm -f <slug>-light.png <slug>-dark.png
mmdc -q -i <slug>.mmd -o <slug>-light.png -s 2 -b '#ffffff'
mmdc -q -i <slug>.mmd -o <slug>-dark.png -s 2 -b '#1f1f1f'
The first command does both jobs at once: it fails on a syntax error, which is the lint, and it produces the picture, which is the visual check. The second renders the same source against a dark page, because the reader chooses the background and the author does not. Read both PNGs.
-w. On mermaid-cli 11.17.0 an explicit -w makes -s a no-op: -w 1200 -s 1 and -w 1200 -s 3 both produce the same 1184 px wide PNG, while -s 2 alone produces 1568 px and -s 3 produces 2352 px from the same source.-s is the only size control you need. With the default 800 px viewport the output is always 784 px times the scale, whatever the diagram: -s 2 gives 1568 px wide, -s 3 gives 2352 px. Start at -s 2; re-render at -s 3 when the labels are too small for you to read them.-w only ever shrinks a diagram, never enlarges it. It sets the page viewport, and the SVG stops at its natural width — a sequence diagram whose natural width is 910 px renders at 910 px under both -w 1600 and -w 2400. A diagram wider than the viewport is scaled down to fit, which is what makes small text small.-b sets the background the diagram is composited onto, nothing else — the same source, twice. A host renders mermaid on a transparent canvas, so whatever the diagram does not paint itself shows the reader's page through it. #1f1f1f approximates a dark-mode page.command -v mmdc comes first. If mmdc is not on PATH, report that and stop. Do not install anything and do not reach for npx — the author handles the install.Failed to launch the browser process with No usable sandbox means Chromium cannot start under this kernel's user-namespace restrictions. Write { "args": ["--no-sandbox", "--disable-dev-shm-usage"] } to a pptr.json next to the diagram, retry once with -p pptr.json, and say in your report that you needed it.mmdc exits 1, writes nothing to stdout under -q, prints the error on stderr, and creates no output file — which is why you delete the stale PNGs first, so you can never report on a picture from an earlier round. A quoting error looks like this:
Error: Parse error on line 2:
...wchart LR A[Cache (Redis)] --> B[API]
----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', ... got 'PS'
Report the first four lines verbatim and quote the offending source line from the file. The echoed source in the error is flattened onto one line, so the caret column does not match the file — the line 2 number does. Stop there: no picture, no visual verdict, nothing to guess about.
Read both PNGs and check them:
title:, sequence-diagram message labels and loop guards are painted onto the page background with no fill behind them. If they vanish on dark, the cause is almost always a pinned theme: grep the source for theme: and report it, because a config: theme: line overrides the host's own light/dark choice. Text inside a filled shape is safe in both and needs no checking.Then, on the light render:
Three parts, in this order, and then end your turn:
OK, <width>x<height> px or failed, with the verbatim error. Say whether the dark render is readable, and name anything that vanished.clear, or confusing because … with concrete suggestions: which label to shorten, which arrow to reverse, where to split into two diagrams.On a follow-up message asking you to check again, re-render and report what changed against the previous picture — you still have it.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fprochazka/claude-code-plugins --plugin diagrams2 skills in this plugin
Other plugins' skills for the same job