mermaid
БесплатноБез исполняемых скриптовНе проверенGuide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
от aiskillstore★ 509 звёзд на GitHubОб этом скилле
Mermaid Diagram Skill
This skill provides guidance on creating beautiful, professional Mermaid diagrams that render correctly on GitHub and work well in both light and dark mode.
Core Principles
- Use dark fills with light strokes — Ensures readability in both light and dark mode
- Set subgraph fills to
none— Allows subgraphs to adapt to any background - Use rounded shapes —
([text])for stadium shapes,((text))for circles - No Font Awesome icons — GitHub doesn't support
fa:fa-*icons, they render as text - Quote subgraph labels — Use
subgraph Name["Label Text"]syntax - Define classDef styles at the top — Keep all styling together for maintainability
- Render and self-check: auto-layout makes its own routing choices, so always preview the rendered image and iterate until the lines are easy to follow
Render, check, and iterate (do this every time)
Writing valid Mermaid is not the goal; producing a diagram a person can actually follow is. Mermaid's auto-layout (dagre) decides where nodes sit and how edges route, so a diagram that looks fine in source often renders as spaghetti. Always render it, look at it as a reader, and iterate before you ship.
Render to an image and open it. Mermaid-cli with a dark background mimics GitHub:
npx -y @mermaid-js/mermaid-cli -i diagram.mmd -o diagram.png -b "#0d1117"Put just the Mermaid code in
diagram.mmd(the diagram only, no surrounding fence markers). mermaid.live works for a quick paste-and-preview too.Judge it as a reader, not the author:
- Is the start obvious, and the end?
- Can you trace every arrow from tail to head without losing it in a crossing?
- Are related nodes near each other, and does nothing float unconnected?
If the lines tangle, fix the layout, not just the colours. Techniques that work:
- Lay the main flow out as lanes (
flowchart LRwithdirection TBinside each subgraph) so it reads start-to-end in one direction. - Cut secondary edges that create a web (test-coverage arrows, every cross-reference). Show the primary flow and put the rest in prose.
- Keep nodes beside what uses them (data models right after the code that builds them) so the arrows stay short.
- Anchor a disconnected group with a single link rather than letting it drift to a corner (one "consumed later" edge beats a floating node).
- Route cross-cutting concerns (errors, logging) to one node with as few edges as possible.
- Lay the main flow out as lanes (
Re-render and repeat until it is easy to follow. A diagram you need the legend to trace is not done.
The Golden Rule: Dark Fills + Light Strokes
The key insight for dark/light mode compatibility:
classDef myStyle fill:#DARK_COLOUR,stroke:#LIGHT_COLOUR,stroke-width:2px,color:#fff
- Fill: Use a darker shade (the node background)
- Stroke: Use a lighter shade of the same colour family (the border)
- Color: Always
#fff(white text on dark background)
This approach ensures nodes are readable regardless of the page background.
GitHub-Compatible Template
This is the canonical template for GitHub-rendered Mermaid diagrams:
flowchart TD
%% --- COLOUR PALETTE & STYLING ---
%% Dark fills + light strokes = readable in both light and dark mode
classDef user fill:#374151,stroke:#d1d5db,stroke-width:2px,color:#fff
classDef primary fill:#5b21b6,stroke:#ddd6fe,stroke-width:2px,color:#fff
classDef secondary fill:#1e40af,stroke:#bfdbfe,stroke-width:2px,color:#fff
classDef accent fill:#c2410c,stroke:#fed7aa,stroke-width:2px,color:#fff
classDef success fill:#047857,stroke:#a7f3d0,stroke-width:2px,color:#fff
%% --- NODES ---
User((User)):::user
User --> Action(["Performs action"]):::user
Action --> Primary
subgraph Primary["Primary Component"]
direction TB
Step1(["Step 1"]):::primary
Step2(["Step 2"]):::primary
Step1 --> Step2
end
subgraph Secondary["Secondary Component"]
direction TB
Process(["Process"]):::secondary
end
Primary --> Secondary
Secondary --> Output(["Output"]):::success
%% --- SUBGRAPH STYLES ---
%% fill:none allows subgraphs to adapt to any background
style Primary fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6
style Secondary fill:none,stroke:#3b82f6,stroke-width:2px,color:#3b82f6
Colour Pairing Examples
Choose any colours you like — just follow the dark fill + light stroke pattern:
| Fill (Dark) | Stroke (Light) | Result |
|---|---|---|
#374151 |
#d1d5db |
Grey |
#5b21b6 |
#ddd6fe |
Purple |
#1e40af |
#bfdbfe |
Blue |
#c2410c |
#fed7aa |
Orange |
#047857 |
#a7f3d0 |
Green |
#b91c1c |
#fecaca |
Red |
#0f766e |
#99f6e4 |
Teal |
These are just examples. Use whatever colours suit your diagram — the principle is what matters.
Sub
Установить mermaid в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл mermaid?
Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Как установить скилл mermaid?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mermaid запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set 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…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic