
Beautiful Mermaid Diagram Rendering
FreeEasily create SVG and PNG diagrams with Mermaid.
Free · Opens the source repo
What Beautiful Mermaid Diagram Rendering does
The Beautiful Mermaid skill enables users to render Mermaid diagrams into SVG and PNG formats using the Beautiful Mermaid library. This skill is particularly useful for developers and designers who need to visualize complex processes, state machines, or class structures in a clear and professional manner. By leveraging Mermaid's syntax, users can create flowcharts, sequence diagrams, state diagrams, class diagrams, and entity-relationship diagrams, making it a versatile tool for various applications.
To get started, users must first generate or validate their Mermaid code. If a user provides a description instead of the actual code, the skill can assist in generating valid Mermaid syntax. Once the code is ready, users can run a rendering script that outputs an SVG file, which is ideal for scalable graphics. Additionally, the skill supports multiple themes, allowing users to customize the appearance of their diagrams to match their project aesthetics.
For high-resolution outputs, the skill integrates with the agent-browser skill, enabling users to capture PNG images at 4K resolution. This is particularly beneficial for presentations or documentation where visual clarity is paramount. After rendering, the skill also ensures that all intermediary files are cleaned up, leaving only the final outputs in the working directory. This streamlined workflow enhances productivity and minimizes clutter in the project environment.
When to use it
Use this skill when you need to create visual representations of processes, data models, or system architectures using Mermaid syntax.
When not to use it
This skill may not be suitable for users who require complex diagramming features beyond the capabilities of Mermaid, such as advanced interactivity or 3D visualizations.
What you can build with it
Creating Flowcharts for CI/CD Pipelines
Use the Beautiful Mermaid skill to visualize your CI/CD processes with clear flowcharts, making it easier to communicate workflows.
Documenting API Interactions
Generate sequence diagrams to document API calls and interactions, providing a visual reference for developers and stakeholders.
Designing UML Class Diagrams
Utilize the skill to create UML class diagrams that illustrate the structure of your software, aiding in design discussions and documentation.
How to install Beautiful Mermaid Diagram Rendering
View source1. Install with the skills CLI
npx skills add calesthio/openmontage/beautiful-mermaid --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by calesthioBeautiful Mermaid Diagram Rendering
Render Mermaid diagrams as SVG and PNG images using the Beautiful Mermaid library.
Dependencies
This skill requires the agent-browser skill for PNG rendering. Load it before proceeding with PNG capture.
Supported Diagram Types
- Flowchart - Process flows, decision trees, CI/CD pipelines
- Sequence - API calls, OAuth flows, database transactions
- State - State machines, connection lifecycles
- Class - UML class diagrams, design patterns
- Entity-Relationship - Database schemas, data models
Available Themes
Default, Dracula, Solarized, Zinc Dark, Tokyo Night, Tokyo Night Storm, Tokyo Night Light, Catppuccin Latte, Nord, Nord Light, GitHub Dark, GitHub Light, One Dark.
If no theme is specified, use default.
Common Syntax Patterns
Flowchart Edge Labels
Use pipe syntax for edge labels:
A -->|label| B
A ---|label| B
Avoid space-dash syntax which can cause incomplete renders:
A -- label --> B # May cause issues
Node Labels with Special Characters
Wrap labels containing special characters in quotes:
A["Label with (parens)"]
B["Label with / slash"]
Workflow
Step 1: Generate or Validate Mermaid Code
If the user provides a description rather than code, generate valid Mermaid syntax. Consult references/mermaid-syntax.md for full syntax details.
Step 2: Render SVG
Run the rendering script to produce an SVG file:
bun run scripts/render.ts --code "graph TD; A-->B" --output diagram --theme default
Or from a file:
bun run scripts/render.ts --input diagram.mmd --output diagram --theme tokyo-night
Alternative runtimes:
npx tsx scripts/render.ts --code "..." --output diagram
deno run --allow-read --allow-write --allow-net scripts/render.ts --code "..." --output diagram
This produces <output>.svg in the current working directory.
Step 3: Create HTML Wrapper
Run the HTML wrapper script to prepare for screenshot:
bun run scripts/create-html.ts --svg diagram.svg --output diagram.html
This creates a minimal HTML file that displays the SVG with proper padding and background.
Step 4: Capture High-Resolution PNG with agent-browser
Use the agent-browser CLI to capture a high-quality screenshot. Refer to the agent-browser skill for full CLI documentation.
# Set 4K viewport for high-resolution capture
agent-browser set viewport 3840 2160
# Open the HTML wrapper
agent-browser open "file://$(pwd)/diagram.html"
# Wait for render to complete
agent-browser wait 1000
# Capture full-page screenshot
agent-browser screenshot --full diagram.png
# Close browser
agent-browser close
For even higher resolution on complex diagrams, increase the viewport further or use the --padding option when creating the HTML wrapper to give the diagram more space.
Step 5: Clean Up Intermediary Files
After rendering, remove all intermediary files. Only the final .svg and .png should remain.
Files to clean up:
- The HTML wrapper file (e.g.,
diagram.html) - Any temporary
.mmdfiles created to hold diagram code - Any other files created during the rendering process
rm diagram.html
If a temporary .mmd file was created, remove it as well.
Output
Both outputs are always produced:
- SVG: Vector format, infinitely scalable, small file size
- PNG: High-resolution raster, captured at 4K (3840×2160) viewport with minimum 1200px diagram width
Files are saved to the current working directory unless the user explicitly specifies a different path.
Theme Selection Guide
| Theme | Background | Best For |
|---|---|---|
| default | Light grey | General use |
| dracula | Dark purple | Dark mode preference |
| tokyo-night | Dark blue | Modern dark aesthetic |
| tokyo-night-storm | Darker blue | Higher contrast |
| nord | Dark arctic | Muted, calm visuals |
| nord-light | Light arctic | Light mode with soft tones |
| github-dark | GitHub dark | Matches GitHub UI |
| github-light | GitHub light | Matches GitHub UI |
| catppuccin-latte | Warm light | Soft pastel aesthetic |
| solarized | Tan/cream | Solarized colour scheme |
| one-dark | Atom dark | Atom editor aesthetic |
| zinc-dark | Neutral dark | Minimal, no colour bias |
Troubleshooting
Theme not applied
Check the render script output for the bg and fg values, or inspect the SVG's opening tag for --bg and --fg CSS custom properties.
Diagram appears cut off or incomplete
- Check edge label syntax — use
-->|label|pipe notation, not-- label --> - Verify all node IDs are unique
- Check for unclosed brackets in node labels
Render produces empty or malformed SVG
- Validate Mermaid syntax at https://mermaid.live before rendering
- Check for special characters that need escaping (wrap in quotes)
- Ensure flowchart direction is specified (
graph TD,graph LR, etc.)
Frequently asked questions about Beautiful Mermaid Diagram Rendering
Similar skills
Excalidraw Diagram Generator
Transform natural language into Excalidraw diagrams.
Draw.io Diagram Generator
Easily create and validate draw.io diagrams.
Image Annotations
Easily annotate images with callouts and highlights.
Banner Design
Create stunning banners for any platform effortlessly.
Scientific Schematics
Generate publication-quality scientific diagrams effortlessly.
Infographics
Create professional infographics with ease and accuracy.
