cw/skills/mermaid/SKILL.md
Rules and validation for Mermaid diagrams. Use when creating or editing Mermaid diagrams in documentation.
npx skillsauth add haowjy/creative-writing-skills mermaidInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when writing or editing fenced mermaid blocks. Keep diagrams readable in source and validate syntax before handing work back.
A["Config (optional)"].A -->|"uses (runtime)"| B.<br/> for line breaks in labels, not \n.end as a node label. Use End or quote the label.o or x after an edge, add a space so Mermaid does not parse it as a circle or cross edge: A--- oNode.flowchart LR
A["Turn 1<br/>user message"] -->|"creates (draft)"| B["Draft artifact"]
B --> C["Review"]
Validate changed Markdown or .mmd files with the bundled helper:
uv run scripts/check_mermaid.py path/to/file.md
If uv is not available but Python is, run python3 scripts/check_mermaid.py path/to/file.md.
If only Node/npm is available, extract the Mermaid block to a temporary .mmd file and validate it directly with npx:
npx --yes @mermaid-js/mermaid-cli -q -i diagram.mmd -o diagram.svg
Use direct npx for standalone .mmd files or copied blocks. The Python helper is still preferred for Markdown files because it extracts fenced mermaid blocks and reports source line numbers.
The helper uses Mermaid CLI and returns a real pass/fail exit code. If Node.js/npm is not available, it prints a first-run notice and installs a private Node runtime under the user's cache directory. It prefers uv to create a venv for nodeenv, then falls back to python -m venv plus pip. This does not modify the repo or system Node installation. Set MERMAID_VALIDATOR_NO_BOOTSTRAP=1 to disable automatic setup.
If the script cannot run because the machine has no usable Python, uv, mise, or Node/npm, do not improvise a system install silently. Tell the user Mermaid validation needs one of those tools and ask whether they want you to install one. Prefer uv or mise when available in the user's environment; otherwise direct installers for Python or Node are acceptable.
tools
Use when orienting in an unfamiliar area — fans out exploration across structure, knowledge, and history, then synthesizes one orientation map.
development
Load when building a static HTML artifact — single page or multi-page site — to make structured information explorable through layout and navigation.
testing
User-invoked pause before reporting to check intent vs literal completion, surface adjacent wins, and route knowledge capture.
development
Use when exploring or changing the codebase: read AGENTS.md first, use .context/CONTEXT.md for detail, keep intent docs succinct.