beautiful-mermaid
intellectronica/agent-skills
Render Mermaid diagrams as SVG and PNG images with theme support and high-resolution output.
What is beautiful-mermaid?
Beautiful Mermaid converts Mermaid diagram syntax into scalable SVG and high-resolution PNG images. Use it when you need to visualize flowcharts, sequences, state machines, class diagrams, or entity-relationship models with professional styling and multiple theme options.
- Render Mermaid diagrams to SVG vector format for infinite scalability
- Generate high-resolution PNG screenshots at 4K viewport (3840×2160)
- Support 13+ themes including Dracula, Tokyo Night, Nord, GitHub, and Catppuccin
- Handle flowcharts, sequence diagrams, state machines, class diagrams, and ER models
- Apply edge labels and special characters with proper syntax handling
- Produce both vector and raster outputs in a single workflow
How to install beautiful-mermaid
npx skills add https://github.com/intellectronica/agent-skills --skill beautiful-mermaid- agent-browser skill must be installed for PNG rendering
- Bun, Node.js (via tsx), or Deno runtime available
- Valid Mermaid diagram syntax or ability to generate it
How to use beautiful-mermaid
- 1.Generate or validate Mermaid code—if user provides a description, convert it to valid Mermaid syntax using mermaid-syntax.md reference
- 2.Run the render script with your diagram code or file: bun run scripts/render.ts --code "..." --output diagram --theme default
- 3.Create an HTML wrapper for the SVG: bun run scripts/create-html.ts --svg diagram.svg --output diagram.html
- 4.Capture PNG using agent-browser: set viewport to 3840×2160, open the HTML file, wait for render, take full-page screenshot
- 5.Clean up intermediary files (HTML wrapper and temporary .mmd files), keeping only the final .svg and .png outputs
Use cases
- Visualize CI/CD pipelines and process flows as scalable diagrams
- Document API call sequences and OAuth authentication flows
- Create UML class diagrams and design pattern visualizations
- Generate database schema and entity-relationship diagrams
- Render state machines for connection lifecycles or system states
- Software architects and system designers
- Backend and API developers
- Database designers and data modelers
- Technical documentation writers
- DevOps engineers planning infrastructure flows
beautiful-mermaid FAQ
Flowchart, Sequence, State, Class, and Entity-Relationship diagrams are all supported. Consult the mermaid-syntax.md reference for full syntax details.
Use pipe syntax: A -->|label| B or A ---|label| B. Avoid space-dash syntax (A -- label --> B) as it can cause incomplete renders.
Verify edge label syntax uses pipes, ensure all node IDs are unique, check for unclosed brackets in labels, and validate syntax at https://mermaid.live before rendering.
Yes, 13+ themes are available including default, Dracula, Tokyo Night, Nord, GitHub Dark/Light, Catppuccin, Solarized, and others. Specify with --theme flag; default is used if not specified.
Both SVG (vector, infinitely scalable) and PNG (high-resolution raster at 4K) are always generated and saved to the current working directory.
Full instructions (SKILL.md)
Source of truth, from intellectronica/agent-skills.
name: beautiful-mermaid description: Render Mermaid diagrams as SVG and PNG using the Beautiful Mermaid library. Use when the user asks to render a Mermaid diagram.
Beautiful 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.)
Related skills
More from intellectronica/agent-skills and the wider catalog.

context7
Retrieve current documentation for software libraries and frameworks via the Context7 API.

gog-cli
Use this skill whenever the user wants to operate Google Workspace from the command line with gog/gogcli, including Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Chat, Classroom, Contacts, Tasks, People, Groups, Admin, Keep, auth, configuration, scripting, or agent-safe Google automation. Prefer this skill for Google account/file/mail/calendar work when the user mentions gog, gogcli, Google CLI, Gmail search/send, Calendar events, Drive files, Docs/Sheets/Slides editing, Forms, Apps Script, Workspace admin, or command-line Google automation.

markdown-converter
Convert PDFs, Word, Excel, PowerPoint, images, audio, and more to Markdown for LLM processing.

nano-banana-pro
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API.

notion-api
Interact with Notion workspaces via REST API with comprehensive endpoint coverage and authentication handling.

todoist-api
Interact with Todoist via CLI for task/project management with built-in confirmation for destructive actions.