mermaid-diagrams

v2026.09.24

Mermaid diagram syntax for flowcharts, sequence diagrams, ERDs, class diagrams, and more. Use when creating diagrams in markdown, generating architecture visuals, or documenting system flows. Use for mermaid, diagram, flowchart, sequence, ERD, class-diagram, gantt, pie-chart, mindmap.

GitHub
安装命令
npx skhub add oakoss/mermaid-diagrams
Markdown
SKILL.md

Mermaid Diagrams

Overview

Mermaid is a JavaScript-based diagramming tool that renders Markdown-inspired text definitions into SVG diagrams. It supports flowcharts, sequence diagrams, ER diagrams, class diagrams, state diagrams, Gantt charts, pie charts, mindmaps, and git graphs directly inside Markdown files.

When to use: Documenting system architecture, visualizing data models, illustrating request flows, creating project timelines, embedding diagrams in GitHub/GitLab READMEs or docs sites.

When NOT to use: Pixel-perfect design mockups, interactive dashboards, diagrams requiring custom artwork or complex spatial layouts beyond hierarchical/relational structures.

Quick Reference

DiagramDeclarationKey Points
Flowchartflowchart TDDirections: TB, TD, BT, RL, LR. Supports subgraphs
SequencesequenceDiagramParticipants, messages, loops, alt/opt/par blocks
ER DiagramerDiagramCrow's foot notation, PK/FK/UK attributes
Class DiagramclassDiagramUML relationships, visibility modifiers, annotations
State DiagramstateDiagram-v2Transitions, composite states, forks/joins, choice
Gantt ChartganttSections, tasks with dates/durations, milestones
Pie ChartpieLabels with numeric values, optional title
MindmapmindmapIndentation-based hierarchy, multiple node shapes
Git GraphgitGraphCommits, branches, merges, cherry-picks, tags
Architecturearchitecture-betaServices in groups, directional edges (T/B/L/R)
Block Diagramblock-betaColumn layout, block arrows, nested blocks
TimelinetimelineTime periods with events, sections for grouping
Sankeysankey-betaFlow quantities between nodes, CSV-like data format
XY Chartxychart-betaBar and line charts with x/y axes
Quadrant ChartquadrantChartFour-quadrant plot with labeled axes and data points
KanbankanbanColumns with task cards, assignees, priorities
Packetpacket-betaNetwork packet structure with bit-range fields
RequirementrequirementDiagramRequirements, elements, and verification links
C4 DiagramC4ContextC4 model: Context, Container, Component, Deployment

Common Mistakes

MistakeCorrect Pattern
Using graph instead of flowchartUse flowchart for subgraph edges and newer features
Missing space after arrow in sequencesAlice->>Bob: msg not Alice->>Bob:msg
Wrong cardinality order in ER diagramsLeft cardinality, then line, then right cardinality
Forgetting end after subgraph/loop/altEvery block keyword requires a matching end
Using reserved words as node IDsWrap reserved words in quotes or use aliases
Bare code blocks without language tagAlways use ```mermaid as the language specifier
Mixing v1 and v2 state diagram syntaxUse stateDiagram-v2 consistently for current features
Unquoted labels with special charactersWrap labels containing special characters in double quotes
Missing dateFormat in Gantt chartsAlways declare dateFormat before task definitions
Using tabs instead of spaces for mindmapsMindmap indentation requires spaces, not tabs

Delegation

  • Diagram discovery and exploration: Use Explore agent to find existing diagrams in the codebase
  • Diagram review: Use Task agent to verify diagram accuracy against code
  • Architecture documentation: Use code-reviewer agent for doc quality checks

References

发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

2026年9月24日

分类

未分类

许可证

未指定

源路径

skills/mermaid-diagrams

默认分支

main

最新提交

85e3a39

Tree SHA

a4c9e7b