mermaid
Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Best use case
mermaid is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "mermaid" skill to help with this workflow task. Context: Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/mermaid/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How mermaid Compares
| Feature / Agent | mermaid | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guide for creating beautiful Mermaid diagrams with proper styling for GitHub markdown (dark/light mode compatible, no icons).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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
1. **Use dark fills with light strokes** — Ensures readability in both light and dark mode
2. **Set subgraph fills to `none`** — Allows subgraphs to adapt to any background
3. **Use rounded shapes** — `([text])` for stadium shapes, `((text))` for circles
4. **No Font Awesome icons** — GitHub doesn't support `fa:fa-*` icons, they render as text
5. **Quote subgraph labels** — Use `subgraph Name["Label Text"]` syntax
6. **Define classDef styles at the top** — Keep all styling together for maintainability
## 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:
```mermaid
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.
## Subgraph Syntax
### ❌ WRONG — Causes parse error
```mermaid
subgraph MyGroup [Label With Spaces]
```
### ✅ CORRECT — Quote the label
```mermaid
subgraph MyGroup["Label With Spaces"]
```
## Node Shapes
### ❌ WRONG — Square brackets are harsh
```mermaid
A[Square Node]
```
### ✅ CORRECT — Use rounded shapes
```mermaid
A(["Stadium shape"]) %% Rounded ends - use for most nodes
B((Circle)) %% Circle - use for users/actors
C{{"Decision"}} %% Hexagon for decisions
D[(Database)] %% Cylinder for databases/storage
```
## Subgraph Styling
### ❌ WRONG — Coloured fills break in dark mode
```mermaid
style MySubgraph fill:#f0f9ff,stroke:#3182ce
```
### ✅ CORRECT — Transparent fills adapt to any background
```mermaid
style MySubgraph fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6
```
**Key points:**
- `fill:none` makes the background transparent
- `stroke-dasharray:5 5` creates a dashed border (optional, looks clean)
- `color:#...` sets the subgraph label colour to match the border
## Link Styling
```mermaid
A --> B %% Solid arrow
A -.-> B %% Dashed arrow
A -.->|Label| B %% Dashed arrow with label
A ==> B %% Thick arrow
```
## Complete Example
```mermaid
flowchart TD
classDef user fill:#374151,stroke:#d1d5db,stroke-width:2px,color:#fff
classDef process fill:#5b21b6,stroke:#ddd6fe,stroke-width:2px,color:#fff
classDef decision fill:#c2410c,stroke:#fed7aa,stroke-width:2px,color:#fff
classDef success fill:#047857,stroke:#a7f3d0,stroke-width:2px,color:#fff
User((User)):::user
User --> Request(["Makes request"]):::user
Request --> Process
subgraph Process["Processing"]
direction TB
Validate(["Validate input"]):::process
Execute(["Execute logic"]):::process
Validate --> Execute
end
Execute --> Check{{"Success?"}}:::decision
Check -->|Yes| Done(["Complete"]):::success
Check -->|No| Request
style Process fill:none,stroke:#8b5cf6,stroke-width:2px,stroke-dasharray:5 5,color:#8b5cf6
```
## Common Mistakes
### ❌ Font Awesome icons (GitHub doesn't support them)
```mermaid
A[fa:fa-user User] %% Renders as literal text
```
### ❌ Light fills with dark text
```mermaid
classDef bad fill:#ffffff,stroke:#000000,color:#000000 %% Invisible in dark mode
```
### ❌ Coloured subgraph fills
```mermaid
style Sub fill:#e0f2fe %% Looks different in light vs dark mode
```
### ❌ Unquoted subgraph labels with spaces
```mermaid
subgraph Sub [My Label] %% Parse error!
```
## Quick Reference
```mermaid
flowchart TD
%% 1. Define styles: dark fill + light stroke + white text
classDef myStyle fill:#DARK,stroke:#LIGHT,stroke-width:2px,color:#fff
%% 2. Use rounded shapes
Node(["Text"]):::myStyle
%% 3. Quote subgraph labels
subgraph Sub["My Label"]
Inner(["Inner"])
end
%% 4. Style subgraphs with fill:none
style Sub fill:none,stroke:#COLOR,stroke-width:2px,color:#COLOR
```
## When to Use This Skill
Invoke this skill when creating:
- Architecture diagrams for PRs
- System flow documentation
- Data pipeline visualisations
- Process flowcharts
- Any diagram in GitHub markdown
## GitHub-Specific Notes
1. **No Font Awesome** — GitHub's Mermaid renderer doesn't support FA icons
2. **No HTML** — Can't use `<br>` or other HTML in node labels
3. **Quote labels with spaces** — `subgraph X["Label"]` not `subgraph X [Label]`
4. **Test locally** — Use [mermaid.live](https://mermaid.live) to preview before committingRelated Skills
mermaid-diagrams
Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts, gantt charts, or any other diagram type. Triggers include requests to "diagram", "visualize", "model", "map out", "show the flow", or when explaining system architecture, database design, code structure, or user/application flows.
mermaid-expert
Create Mermaid diagrams for flowcharts, sequences, ERDs, and architectures. Masters syntax for all diagram types and styling. Use PROACTIVELY for visual documentation, system diagrams, or process flows.
mermaid-diagramming
Create Mermaid diagrams in Obsidian including flowcharts, sequence diagrams, class diagrams, and more. Use when visualizing processes, system architectures, workflows, or any structured relationships in Obsidian notes.
mermaid-flowchart
Flowcharts are composed of **nodes** (geometric shapes) and **edges** (arrows or lines). The Mermaid code defines how nodes and edges are made and accommodates different arrow types, multi-directional arrows, and any linking to and from subgraphs.
azure-quotas
Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".
raindrop-io
Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.
zlibrary-to-notebooklm
自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。
discover-skills
当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。
web-performance-seo
Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.
project-to-obsidian
将代码项目转换为 Obsidian 知识库。当用户提到 obsidian、项目文档、知识库、分析项目、转换项目 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入规则(默认到 00_Inbox/AI/、追加式、统一 Schema) 3. 执行 STEP 0: 使用 AskUserQuestion 询问用户确认 4. 用户确认后才开始 STEP 1 项目扫描 5. 严格按 STEP 0 → 1 → 2 → 3 → 4 顺序执行 【禁止行为】: - 禁止不读 SKILL.md 就开始分析项目 - 禁止跳过 STEP 0 用户确认 - 禁止直接在 30_Resources 创建(先到 00_Inbox/AI/) - 禁止自作主张决定输出位置
obsidian-helper
Obsidian 智能笔记助手。当用户提到 obsidian、日记、笔记、知识库、capture、review 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入三条硬规矩(00_Inbox/AI/、追加式、白名单字段) 3. 按 STEP 0 → STEP 1 → ... 顺序执行 4. 不要跳过任何步骤,不要自作主张 【禁止行为】: - 禁止不读 SKILL.md 就开始工作 - 禁止跳过用户确认步骤 - 禁止在非 00_Inbox/AI/ 位置创建新笔记(除非用户明确指定)
internationalizing-websites
Adds multi-language support to Next.js websites with proper SEO configuration including hreflang tags, localized sitemaps, and language-specific content. Use when adding new languages, setting up i18n, optimizing for international SEO, or when user mentions localization, translation, multi-language, or specific languages like Japanese, Korean, Chinese.