Command Palette

Search for a command to run...

Назад к скиллам
скилл № 25340

mermaid

Must read guide on creating/editing mermaid charts with validation tools and syntax reference for all diagram types

БесплатноЗапускает вложенные скрипты
alexanderopот alexanderop★ 15 звёзд на GitHub

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

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

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

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

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

Mermaid Skill

Use this skill to quickly validate Mermaid diagrams by parsing + rendering them with the official Mermaid CLI. Includes a syntax reference for every Mermaid diagram type.

Arguments

When this skill is invoked, the user may provide a file path and name as an argument:

@skills/mermaid/skill.md <filename.mmd>

Examples: vue-architecture.mmd, docs/auth-flow.mmd, db-schema.mmd

  • If a filename is provided, use it exactly as given.
  • If no filename is provided, derive a descriptive kebab-case name from the diagram's subject (e.g. user-auth-flow.mmd, payment-sequence.mmd, order-er-diagram.mmd). Place it in the project root.
  • Never reuse a generic name like diagram.mmd. Every diagram gets its own descriptively named file.

Prerequisites

  • Node.js + npm (for npx).
  • First run downloads a headless Chromium via Puppeteer. If Chromium is missing, set PUPPETEER_EXECUTABLE_PATH.

Tool

Validate a diagram

The validate script lives inside the skill directory. Use the path relative to the skill, not the working directory:

.agents/skills/mermaid/tools/validate.sh <filename.mmd> [output.svg]
  • Parses and renders the Mermaid source.
  • Non-zero exit = invalid Mermaid syntax.
  • Prints an ASCII preview using beautiful-mermaid (best-effort; not all diagram types are supported).
  • If output.svg is omitted, the SVG is rendered to a temp file and discarded.

Workflow (short)

  1. Choose a descriptive filename for the diagram (from the argument or derived from the subject). Use kebab-case with .mmd extension.
  2. Write the Mermaid source to that file in the project root (or the path given).
  3. Run .agents/skills/mermaid/tools/validate.sh <filename.mmd>.
  4. Fix any errors shown by the CLI.
  5. Always show the ASCII preview output to the user. The tool prints an ASCII rendering of the diagram — display it in your response so the user can see the result without opening another tool.
  6. Once it validates, if the diagram will live in Markdown, copy the Mermaid block into the target Markdown file.

Diagram Type Reference

Pick the right diagram for the job. Each section shows what it's for and the essential syntax.

1. Flowchart

Use for: Process flows, decision trees, workflows, algorithms.

flowchart TD
    A[Start] --> B{Decision?}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E

Directions: TB/TD (top-down), BT, LR, RL

Node shapes: A[rect] A(rounded) A([stadium]) Asubroutine A[(cylinder)] A((circle)) A{diamond} A{{hexagon}} A[/parallelogram/] A[/trapezoid\] A(((double circle)))

Links: --> arrow, --- open, -.-> dotted, ==> thick, ~~~ invisible, <--> bidirectional. Add text: -->|text| or -- text -->

Subgraphs: subgraph id[title] ... end

Multi-line labels: \n does NOT work. Use markdown strings with backticks and real newlines:

A["`Line 1
Line 2
Line 3`"]

Markdown strings also support bold and italic formatting.

Styling: style A fill:#f9f,stroke:#333 or classDef cls fill:#f9f; A:::cls

2. Sequence Diagram

Use for: API calls, service interactions, request/response flows, protocol sequences.

sequenceDiagram
    participant A as Alice
    participant B as Bob
    A->>B: Hello
    B-->>A: Hi back
    A->>B: How are you?
    B-->>A: Great!

Participants: participant, actor. Stereotypes (JSON config): boundary, control, entity, database, collections, queue

Arrows: ->> solid+arrowhead, -->> dotted+arrowhead, -x cross end, -) async open arrow, <<->> bidirectional

Activations: activate A / deactivate A or shorthand A->>+B: msg / B-->>-A: reply

Notes: Note right of A: text or Note over A,B: text

Control flow:

  • loop text ... end
  • alt text ... else ... end
  • opt text ... end
  • par [Action 1] ... and [Action 2] ... end
  • critical [text] ... option [text] ... end
  • break [text] ... end

Grouping: box color Title ... end

Background highlight: rect rgb(0,255,0) ... end

3. Class Diagram

Use for: OOP class structures, inheritance hierarchies, domain models.

classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal : +int age
    Animal : +String gender
    Animal : +isMammal() bool
    Duck : +swim()
    Fish : +canEat() bool

Members: Bracket syntax Class { +method() returnType; -field type }. Visibility: + public, - private, # protected, ~ internal. Classifiers: * abstract, $ static.

Relationships: <|-- inheritance, *-- composition, o-- aggregation, --> association, ..> dependency, ..|> realization

Cardinality: ClassA "1" --> "*" ClassB

Annotations: <<Interface>>, <<Abstract>>, <<Enumeration>>, <<Service>>

Generics: List~int~

Namespaces: `namespace Name { c

Полный SKILL.md на GitHub

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

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

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

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

  • tools/validate.sh

FAQ

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

Must read guide on creating/editing mermaid charts with validation tools and syntax reference for all diagram types

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

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

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

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

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

Сравнить mermaid с