awesome-skills/mermaid-syntax-skill/mermaid-syntax-skill
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks to "create a mermaid diagram", "fix mermaid error", "mermaid syntax error", "diagram not rendering", "flowchart not working", "sequence diagram broken", "escape special characters in mermaid", or mentions "mermaid", "flowchart", "sequence diagram", "class diagram", "state diagram", "ER diagram", "gantt chart". Prevents common syntax errors with special characters, reserved words, escaping rules, and provides v11 syntax support.
Install
npx vskill@latest install awesome-skills/mermaid-syntax-skill/mermaid-syntax-skillSKILL.md
Mermaid Diagram Syntax Guide
Comprehensive syntax reference for generating error-free Mermaid diagrams. Prevents common mistakes and supports Mermaid v11 features including flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, and more.
Test diagrams at: https://mermaid.live/
Prefer `flowchart` over `graph`: Both work, but flowchart is the modern syntax with better feature support.
Critical Rules (Prevent 90% of Errors)
1. Special Character Escaping
Always wrap text containing special characters in double quotes:
Characters requiring quotes: ( ) [ ] { } / \ : ; # @ ! ? < > " '
2. Reserved Words (Not Just "end"!)
Multiple reserved words break diagrams. Use quoted labels with safe IDs:
All reserved words (use quoted labels):
end,defaultstyle,linkStyle,classDef,classcall,href,click,interpolate
Pattern: safeId["reserved word text"] instead of reserved[text]
3. Node ID Starting Characters
Nodes starting with o or x create unintended edge types:
Solution: Use descriptive IDs, avoid single letters o or x at start.
4. HTML Entity Codes for Semicolons
In sequence diagrams, semicolons define line breaks. Use #59; for literal semicolons:
5. Comments Must Use %%
Single % breaks diagrams. Always use %%:
6. Subgraph with HTML Tags
Wrap subgraph titles containing <br/> in quotes:
7. Style Property Escaping
Escape commas in stroke-dasharray with backslash:
8. Frontmatter Must Be First Line
The --- for frontmatter MUST be the only content on line 1:
Wrong: Any whitespace or content before --- breaks the diagram.
9. Mindmap < Character Bug
In mindmaps, < renders as <. Use words instead:
10. Class Diagram Colon Limitations
Colons in class member types are tricky. Use return type syntax:
Note: Complex generic types with colons may not render correctly.
11. Nested Subgraph Linking Bug
Linking to both parent AND nested subgraph causes syntax error:
Workaround: Link to nodes inside subgraphs, not the subgraph ID itself.
12. Subgraph Direction Inheritance
If subgraph nodes link to outside, direction is ignored (inherits parent):
Rule: Subgraph direction only works if all nodes stay internal.
13. v11 Arrowless Edges Bug (v11.0-11.4)
In Mermaid v11.0 to v11.4.x, the --- (line without arrow) syntax is broken and shows arrows:
Fix: Upgrade to Mermaid v11.5.0 or later.
14. v11 Markdown-by-Default Breaking Change
In v11, ALL node labels render as Markdown by default (breaking change from v10):
Note: Only bold (**) and italic (_ or *) are supported. Inline code with backticks may not work.
15. Configuration Limits (Secure Settings)
maxTextSize (default: 50,000 chars) and maxEdges (default: 500) are secure settings that CANNOT be set via frontmatter:
Workaround: These must be set via mermaid.initialize() in JavaScript, not in diagram config.
16. linkStyle Hex Color as Last Attribute Bug
Hex color as the LAST attribute in linkStyle causes parsing error:
Workaround: Put hex color before other attributes, or use CSS color names.
17. Class Diagram Namespace Limitations
Relationships and notes MUST be defined OUTSIDE namespace blocks:
Limitation: Nested namespaces not supported. Use flat structure.
18. Architecture Diagram Label Characters
Architecture node labels only support [a-zA-Z0-9_ ]. Hyphens and special chars break:
Mermaid v11 New Features
Hand-Drawn Look
Bidirectional Arrows (Sequence)
Configuration Directive
Diagram Type Quick Reference
Flowchart Direction
| Syntax | Direction | |
|---|---|---|
flowchart TB | Top to Bottom | |
flowchart TD | Top Down (same as TB) | |
flowchart BT | Bottom to Top | |
flowchart LR | Left to Right | |
flowchart RL | Right to Left |
Node Shapes
| Syntax | Shape | |
|---|---|---|
A[text] | Rectangle | |
A(text) | Rounded rectangle | |
A([text]) | Stadium | |
A[[text]] | Subroutine | |
A[(text)] | Cylinder (database) | |
A((text)) | Circle | |
A{text} | Diamond | |
A{{text}} | Hexagon | |
A>text] | Asymmetric |
Edge Types
| Syntax | Type | |
|---|---|---|
A --> B | Arrow | |
A --- B | Line (no arrow) | |
A -.- B | Dotted line | |
A ==> B | Thick arrow | |
A -.-> B | Dotted arrow | |
A --text--> B | Arrow with text | |
A -- text --- B | Line with text |
Subgraph Syntax
Sequence Diagram Essentials
Message Arrow Types
| Syntax | Description | |
|---|---|---|
A->B | Solid line, no arrow | |
A-->B | Dotted line, no arrow | |
A->>B | Solid line, arrowhead | |
A-->>B | Dotted line, arrowhead | |
A-xB | Solid line, cross end | |
A-)B | Solid line, open arrow (async) |
Participant Definition
Activation
Or explicit:
Control Flow
Notes
Class Diagram Essentials
Class Definition
Visibility Modifiers
| Symbol | Meaning | |
|---|---|---|
+ | Public | |
- | Private | |
# | Protected | |
~ | Package/Internal |
Relationships
| Syntax | Meaning | ||
|---|---|---|---|
| `A <\ | -- B` | Inheritance (B extends A) | |
A *-- B | Composition | ||
A o-- B | Aggregation | ||
A --> B | Association | ||
A ..> B | Dependency | ||
| `A ..\ | > B` | Realization |
Cardinality
State Diagram Essentials
Basic States
Composite States
Choice and Fork
Common Error Patterns
Error 1: Unquoted Special Characters
Error 2: Reserved Word "end"
Error 3: Semicolon in Sequence Diagram
Error 4: Nested Quotes
Error 5: Colon Without Quotes in Flowchart
Other Diagram Types (Quick Start)
ER Diagram
Gantt Chart
Pie Chart
Git Graph
Validation Checklist
Before finalizing any Mermaid diagram:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingSKILL.md
Popularity
- Repository stars
- 13
- Repository forks
- 2
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/awesome-skills/mermaid-syntax-skill/mermaid-syntax-skill)