beautiful-mermaid — скилл для Claude Code: что делает и как установить
Рендерит диаграммы Mermaid в векторные SVG и растровые PNG через библиотеку Beautiful Mermaid. Пригодится для визуализации архитектуры, баз данных и рабочих процессов.
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a claude-codeЧто делает beautiful-mermaid
Скилл превращает код Mermaid в готовые векторные файлы SVG и растровые снимки PNG. Внутри цепочки работают два скрипта: scripts/render.ts компилирует диаграмму, а scripts/create-html.ts оборачивает результат в минимальный HTML для браузерного рендера. Для запуска генератора подходят Bun, Node через tsx или Deno. Поддерживаются блок-схемы, диаграммы последовательностей, машины состояний, классы и схемы «сущность — связь». Оформление можно выбрать из готовых тем, включая Dracula, Tokyo Night и Nord.
Генерация растрового PNG опирается на утилиту agent-browser, которая открывает промежуточный HTML-документ и делает снимок экрана. Без предварительно установленного скилла agent-browser сохранить PNG не получится, поэтому его нужно подключить заранее. Промежуточные файлы разметки скрипт удаляет сразу после рендера, оставляя в каталоге только финальные изображения. В синтаксисе есть тонкость: подписи к стрелкам блок-схем нужно оборачивать в пайпы вида -->|текст|, иначе линии отрисуются с ошибками.
Какие задачи решает
- Сгенерировать векторную диаграмму SVG из описания или кода Mermaid
- Создать снимок схемы в формате PNG через браузерный рендер
- Подобрать готовую тёмную или светлую тему оформления для архитектурной схемы
- Очистить рабочую директорию от промежуточных файлов разметки после сборки графики
Примеры запросов агенту
- Отрисуй диаграмму последовательности для авторизации через OAuth в теме tokyo-night
- Собери SVG и PNG для блок-схемы из файла diagram.mmd
- Визуализируй связи таблиц базы данных как ER-диаграмму в стиле dracula
Как установить beautiful-mermaid
1Через Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a claude-code2Вручную: положить файлы
~/.claude/skills/beautiful-mermaid/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/beautiful-mermaid/
1Через Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a codex2Вручную: положить файлы
.agents/skills/beautiful-mermaid/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a cursor2Вручную: положить файлы
.cursor/skills/beautiful-mermaid/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install intellectronica/agent-skills beautiful-mermaid2Вручную: положить файлы
.github/skills/beautiful-mermaid/SKILL.md1Через Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a gemini-cli2Командой платформы
gemini skills install https://github.com/intellectronica/agent-skills --path skills/beautiful-mermaidВручную: положить файлы
.devin/skills/beautiful-mermaid/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о beautiful-mermaid
Как установить beautiful-mermaid в Claude Code?
Выполните команду npx skills add intellectronica/agent-skills --skill beautiful-mermaid -a claude-code.
Что делает beautiful-mermaid?
Скилл компилирует разметку Mermaid в векторные SVG и растровые PNG-изображения, оформляя их в стилях вроде Dracula, Nord или Tokyo Night.
Что нужно для экспорта в PNG?
Для генерации растровых картинок требуется скилл agent-browser, который открывает HTML-обёртку и делает снимок экрана.
Исходный текст
SKILL.md · CC0-1.0
--- 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: ```mermaid A -->|label| B A ---|label| B ``` Avoid space-dash syntax which can cause incomplete renders: ```mermaid A -- label --> B # May cause issues ``` ### Node Labels with Special Characters Wrap labels containing special characters in quotes: ```mermaid 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: ```bash bun run scripts/render.ts --code "graph TD; A-->B" --output diagram --theme default ``` Or from a file: ```bash bun run scripts/render.ts --input diagram.mmd --output diagram --theme tokyo-night ``` Alternative runtimes: ```bash 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: ```bash 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. ```bash # 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 `.mmd` files created to hold diagram code - Any other files created during the rendering process ```bash 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.)
© intellectronica · CC0-1.0 · intellectronica/agent-skills