mermaid
Must read guide on creating/editing mermaid charts with validation tools and syntax reference for all diagram types
от 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.svgis omitted, the SVG is rendered to a temp file and discarded.
Workflow (short)
- Choose a descriptive filename for the diagram (from the argument or derived from the subject). Use kebab-case with
.mmdextension. - Write the Mermaid source to that file in the project root (or the path given).
- Run
.agents/skills/mermaid/tools/validate.sh <filename.mmd>. - Fix any errors shown by the CLI.
- 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.
- 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 ... endalt text ... else ... endopt text ... endpar [Action 1] ... and [Action 2] ... endcritical [text] ... option [text] ... endbreak [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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- 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 запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…