From mermaid
Validates Mermaid syntax in Markdown files or directories. Extracts diagrams from code blocks, checks validity with Node.js, and reports pass/fail summaries per file.
npx claudepluginhub diegomarino/claude-toolshed --plugin mermaidThis skill is limited to using the following tools:
User request: "$ARGUMENTS"
Validates and repairs Mermaid diagrams in markdown files by scanning code blocks, validating syntax, and auto-fixing common errors. Useful for documentation with broken diagrams.
Validates D2 syntax in .d2 files, directories, or .md files with D2 code blocks. Extracts blocks from Markdown, runs d2 validate, and reports per-file/block pass/fail with errors.
Enforces syntax rules for Mermaid diagrams in documentation: quote labels with special chars, avoid <br/> and hardcoded colors, use themes. Validates via check-mermaid.sh.
Share bugs, ideas, or general feedback.
User request: "$ARGUMENTS"
Check Mermaid syntax for all diagrams found in a given file or directory.
Resolve Plugin Path: Run once before executing any scripts:
find "$HOME/.claude/plugins/cache" -type d -name "mermaid" -path "*/skills/mermaid" 2>/dev/null | head -1
If empty, run fallback (for dev/repo usage):
find "$HOME" -maxdepth 8 -type d -name "mermaid" -path "*/skills/mermaid" 2>/dev/null | head -1
Use the returned path as PLUGIN_DIR in all steps below.
Ensure Dependencies:
bash "$PLUGIN_DIR/scripts/ensure-deps.sh"
If .claude/mermaid.json does not exist, display a one-time nudge before continuing:
First time using the mermaid plugin? Run
/mermaid-configto pick a theme and output settings. Using defaults for now (zinc-light,./diagrams).
Resolve Target Path:
.md files containing Mermaid blocks.Optional Config:
.claude/mermaid.json exists, read defaults:
output_directory (default: ./diagrams)Resolve output path:
output_directory is "same" AND an input file path is known:
OUTPUT_DIR=$(dirname {input_file}) (for a directory argument, use the directory itself)output_directory is "same" AND no argument was provided:
OUTPUT_DIR=./diagramsOUTPUT_DIR={output_directory}Validate:
node "$PLUGIN_DIR/scripts/extract_mermaid.js" <file> --validateReport:
$PLUGIN_DIR/references/guides/troubleshooting.md.$PLUGIN_DIR/references/guides/troubleshooting.md