Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mermaid-skill

БесплатноЗапускает вложенные скриптыНе проверен

Generate Mermaid diagrams (.mmd) and export to PNG/SVG/PDF using mmdc CLI or Kroki API. USE THIS SKILL when user mentions diagram, flowchart, sequence…

Agents365-aiот Agents365-ai★ 108 звёзд на GitHub8 установок в других каталогах

Об этом скилле

Mermaid Diagrams

Generate .mmd text files and export to PNG/SVG/PDF using mmdc (local) or Kroki API (no install).

Key advantage: Text-based syntax with fully automatic layout — no x/y coordinates needed.

When to use / when NOT to use

Use this skill for: diagrams-as-code with automatic layout (flowchart, sequence, class, state, ER, gantt, mindmap, architecture) — text source that lives in git and embeds in Markdown.

Do NOT use it — route elsewhere — for:

  • Pixel-precise placement, custom layout, branded icons, or heavy styling → drawio.
  • A hand-drawn / sketchy aesthetic → excalidraw or tldraw.
  • A freeform whiteboard or freehand strokes → tldraw.
  • Strict, conventional UML notation → plantuml.

Prerequisites

Option A: Local (mmdc) — also needs a headless Chrome (mmdc renders via Puppeteer)

npm install -g @mermaid-js/mermaid-cli
npx puppeteer browsers install chrome-headless-shell   # required — mmdc has no bundled browser
mmdc --version

mmdc --version succeeds even with no Chrome installed, but every export then fails with Could not find Chrome. Install the browser above (or set PUPPETEER_EXECUTABLE_PATH to a system Chrome). If you can't, use Kroki (Option B) — it needs no browser.

CI / Docker: mmdc crashes with Running as root without --no-sandbox in containers. Pass the bundled puppeteer config (see scripts/puppeteer-config.json):

mmdc -p scripts/puppeteer-config.json -i diagram.mmd -o diagram.png

Option B: Kroki API (no install)

curl --version  # Just need curl

Workflow

  1. Check deps — validate via Kroki (needs only curl); check mmdc --version and a headless Chrome only when local export (PNG quality / PDF) is wanted
  2. Pick diagram type — choose from table below
  3. Generate — write .mmd file to disk
  4. Validate — Kroki-first (see Validation; REQUIRED before export)
  5. Export — use mmdc or Kroki API to produce PNG/SVG/PDF
  6. Self-check (vision) — read the exported PNG and fix readability/layout defects that automatic layout can't prevent (clipped labels, cramped density, wrong orientation), then re-validate + re-export. Max 2 rounds; skip if no vision. See Self-Check (vision) below.
  7. Review loop — show the image to the user, apply the minimal .mmd edit per request, re-export until approved (5-round safety valve). See Review Loop below.
  8. Report — tell user the output file paths

Validation (Required)

NEVER export a diagram without validating first.

Prefer Kroki for validation — it needs no browser and sidesteps the Could not find Chrome trap entirely. Use mmdc for validation only when offline.

# Validate with Kroki (preferred — no browser needed)
curl -s -X POST -H "Content-Type: text/plain" --data-binary @diagram.mmd https://kroki.io/mermaid/svg -o /tmp/test.svg && echo "Valid" || echo "Invalid"

# Validate with mmdc (offline fallback — requires headless Chrome)
mmdc -i diagram.mmd -o /tmp/test.svg 2>&1

# If error, fix the .mmd file and validate again
# Only proceed to export after validation passes

Common validation errors:

  • Missing quotes around labels with special characters
  • Wrong arrow syntax (use ->> for sequence, --> for flowchart)
  • Undeclared participants in sequence diagrams

A Could not find Chrome (or puppeteer) error from mmdc is a setup problem, not a diagram error — the .mmd may be perfectly valid. Validate via Kroki instead of "fixing" correct syntax.

Self-Check (vision)

Zero-cost pre-check: before spending a vision call, read the PNG dimensions (sips -g pixelWidth -g pixelHeight diagram.png on macOS, file diagram.png elsewhere). An extreme aspect ratio (longer side > 8x the shorter) is a "wrong orientation" defect — fix it without vision.

Validation (above) only proves the syntax is legal — it says nothing about whether the rendered diagram is readable. After exporting, use the agent's vision capability to read the PNG and catch what automatic layout can't prevent. Mermaid positions everything itself, so the failures here are about content and readability, not overlaps:

Check What to look for Fix
Label truncation Node / edge text clipped or cut off Shorten the label, or wrap it with <br/>
Cramped, unreadable density Too many nodes crammed together; tangled lines Flip direction (TD↔LR), split into subgraphs, or reduce nodes
Wrong orientation / aspect Diagram far too wide or too tall to read Change flowchart TD↔LR (or set direction in class/state)
Edge spaghetti Many edges crossing, hard to follow Reorder node declarations so connected nodes sit adjacent; group with subgraph
Wrong diagram type Type doesn't suit the content (e.g. flowchart for a timeline) Switch type (gantt, sequenceDiagram, stateDiagram-v2, …)
Low contrast Text blends into the
Полный SKILL.md на GitHub

Установить mermaid-skill в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

reference/ARCHITECTURE.mdreference/CLASS-ER.mdreference/EXAMPLES.mdreference/FLOWCHART.mdreference/OTHER-TYPES.mdreference/SEQUENCE.mdreference/THEMES.mdreference/USECASE.mdscripts/mermaid_live_link.pyscripts/puppeteer-config.json

FAQ

Что делает скилл mermaid-skill?

Generate Mermaid diagrams (.mmd) and export to PNG/SVG/PDF using mmdc CLI or Kroki API. USE THIS SKILL when user mentions diagram, flowchart, sequence diagram, class diagram, ER diagram, state machine, architecture, visualize, git graph, 画图, 架构图, 流程图, 时序图, 类图, ER图, 甘特图, 状态机. PROACTIVELY USE when explaining ANY system with 3+ components, API flows, authentication sequences, class hierarchies, database schemas, or state machines. Supports 17+ diagram types with fully automatic layout.

Как установить скилл mermaid-skill?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mermaid-skill запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить mermaid-skill с