mermaid-tools
Locates Mermaid syntax in markdown files and converts them into static PNG images for repository-based documentation.
Install
mkdir -p .claude/skills/mermaid-tools && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3153" && unzip -o skill.zip -d .claude/skills/mermaid-tools && rm skill.zipInstalls to .claude/skills/mermaid-tools
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Extract Mermaid diagrams from markdown files
- →Generate high-resolution PNG images from Mermaid code
- →Batch process multiple diagrams from a single file
- →Apply context-aware smart sizing to output images
- →Validate generated PNG files
How it works
The tool uses a bundled shell script to extract Mermaid code blocks from markdown, then uses Puppeteer and mermaid-cli to render them as PNG images.
Inputs & outputs
When to use mermaid-tools
- →Convert sequence diagrams to images
- →Generate visual flowcharts from markdown
- →Export documentation diagrams to PNG
- →Batch process Mermaid diagrams
About this skill
Mermaid Tools
Overview
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.
Core Workflow
Standard Diagram Extraction and Generation
Extract Mermaid diagrams from a markdown file and generate PNG images using the bundled extract-and-generate.sh script:
cd "${CLAUDE_SKILL_DIR}/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>/diagrams
Example:
cd "${CLAUDE_SKILL_DIR}/scripts"
./extract-and-generate.sh "<markdown_file>" "<output_directory>"
What the Script Does
- Extracts all Mermaid code blocks from the markdown file
- Numbers them sequentially (01, 02, 03, etc.) in order of appearance
- Generates
.mmdfiles for each diagram - Creates high-resolution PNG images with smart sizing
- Validates all generated PNG files
Output Files
For each diagram, the script generates:
01-diagram-name.mmd- Extracted Mermaid code01-diagram-name.png- High-resolution PNG image
The numbering ensures diagrams maintain their order from the source document.
Advanced Usage
Custom Dimensions and Scaling
Override default dimensions using environment variables:
cd "${CLAUDE_SKILL_DIR}/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 output
High-Resolution Output for Presentations
cd "${CLAUDE_SKILL_DIR}/scripts"
MERMAID_WIDTH=2400 MERMAID_HEIGHT=1800 MERMAID_SCALE=4 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Print-Quality Output
cd "${CLAUDE_SKILL_DIR}/scripts"
MERMAID_SCALE=5 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Smart Sizing Feature
The script automatically adjusts dimensions based on diagram type (detected from filename):
- Timeline/Gantt: 2400×400 (wide and short)
- Architecture/System/Caching: 2400×1600 (large and detailed)
- Monitoring/Workflow/Sequence/API: 2400×800 (wide for process flows)
- Default: 1200×800 (standard size)
Context-aware naming in the extraction process helps trigger appropriate smart sizing.
Important Principles
Use Bundled Scripts
CRITICAL: Use the bundled extract-and-generate.sh script from this skill's scripts/ directory. All necessary dependencies are bundled together.
Change to Script Directory
Run the script from its own directory to properly locate dependencies (extract_diagrams.py and puppeteer-config.json):
cd "${CLAUDE_SKILL_DIR}/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.
Prerequisites Verification
Before running the script, verify dependencies are installed:
- mermaid-cli:
mmdc --version - Google Chrome:
google-chrome-stable --version - Python 3:
python3 --version
If any are missing, consult references/setup_and_troubleshooting.md for installation instructions.
Troubleshooting
For detailed troubleshooting guidance, refer to references/setup_and_troubleshooting.md, which covers:
- Browser launch failures
- Permission issues
- No diagrams found
- Python extraction failures
- Output quality issues
- Diagram-specific sizing problems
Quick fixes for common issues:
Permission denied:
chmod +x "${CLAUDE_SKILL_DIR}/scripts/extract-and-generate.sh"
Low quality output:
MERMAID_SCALE=3 ./extract-and-generate.sh "<markdown_file>" "<output_directory>"
Chrome/Puppeteer errors: Verify all WSL2 dependencies are installed (see references for full list).
Bundled Resources
scripts/
This skill bundles all necessary scripts for Mermaid diagram generation:
- extract-and-generate.sh - Main script that orchestrates extraction and PNG generation
- extract_diagrams.py - Python script for extracting Mermaid code blocks from markdown
- puppeteer-config.json - Chrome/Puppeteer configuration for WSL2 environment
All scripts must be run from the scripts/ directory to properly locate dependencies.
references/setup_and_troubleshooting.md
Comprehensive reference documentation including:
- Complete prerequisite installation instructions
- Detailed environment variable reference
- Extensive troubleshooting guide
- WSL2-specific Chrome dependency setup
- Validation procedures
Load this reference when dealing with setup issues, installation problems, or advanced customization needs.
When not to use it
- →When the environment lacks Google Chrome or mermaid-cli
Prerequisites
Limitations
- →Scripts must be executed from the scripts directory to locate dependencies
- →Requires specific system-level dependencies like Chrome
How it compares
This process automates the conversion of embedded documentation diagrams into static images, ensuring consistent formatting and resolution compared to manual screenshots.
Compared to similar skills
mermaid-tools side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| mermaid-tools (this skill) | 1 | 2mo | Review | Beginner |
| mermaid-diagram-specialist | 12 | 6mo | No flags | Intermediate |
| plantuml-ascii | 8 | 6mo | Review | Beginner |
| architecture-diagram-creator | 8 | 9mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by daymade
View all by daymade →You might also like
mermaid-diagram-specialist
davila7
Mermaid diagram specialist for creating flowcharts, sequence diagrams, ERDs, and architecture visualizations
plantuml-ascii
github
Generate ASCII art diagrams using PlantUML text mode. Use when user asks to create ASCII diagrams, text-based diagrams, terminal-friendly diagrams, or mentions plantuml ascii, text diagram, ascii art diagram. Supports: Converting PlantUML diagrams to ASCII art, Creating sequence diagrams, class diagrams, flowcharts in ASCII format, Generating Unicode-enhanced ASCII art with -utxt flag
architecture-diagram-creator
mhattingpete
Create comprehensive HTML architecture diagrams showing data flows, business objectives, features, technical architecture, and deployment. Use when users request system architecture, project documentation, high-level overviews, or technical specifications.
mermaidjs-v11
mrgoonie
Create diagrams and visualizations using Mermaid.js v11 syntax. Use when generating flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, user journeys, timelines, architecture diagrams, or any of 24+ diagram types. Supports JavaScript API integration, CLI rendering to SVG/PNG/PDF, theming, configuration, and accessibility features. Essential for documentation, technical diagrams, project planning, system architecture, and visual communication.
flowchart-creator
mhattingpete
Create HTML flowcharts and process diagrams with decision trees, color-coded stages, arrows, and swimlanes. Use when users request flowcharts, process diagrams, workflow visualizations, or decision trees.
mermaid-visualizer
axtonliu
Transform text content into professional Mermaid diagrams for presentations and documentation. Use when users ask to visualize concepts, create flowcharts, or make diagrams from text. Supports process flows, system architectures, comparisons, mindmaps, and more with built-in syntax error prevention.