Skip to content
Back to search

pretty-mermaid

SkillWorks with Claude CodeGitHub

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.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/imxv-pretty-mermaid-skills/badge.svg)](/listings/imxv-pretty-mermaid-skills)

HTML

<a href="/listings/imxv-pretty-mermaid-skills"><img src="/api/listings/imxv-pretty-mermaid-skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

npx skills add imxv/pretty-mermaid-skills@pretty-mermaid -g -y

[View the skill, install count, and security audits on skills.sh →](https://www.skills.sh/imxv/pretty-mermaid-skills/pretty-mermaid)

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 204 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. ---
  2. name: pretty-mermaid
  3. description: |
  4. Generate and render Mermaid diagrams for architecture docs, READMEs, PRs,
  5. terminals, chats, and CI as themed SVG, PNG, or ASCII/Unicode art. Use this skill whenever
  6. the user provides Mermaid code or .mmd files; asks for a flowchart,
  7. sequence/state/class diagram, ERD, XY chart, or architecture/workflow/data-model
  8. visualization; or wants to beautify, theme, batch-convert, or make a diagram
  9. terminal-friendly. Runs locally without a browser or DOM, with 15 built-in
  10. themes and custom colors.
  11. ---
  12. # Pretty Mermaid
  13. 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.
  14. ## Working directory
  15. 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.
  16. ## Workflow
  17. 1. Determine whether the user supplied Mermaid source or needs a diagram authored from prose.
  18. 2. Choose the diagram type and output format from the tables below.
  19. 3. Read only the relevant reference file when syntax, theme selection, or API behavior needs more detail.
  20. 4. Save new source as a `.mmd` file, preserving user terminology and relationships.
  21. 5. Render with a named theme or explicit colors.
  22. 6. Inspect the result. Fix syntax, clipping, crowded layout, or unclear labels and render again.
  23. 7. Return the source and output paths, plus the selected format and theme.
  24. Do not overwrite an existing source or output file unless the user asked for replacement.
  25. ## Choose a diagram type
  26. | Need | Diagram type | Starter |
  27. | --- | --- | --- |
  28. | Process, decision tree, architecture | Flowchart | `flowchart LR` |
  29. | API calls, messages, interactions | Sequence | `sequenceDiagram` |
  30. | Lifecycle or finite-state machine | State | `stateDiagram-v2` |
  31. | Classes, modules, relationships | Class | `classDiagram` |
  32. | Database entities and cardinality | ER | `erDiagram` |
  33. | Bars, lines, trends, comparisons | XY chart | `xychart-beta` |
  34. Read `references/DIAGRAM_TYPES.md` when authoring non-trivial Mermaid syntax.
  35. ## Choose an output
  36. | Output | Best for | Notes |
  37. | --- | --- | --- |
  38. | SVG | READMEs, docs, slides, websites | Scalable, themed, supports transparency |
  39. | PNG | Chats, previews, raster-only tools | Set `--format png`; no external converter required |
  40. | Unicode | Modern terminals and readable text previews | Default ASCII renderer output |
  41. | Plain ASCII | Logs and restricted terminals | Add `--use-ascii` |
  42. | ANSI-colored text | Interactive terminals | Set `--color-mode` |
  43. ## Core commands
  44. Run these from `<skill-root>`.
  45. ### List themes
  46. ```bash
  47. node scripts/themes.mjs
  48. ```
  49. ### Render SVG
  50. ```bash
  51. node scripts/render.mjs \
  52. --input diagram.mmd \
  53. --output diagram.svg \
  54. --theme tokyo-night
  55. ```
  56. ### Render terminal text
  57. ```bash
  58. node scripts/render.mjs \
  59. --input diagram.mmd \
  60. --output diagram.txt \
  61. --format ascii \
  62. --color-mode none
  63. ```
  64. Add `--use-ascii` when Unicode box-drawing characters are not acceptable.
  65. ### Render PNG
  66. ```bash
  67. node scripts/render.mjs \
  68. --input diagram.mmd \
  69. --output diagram.png \
  70. --format png \
  71. --width 1200 \
  72. --theme tokyo-night
  73. ```
  74. ### Batch render a directory
  75. ```bash
  76. node scripts/batch.mjs \
  77. --input-dir ./diagrams \
  78. --output-dir ./rendered \
  79. --format svg \
  80. --theme github-dark \
  81. --workers 4
  82. ```
  83. Use batch rendering for three or more diagrams or when consistent options must be applied to a directory.
  84. ## Theme selection
  85. - General dark documentation: `tokyo-night`
  86. - GitHub dark or light surfaces: `github-dark`, `github-light`
  87. - Print and presentations: `zinc-light`
  88. - High-contrast color: `dracula`
  89. - Cool, restrained palette: `nord`, `nord-light`
  90. 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.
  91. ## Useful options
  92. ### Shared styling
  93. | Option | Purpose |
  94. | --- | --- |
  95. | `--theme <name>` | Apply one of the 15 built-in themes |
  96. | `--bg`, `--fg` | Set required base colors |
  97. | `--line`, `--accent`, `--muted` | Refine connectors, highlights, and secondary text |
  98. | `--surface`, `--border` | Refine node fill and stroke |
  99. | `--font <name>` | Set the SVG font family |
  100. ### SVG
  101. | Option | Purpose |
  102. | --- | --- |
  103. | `--transparent` | Remove the SVG background |
  104. | `--padding <n>` | Set canvas padding |
  105. | `--node-spacing <n>` | Set horizontal node spacing |
  106. | `--layer-spacing <n>` | Set vertical layer spacing |
  107. | `--component-spacing <n>` | Separate disconnected components |
  108. | `--interactive` | Enable XY chart hover tooltips |
  109. ### PNG
  110. | Option | Purpose |
  111. | --- | --- |
  112. | `--width <n>` | Set output width from 100 to 10000 pixels while preserving aspect ratio |
  113. | `--transparent` | Preserve a transparent background |
  114. ### Terminal output
  115. | Option | Purpose |
  116. | --- | --- |
  117. | `--use-ascii` | Replace Unicode box drawing with plain ASCII |
  118. | `--padding-x`, `--padding-y` | Tune diagram spacing |
  119. | `--box-border-padding` | Tune padding inside node boxes |
  120. | `--color-mode <mode>` | `none`, `auto`, `ansi16`, `ansi256`, `truecolor`, or `html` |
  121. Run `node scripts/render.mjs --help` or `node scripts/batch.mjs --help` for the authoritative CLI list.
  122. ## Authoring guidance
  123. - Prefer short, concrete labels; preserve domain-specific terms from the user.
  124. - Use explicit edge labels when a branch or message is ambiguous.
  125. - Keep large diagrams readable by splitting unrelated concerns instead of shrinking text.
  126. - Use `LR` for wide flows and `TB` for narrow documents.
  127. - Avoid communicating meaning through color alone.
  128. - Use a light theme for print and confirm contrast against the final background.
  129. - For unfamiliar syntax, start from `assets/example_diagrams/` and consult the diagram reference.
  130. ## Validation
  131. After rendering:
  132. 1. Confirm the command exits successfully and the output file is non-empty.
  133. 2. Confirm SVG output begins with `<svg`; confirm PNG output opens as a valid image; confirm text output contains visible diagram content.
  134. 3. Inspect visual output when layout matters, especially long labels, CJK text, disconnected components, and XY charts.
  135. 4. Confirm arrows, cardinalities, states, and labels match the source request.
  136. 5. Report any renderer limitation instead of silently dropping unsupported syntax.
  137. Run both `npm test` and `npm run validate` when changing this skill, its scripts, templates, or references.
  138. ## Troubleshooting
  139. - Missing dependency: run `npm install` in `<skill-root>`; the CLI also attempts a first-run install.
  140. - Unknown theme: run `node scripts/themes.mjs` and use an exact listed name.
  141. - Parse error: consult `references/DIAGRAM_TYPES.md`, reduce to the failing statement, then restore the diagram incrementally.
  142. - Crowded SVG: increase `--node-spacing`, `--layer-spacing`, or `--component-spacing`.
  143. - PNG color error: use concrete hex values for custom colors; unresolved external CSS variables cannot be rasterized.
  144. - Terminal color escape codes in redirected output: use `--color-mode none`.
  145. ## Reference routing
  146. | Resource | Read or use when |
  147. | --- | --- |
  148. | `references/DIAGRAM_TYPES.md` | Authoring or debugging Mermaid syntax |
  149. | `references/THEMES.md` | Comparing themes or defining custom colors |
  150. | `references/api_reference.md` | Extending scripts or calling `beautiful-mermaid` directly |
  151. | `docs/THEME_GALLERY.md` | Choosing a theme visually |
  152. | `assets/example_diagrams/` | Starting from a supported diagram template |
  153. | `scripts/render.mjs` | Rendering one diagram |
  154. | `scripts/batch.mjs` | Rendering a directory in parallel |
  155. | `scripts/themes.mjs` | Listing installed themes |
README.md · README · 157 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. # Pretty Mermaid
  3. **Beautiful Mermaid diagrams for AI agents**
  4. Turn Mermaid source into polished SVGs, shareable PNGs, and terminal-ready ASCII—locally, without a browser.
  5. ![Pretty Mermaid converts Mermaid source into themed SVG, PNG, and terminal ASCII diagrams](assets/social-preview.png)
  6. [![skills.sh](https://skills.sh/b/imxv/pretty-mermaid-skills)](https://www.skills.sh/imxv/pretty-mermaid-skills/pretty-mermaid)
  7. [![CI](https://github.com/imxv/Pretty-mermaid-skills/actions/workflows/ci.yml/badge.svg)](https://github.com/imxv/Pretty-mermaid-skills/actions/workflows/ci.yml)
  8. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
  9. [![Node.js Version](https://img.shields.io/badge/node-%3E%3D16-brightgreen)](https://nodejs.org/)
  10. [![GitHub stars](https://img.shields.io/github/stars/imxv/Pretty-mermaid-skills?style=social)](https://github.com/imxv/Pretty-mermaid-skills)
  11. **English** | [中文](README_CN.md) | [日本語](README_JA.md)
  12. </div>
  13. ## 🚀 Install
  14. ```bash
  15. npx skills add imxv/pretty-mermaid-skills@pretty-mermaid -g -y
  16. ```
  17. [View the skill, install count, and security audits on skills.sh →](https://www.skills.sh/imxv/pretty-mermaid-skills/pretty-mermaid)
  18. ## Why Pretty Mermaid?
  19. - **Made for AI agents**: works with Claude Code, Cursor, Codex, Gemini CLI, and more
  20. - **One source, three outputs**: polished SVG for docs, PNG for sharing, and ASCII/Unicode for terminals
  21. - **No browser required**: renders locally without Chromium, Puppeteer, or a DOM
  22. - **Flexible by default**: 15 themes, custom colors, six diagram types, and batch rendering
  23. ## ✨ Features
  24. - 📊 **Multi-format Support**: SVG, PNG, and ASCII rendering export
  25. - 🎨 **Rich Themes**: 15 built-in themes for different scenarios
  26. - 📈 **Six Diagram Types**: Flowchart, Sequence, State, Class, ER, and XY charts
  27. - ⚡ **High Performance**: Batch parallel rendering
  28. - 📚 **Ready to Use**: Complete templates and detailed documentation
  29. ### Supported Themes
  30. | Light Themes | Dark Themes | Other |
  31. | :--- | :--- | :--- |
  32. | zinc-light | zinc-dark | nord |
  33. | tokyo-night-light | tokyo-night | nord-light |
  34. | catppuccin-latte | tokyo-night-storm | dracula |
  35. | github-light | catppuccin-mocha | one-dark |
  36. | solarized-light | github-dark | |
  37. | | solarized-dark | |
  38. ## 🎨 Theme Gallery
  39. Compare the same flowchart across every built-in theme in the [complete 15-theme gallery](docs/THEME_GALLERY.md).
  40. <p align="center">
  41. <img src="assets/theme_gallery/tokyo-night.svg" alt="Tokyo Night theme preview" width="49%">
  42. <img src="assets/theme_gallery/github-light.svg" alt="GitHub Light theme preview" width="49%">
  43. </p>
  44. ## 🤖 AI Assistant Integration
  45. Seamlessly integrates with the following AI coding environments:
  46. - **Claude Code**
  47. - **Cursor**
  48. - **Gemini CLI**
  49. - **Antigravity**
  50. - **OpenCode**
  51. - **Codex**
  52. - **qoder**
  53. ## Installation details
  54. ### Install from GitHub
  55. ```bash
  56. npx skills add imxv/pretty-mermaid-skills@pretty-mermaid -g -y
  57. ```
  58. ### Verify Installation
  59. ```bash
  60. npx skills list -g
  61. ```
  62. Confirm that `pretty-mermaid` appears in the global skill list. Node.js 16 or newer is required.
  63. ## 📖 Quick Start
  64. ### List Available Themes
  65. ```bash
  66. node scripts/themes.mjs
  67. ```
  68. ### Render Single Diagram
  69. ```bash
  70. node scripts/render.mjs \
  71. --input diagram.mmd \
  72. --output output.svg \
  73. --theme tokyo-night
  74. ```
  75. ### Render PNG
  76. ```bash
  77. node scripts/render.mjs \
  78. --input diagram.mmd \
  79. --output output.png \
  80. --format png \
  81. --width 1200 \
  82. --theme tokyo-night
  83. ```
  84. ### Batch Render
  85. ```bash
  86. node scripts/batch.mjs \
  87. --input-dir ./diagrams \
  88. --output-dir ./output \
  89. --theme dracula
  90. ```
  91. ## 📂 Examples
  92. Check the 6 template files in `assets/example_diagrams/`:
  93. - `flowchart.mmd` - Flowchart
  94. - `sequence.mmd` - Sequence Diagram
  95. - `state.mmd` - State Diagram
  96. - `class.mmd` - Class Diagram
  97. - `er.mmd` - ER Diagram
  98. - `xychart.mmd` - XY Chart (bar and line)
  99. PNG output is rendered directly in Node.js with no external converter required. The renderer also supports CJK state names, multiline labels, `linkStyle`, configurable ELK layout spacing, interactive XY chart tooltips, and ANSI-colored terminal output.
  100. ## 📚 Documentation
  101. - [Skill usage guide](SKILL.md)
  102. - [Theme gallery](docs/THEME_GALLERY.md)
  103. - [Diagram syntax reference](references/DIAGRAM_TYPES.md)
  104. - [Theme and custom color reference](references/THEMES.md)
  105. - [beautiful-mermaid API reference](references/api_reference.md)
  106. - [Release process](RELEASING.md)
  107. ## 🤝 Community
  108. Read the [contribution guide](CONTRIBUTING.md), report problems with the issue templates, and review the [security policy](SECURITY.md) before sharing sensitive findings. Release history is tracked in the [changelog](CHANGELOG.md).
  109. ## ⚙️ Requirements
  110. - Node.js 16+
  111. ## 📄 License
  112. MIT License
  113. ## Star History
  114. [![Star History Chart](https://api.star-history.com/svg?repos=imxv/Pretty-mermaid-skills&type=timeline&legend=top-left)](https://www.star-history.com/?repos=imxv%2FPretty-mermaid-skills&type=timeline&legend=bottom-right)
  115. ## 🙏 Acknowledgments
  116. Based on [beautiful-mermaid](https://github.com/lukilabs/beautiful-mermaid)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.