
pretty-mermaid
Generate and render Mermaid diagrams for architecture docs, READMEs, PRs, terminals, chats, and CI as themed SVG, PNG, or ASCII/Unicode art. Use this skill whenever the user provides Mermaid code or .mmd files; asks for a flowchart, sequence/state/class diagram, ERD, XY chart, or architecture/workflow/data-model visualization; or wants to beautify, theme, batch-convert, or make a diagram terminal-friendly. Runs locally without a browser or DOM, with 15 built-in themes and custom colors.
- Installs
- 4.5K
- Last 24h
- +11
- Trending rank
- #8303
- Security
- Warn
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/imxv/pretty-mermaid-skills --skill pretty-mermaid- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads pretty-mermaid automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
Pretty Mermaid
Create or render Mermaid diagrams with the bundled Node.js CLI. Use SVG for scalable documentation, PNG for sharing or raster-only consumers, and ASCII or Unicode for terminals and plain text.
Working directory
Treat the directory containing this file as <skill-root>. Run bundled scripts from that directory, or invoke them with absolute paths. Keep user source and rendered output in the user's requested location; do not copy the renderer into their project.
Workflow
- Determine whether the user supplied Mermaid source or needs a diagram authored from prose.
- Choose the diagram type and output format from the tables below.
- Read only the relevant reference file when syntax, theme selection, or API behavior needs more detail.
- Save new source as a
.mmdfile, preserving user terminology and relationships. - Render with a named theme or explicit colors.
- Inspect the result. Fix syntax, clipping, crowded layout, or unclear labels and render again.
- Return the source and output paths, plus the selected format and theme.
Do not overwrite an existing source or output file unless the user asked for replacement.
Choose a diagram type
| Need | Diagram type | Starter |
|---|---|---|
| Process, decision tree, architecture | Flowchart | flowchart LR |
| API calls, messages, interactions | Sequence | sequenceDiagram |
| Lifecycle or finite-state machine | State | stateDiagram-v2 |
| Classes, modules, relationships | Class | classDiagram |
| Database entities and cardinality | ER | erDiagram |
| Bars, lines, trends, comparisons | XY chart | xychart-beta |
Read references/DIAGRAM_TYPES.md when authoring non-trivial Mermaid syntax.
Choose an output
| Output | Best for | Notes |
|---|---|---|
| SVG | READMEs, docs, slides, websites | Scalable, themed, supports transparency |
| PNG | Chats, previews, raster-only tools | Set --format png; no external converter required |
| Unicode | Modern terminals and readable text previews | Default ASCII renderer output |
| Plain ASCII | Logs and restricted terminals | Add --use-ascii |
| ANSI-colored text | Interactive terminals | Set --color-mode |
Core commands
Run these from <skill-root>.
List themes
node scripts/themes.mjs
Render SVG
node scripts/render.mjs \
--input diagram.mmd \
--output diagram.svg \
--theme tokyo-night
Render terminal text
node scripts/render.mjs \
--input diagram.mmd \
--output diagram.txt \
--format ascii \
--color-mode none
Add --use-ascii when Unicode box-drawing characters are not acceptable.
Render PNG
node scripts/render.mjs \
--input diagram.mmd \
--output diagram.png \
--format png \
--width 1200 \
--theme tokyo-night
Batch render a directory
node scripts/batch.mjs \
--input-dir ./diagrams \
--output-dir ./rendered \
--format svg \
--theme github-dark \
--workers 4
Use batch rendering for three or more diagrams or when consistent options must be applied to a directory.
Theme selection
- General dark documentation:
tokyo-night - GitHub dark or light surfaces:
github-dark,github-light - Print and presentations:
zinc-light - High-contrast color:
dracula - Cool, restrained palette:
nord,nord-light
Read references/THEMES.md or open docs/THEME_GALLERY.md when visual theme choice matters. A named theme can be refined with explicit color flags.
Useful options
Shared styling
| Option | Purpose |
|---|---|
--theme <name> | Apply one of the 15 built-in themes |
--bg, --fg | Set required base colors |
--line, --accent, --muted | Refine connectors, highlights, and secondary text |
--surface, --border | Refine node fill and stroke |
--font <name> | Set the SVG font family |
SVG
| Option | Purpose |
|---|---|
--transparent | Remove the SVG background |
--padding <n> | Set canvas padding |
--node-spacing <n> | Set horizontal node spacing |
--layer-spacing <n> | Set vertical layer spacing |
--component-spacing <n> | Separate disconnected components |
--interactive | Enable XY chart hover tooltips |
PNG
| Option | Purpose |
|---|---|
--width <n> | Set output width from 100 to 10000 pixels while preserving aspect ratio |
--transparent | Preserve a transparent background |
Terminal output
| Option | Purpose |
|---|---|
--use-ascii | Replace Unicode box drawing with plain ASCII |
--padding-x, --padding-y | Tune diagram spacing |
--box-border-padding | Tune padding inside node boxes |
--color-mode <mode> | none, auto, ansi16, ansi256, truecolor, or html |
Run node scripts/render.mjs --help or node scripts/batch.mjs --help for the authoritative CLI list.
Authoring guidance
- Prefer short, concrete labels; preserve domain-specific terms from the user.
- Use explicit edge labels when a branch or message is ambiguous.
- Keep large diagrams readable by splitting unrelated concerns instead of shrinking text.
- Use
LRfor wide flows andTBfor narrow documents. - Avoid communicating meaning through color alone.
- Use a light theme for print and confirm contrast against the final background.
- For unfamiliar syntax, start from
assets/example_diagrams/and consult the diagram reference.
Validation
After rendering:
- Confirm the command exits successfully and the output file is non-empty.
- Confirm SVG output begins with
<svg; confirm PNG output opens as a valid image; confirm text output contains visible diagram content. - Inspect visual output when layout matters, especially long labels, CJK text, disconnected components, and XY charts.
- Confirm arrows, cardinalities, states, and labels match the source request.
- Report any renderer limitation instead of silently dropping unsupported syntax.
Run both npm test and npm run validate when changing this skill, its scripts, templates, or references.
Troubleshooting
- Missing dependency: run
npm installin<skill-root>; the CLI also attempts a first-run install. - Unknown theme: run
node scripts/themes.mjsand use an exact listed name. - Parse error: consult
references/DIAGRAM_TYPES.md, reduce to the failing statement, then restore the diagram incrementally. - Crowded SVG: increase
--node-spacing,--layer-spacing, or--component-spacing. - PNG color error: use concrete hex values for custom colors; unresolved external CSS variables cannot be rasterized.
- Terminal color escape codes in redirected output: use
--color-mode none.
Reference routing
| Resource | Read or use when |
|---|---|
references/DIAGRAM_TYPES.md | Authoring or debugging Mermaid syntax |
references/THEMES.md | Comparing themes or defining custom colors |
references/api_reference.md | Extending scripts or calling beautiful-mermaid directly |
docs/THEME_GALLERY.md | Choosing a theme visually |
assets/example_diagrams/ | Starting from a supported diagram template |
scripts/render.mjs | Rendering one diagram |
scripts/batch.mjs | Rendering a directory in parallel |
scripts/themes.mjs | Listing installed themes |
FAQ
What does the pretty-mermaid skill do?
Generate and render Mermaid diagrams for architecture docs, READMEs, PRs, terminals, chats, and CI as themed SVG, PNG, or ASCII/Unicode art. Use this skill whenever the user provides Mermaid code or .mmd files; asks for a flowchart, sequence/state/class diagram, ERD, XY chart, or architecture/workflow/data-model visualization; or wants to beautify, theme, batch-convert, or make a diagram terminal-friendly. Runs locally without a browser or DOM, with 15 built-in themes and custom colors.
How do I install pretty-mermaid?
Run npx skills add https://github.com/imxv/pretty-mermaid-skills --skill pretty-mermaid in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/pretty-mermaid/ (personal) or .claude/skills/pretty-mermaid/ (project).
Which AI agents can use pretty-mermaid?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is pretty-mermaid safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket flagged items to review; Snyk flagged items to review; Runlayer passed; ZeroLeaks passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains pretty-mermaid?
It is published by imxv in imxv/pretty-mermaid-skills. It has 4,499 recorded installs.
Popular docs & writing skills
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
lark-markdown
open.feishu.cn
飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。
writing-beats
mattpocock/skills
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
writing-shape
mattpocock/skills
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
mattpocock/skills
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
mattpocock/skills
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.