Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Extracts Mermaid diagrams from markdown files and generates high-quality PNG images using bundled scripts. Activates when working with Mermaid diagrams, converting diagrams to PNG, extracting diagrams from markdown, or processing markdown files with embedded Mermaid code.
.claude/skills/nicepkg-mermaid-tools/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 66% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -36% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 66% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -26% | 0% |
This skill enables extraction of Mermaid diagrams from markdown files and generation of high-quality PNG images. The skill bundles all necessary scripts (extract-and-generate.sh, extract_diagrams.py, and puppeteer-config.json) in the scripts/ directory for portability and reliability.
Extract Mermaid diagrams from a markdown file and generate PNG images using the bundled extract-and-generate.sh script:
bashcd ~/.claude/skills/mermaid-tools/scripts ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Parameters:
<markdown_file>: Path to the markdown file containing Mermaid diagrams<output_directory>: (Optional) Directory for output files. Defaults to <markdown_file_directory>/diagramsExample:
bashcd ~/.claude/skills/mermaid-tools/scripts ./extract-and-generate.sh "/path/to/document.md" "/path/to/output"
.mmd files for each diagramFor each diagram, the script generates:
01-diagram-name.mmd - Extracted Mermaid code01-diagram-name.png - High-resolution PNG imageThe numbering ensures diagrams maintain their order from the source document.
Override default dimensions using environment variables:
bashcd ~/.claude/skills/mermaid-tools/scripts MERMAID_WIDTH=1600 MERMAID_HEIGHT=1200 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Available variables:
MERMAID_WIDTH (default: 1200) - Base width in pixelsMERMAID_HEIGHT (default: 800) - Base height in pixelsMERMAID_SCALE (default: 2) - Scale factor for high-resolution outputbashcd ~/.claude/skills/mermaid-tools/scripts MERMAID_WIDTH=2400 MERMAID_HEIGHT=1800 MERMAID_SCALE=4 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
bashcd ~/.claude/skills/mermaid-tools/scripts MERMAID_SCALE=5 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
The script automatically adjusts dimensions based on diagram type (detected from filename):
Context-aware naming in the extraction process helps trigger appropriate smart sizing.
CRITICAL: Use the bundled extract-and-generate.sh script from this skill's scripts/ directory. All necessary dependencies are bundled together.
Run the script from its own directory to properly locate dependencies (extract_diagrams.py and puppeteer-config.json):
bashcd ~/.claude/skills/mermaid-tools/scripts ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Running the script without changing to the scripts directory first may fail due to missing dependencies.
Before running the script, verify dependencies are installed:
mmdc --versiongoogle-chrome-stable --versionpython3 --versionIf any are missing, consult references/setup_and_troubleshooting.md for installation instructions.
For detailed troubleshooting guidance, refer to references/setup_and_troubleshooting.md, which covers:
Quick fixes for common issues:
Permission denied:
bashchmod +x ~/.claude/skills/mermaid-tools/scripts/extract-and-generate.sh
Low quality output:
bashMERMAID_SCALE=3 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Chrome/Puppeteer errors: Verify all WSL2 dependencies are installed (see references for full list).
This skill bundles all necessary scripts for Mermaid diagram generation:
All scripts must be run from the scripts/ directory to properly locate dependencies.
Comprehensive reference documentation including:
Load this reference when dealing with setup issues, installation problems, or advanced customization needs.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-04 | fail→pass | 15,833 | 4,442 | -72% | 1 | 1 | 0% | 2,780 | 2,076 | -25% | 0 | 0 | — |
case-05 | fail→pass | 6,554 | 1,880 | -71% | 1 | 1 | 0% | 968 | 1,607 | +66% | 0 | 0 | — |
case-01 | fail→fail | 4,017 | 10,821 | +169% | 1 | 1 | 0% | 526 | 1,681 | +220% | 0 | 0 | — |
case-02 | fail→fail | 4,345 | 7,202 | +66% | 1 | 1 | 0% | 239 | 1,745 | +630% | 0 | 0 | — |
case-03 | fail→fail | 18,115 | 5,569 | -69% | 1 | 1 | 0% | 3,293 | 1,661 | -50% | 0 | 0 | — |
case-06 | fail→pass | 19,271 | 2,167 | -89% | 1 | 1 | 0% | 2,743 | 1,759 | -36% | 0 | 0 | — |
case-07 | fail→pass | 8,987 | 6,168 | -31% | 1 | 1 | 0% | 1,404 | 2,325 | +66% | 0 | 0 | — |
case-08 | pass→pass | 15,653 | 2,565 | -84% | 1 | 1 | 0% | 2,589 | 1,749 | -32% | 0 | 0 | — |
case-09 | fail→pass | 30,977 | 2,286 | -93% | 1 | 1 | 0% | 2,211 | 1,630 | -26% | 0 | 0 | — |
case-18 | fail→pass | 8,839 | 1,428 | -84% | 1 | 1 | 0% | 1,508 | 1,550 | +3% | 0 | 0 | — |
case-10 | fail→pass | 11,737 | 1,557 | -87% | 1 | 1 | 0% | 1,816 | 1,563 | -14% | 0 | 0 | — |
case-11 | fail→pass | 14,576 | 2,093 | -86% | 1 | 1 | 0% | 2,020 | 1,647 | -18% | 0 | 0 | — |
case-12 | pass→pass | 9,635 | 1,747 | -82% | 1 | 1 | 0% | 1,685 | 1,613 | -4% | 0 | 0 | — |
case-13 | fail→pass | 8,430 | 1,678 | -80% | 1 | 1 | 0% | 1,374 | 1,647 | +20% | 0 | 0 | — |
case-19 | fail→pass | 18,630 | 2,510 | -87% | 1 | 1 | 0% | 3,353 | 1,752 | -48% | 0 | 0 | — |
case-14 | fail→pass | 2,187 | 1,805 | -17% | 1 | 1 | 0% | 348 | 1,594 | +358% | 0 | 0 | — |
case-15 | fail→pass | 9,489 | 1,696 | -82% | 1 | 1 | 0% | 1,408 | 1,526 | +8% | 0 | 0 | — |
case-16 | fail→pass | 9,703 | 3,295 | -66% | 1 | 1 | 0% | 1,719 | 1,875 | +9% | 0 | 0 | — |
case-17 | fail→pass | 9,932 | 1,541 | -84% | 1 | 1 | 0% | 1,578 | 1,552 | -2% | 0 | 0 | — |
case-20 | pass→pass | 4,959 | 3,246 | -35% | 1 | 1 | 0% | 890 | 1,845 | +107% | 0 | 0 | — |
case-21 | pass→pass | 6,076 | 4,017 | -34% | 1 | 1 | 0% | 1,074 | 2,021 | +88% | 0 | 0 | — |
case-22 | fail→fail | 21,208 | 18,936 | -11% | 1 | 1 | 0% | 3,279 | 3,339 | +2% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +64 percentage points is the difference between those two pass rates over the 20 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.