mermaid-syntax
Skill1 starsChanged 54 days agoMITView on GitHub
Correct Mermaid diagram syntax reference covering all types (flowchart, sequence, class, ERD, state, C4, git, gantt, pie). Emphasizes parser-compatible patterns to avoid rendering errors in GitHub, Obsidian, VS Code, and other tools. Use when creating, visualizing, or documenting software architecture through diagrams.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- tractorjuice/arckit-claudetheir own version, first seen Sep 3, 2026
- notfolder/isddtheir own version, first seen May 30, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- tractorjuice/arckit-claude★ 5same name
- notfolder/isdd★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- journal-coachSkill
- github-templatesSkill
- node-ciSkill
- renovateSkill
- create-readmeSkill
- markdown-styleSkill
- obsidian-vaultSkill
- ste100Skill
- forge-detectSkill
- forgejo-issueSkill
- forgejo-prSkill
- web-frontendSkill
- docker-pythonSkill
- pyproject-tomlSkill
- python-ciSkill
- python-cliSkill
- python-devcontainerSkill
- python-projectSkill
- architecture-briefSkill
- design-advisorSkill
- saas-anti-pattern-reviewSkill
- saas-transition-chain-reviewSkill
- saas-transition-reviewSkill
- saas-transition-strategySkill
- security-reviewerSkill
- technical-debt-reviewSkill
- commit-messageSkill
- discord-sendSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Subgraphs: use subgraph "Title" — NOT subgraph ID["Title"] (named subgraphs require mermaid ≥10.3)
- Very specific: line 19
Diamond nodes: always give an explicit ID — DECISION{"text"} — NOT anonymous {"text"} after -->
- Distinctive: line 26
Every diagram starts with a type declaration on the first line:
- Very specific: line 39
Use %% for comments. Indentation improves readability but isn't required.
- Distinctive: line 73
Always use quoted titles:
- Very specific: line 322
Unclosed brackets: every [, (, { needs a matching closing bracket
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mermaid Syntax Reference
Syntax Compatibility Rules
These 5 rules prevent parser errors across common rendering tools (GitHub, Obsidian, VS Code extensions):
- Subgraphs: use
subgraph "Title"— NOTsubgraph ID["Title"](named subgraphs require mermaid ≥10.3) - Diamond nodes: always give an explicit ID —
DECISION{"text"}— NOT anonymous{"text"}after--> - Line breaks:
\nworks inside["text"]; avoid\ninside{"text"}— keep diamond labels single-line - Sequence notes: plain text only — no
<br/>,<br>, or other HTML tags - Special characters: replace
&withandto avoid HTML entity issues
Core Syntax
Every diagram starts with a type declaration on the first line:
flowchart LR
sequenceDiagram
classDiagram
erDiagram
stateDiagram-v2
gitGraph
gantt
pieUse %% for comments. Indentation improves readability but isn't required.
Flowchart
Node shapes
| Syntax | Shape |
A[text] | Rectangle |
A(text) | Rounded rectangle |
A([text]) | Stadium / pill |
A[[text]] | Subroutine |
A[(text)] | Database / cylinder |
A((text)) | Circle |
A{text} | Rhombus / decision |
A{{text}} | Hexagon |
A>text] | Asymmetric / flag |
A[/text/] | Parallelogram |
A[\text\] | Parallelogram (reverse) |
A[/text\] | Trapezoid |
Edges
| Syntax | Type |
A --> B | Arrow |
A --- B | Link (no arrow) |
A -.-> B | Dotted arrow |
A ==> B | Thick arrow |
A -->|label| B | Labeled arrow (preferred) |
A -- label --> B | Labeled arrow (alt) |
Subgraphs
Always use quoted titles:
flowchart LR
subgraph "Group Name"
A --> B
endExample
flowchart TD
Start([Start]) --> Auth{Authenticated?}
Auth -->|Yes| Dashboard[Show dashboard]
Auth -->|No| Login[Show login form]
Login --> AuthSequence Diagram
Participants
sequenceDiagram
participant A
participant B as "Display Name"
actor UserMessages
| Syntax | Type |
->> | Synchronous call |
-->> | Synchronous response |
-) | Asynchronous call |
--) | Asynchronous response |
-x | Delete / loss |
Structure blocks
sequenceDiagram
participant A
participant B
alt Condition
A->>B: branch
else Other
A->>B: other branch
end
opt Optional
A->>B: optional
end
loop Every N seconds
A->>B: repeat
end
par Parallel
A->>B: parallel 1
and
A->>B: parallel 2
endNotes
Plain text only — no HTML tags:
sequenceDiagram
participant App
Note over App: Plain text description
Note right of App: Plain text
Note left of App: Plain textExample
sequenceDiagram
participant App
participant DB
App->>DB: Query
DB-->>App: Result
alt Found
App->>App: Process
else Not found
App->>App: Handle error
end
Note over App: Plain text onlyClass Diagram
Class declaration
classDiagram
class ClassName {
+publicField
-privateField
#protectedField
+method() returnType
-method() void
}Relationships
| Syntax | Relationship |
<|-- | Inheritance |
*-- | Composition |
o-- | Aggregation |
--> | Association |
..|> | Realization |
..> | Dependency |
-- | Link |
Multiplicity: "1" --> "*"
Example
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +isMammal() bool
Duck : +beakColor string
Duck : +swim()Entity-Relationship Diagram
Cardinality
| Symbol | Meaning |
|o | Zero or one |
|| | Exactly one |
}o | Zero or more |
}| | One or more |
Example
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : includes
CUSTOMER {
int id PK
string name
}
ORDER {
int id PK
decimal total
}State Diagram
stateDiagram-v2
[*] --> Idle
Idle --> Processing : start
Processing --> Completed : finish
Processing --> Failed : error
Failed --> Idle : retry
Completed --> [*]Composite states:
stateDiagram-v2
state Active {
[*] --> Working
Working --> Waiting
Waiting --> Working
}C4 Diagram
C4Context
Person(user, "Customer", "Bank customer")
System(bankingSystem, "Banking System", "Handles accounts")
System_Ext(mail, "Email System")
Rel(user, bankingSystem, "Uses")
Rel(bankingSystem, mail, "Sends emails")Other levels: C4Container, C4Component, C4Deployment.
Boundaries: System_Boundary(name, "Label") { ... }, Container_Boundary, etc.
Git Graph
gitGraph
commit
branch feature
checkout feature
commit
checkout main
merge featureGantt Chart
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Design
Research :2024-01-01, 30d
Prototype :2024-01-15, 20d
section Dev
Backend :2024-02-01, 45d
Frontend :2024-02-15, 30dPie Chart
pie title Distribution
"Category A" : 45
"Category B" : 30
"Category C" : 25Common Pitfalls
- Subgraph syntax:
subgraph Name["Label"]fails in many renderers — usesubgraph "Label"instead - Anonymous diamond nodes:
-->{"text"}causes parse errors — use--> DECISION{"text"}with an explicit ID - HTML in sequence notes:
<br/>renders literally — use plain text \nin diamonds:{"line1\nline2"}is not supported — keep text single-line&character: triggers HTML entity issues — writeandinstead- Unclosed brackets: every
[,(,{needs a matching closing bracket - Unknown words: misspellings break diagrams; validate at https://mermaid.live
Best Practices
- Start simple — build up complexity incrementally
- Use action-oriented labels — "Process payment" not "Payment"
- One concept per diagram — split complex systems into focused views
- Validate syntax — test in mermaid.live before committing
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

