mermaid
npx skills add https://github.com/partme-ai/full-stack-skills --skill mermaid
Agent 安装分布
Skill 文档
When to use this skill
ALWAYS use this skill when the user mentions:
- Drawing, creating, generating, making, or building any diagram, chart, or graph
- Visualizing processes, workflows, systems, architectures, or data
- Any request to “ç»å¾” (draw diagram), “ç»å¾” (draw chart), “çæå¾” (generate diagram), “å建徔 (create diagram)
- Flowcharts, sequence diagrams, class diagrams, state diagrams, or any diagram type
- Architecture diagrams, system diagrams, or design diagrams
- Data visualization, charts, or graphs
- Process flows, workflows, or business processes
- Project timelines, schedules, or Gantt charts
- User journeys, mindmaps, or hierarchical structures
- Database schemas, ER diagrams, or entity relationships
- Git branching structures or version control diagrams
- Any visual representation or diagrammatic content
Trigger phrases include:
- “ç»ä¸ä¸ªå¾” (draw a diagram), “ç»æµç¨å¾” (draw flowchart), “ç»æ¶æå¾” (draw architecture diagram)
- “å建ä¸ä¸ªå¾è¡¨” (create a chart), “çæä¸ä¸ªå¾” (generate a diagram)
- “帮æç»” (help me draw), “ç»æç»” (draw for me), “ç»åºæ¥” (draw it out)
- “ç¨å¾è¡¨ç¤º” (represent with diagram), “å¯è§å” (visualize), “ç»ä¸ªå¾è¯´æ” (draw a diagram to explain)
- “æµç¨å¾” (flowchart), “æ¶åºå¾” (sequence diagram), “类徔 (class diagram), “ç¶æå¾” (state diagram)
- “æ¶æå¾” (architecture diagram), “ç³»ç»å¾” (system diagram), “设计徔 (design diagram)
- “çç¹å¾” (Gantt chart), “æç»´å¯¼å¾” (mindmap), “æ¶é´çº¿” (timeline)
- “ç¨ Mermaid” (use Mermaid), “Mermaid ç»å¾” (draw with Mermaid), “Mermaid è¯æ³” (Mermaid syntax)
- Any mention of “diagram”, “chart”, “graph”, “flowchart”, “visualization”, “drawing”, “Mermaid”
IMPORTANT: Mermaid vs PlantUML – Two Different Diagramming Tools:
Mermaid and PlantUML are two different diagramming tools with different purposes:
-
Mermaid: A JavaScript-based diagramming tool designed for Markdown documentation. It uses Markdown-inspired syntax and renders directly in Markdown renderers (GitHub, GitLab, wikis, blogs). Best for quick diagrams, Markdown documentation, and simple visualizations. Output format is fenced Markdown code blocks with the
mermaidlanguage tag. -
PlantUML: A component that allows you to create various UML diagrams through simple textual descriptions. It focuses on UML standards and complex system architecture. Best for UML diagrams, enterprise architecture, C4 models, and diagrams requiring precise UML notation. Output format is
@startuml/@endumlblocks or.pumlfiles.
When both PlantUML and Mermaid skills are matched:
- If the user explicitly mentions “Mermaid” or “Markdown diagram”, use this skill (Mermaid)
- If the user explicitly mentions “PlantUML”, “UML diagram”, or “C4 model”, use the PlantUML skill instead
- If the user references Markdown contexts (README, wiki, GitHub/GitLab, blog), default to Mermaid
- If the user references UML standards or
.puml, default to PlantUML - If the user mentions both or neither, ALWAYS ask the user to choose: “I can create this diagram using either Mermaid (Markdown code block) or PlantUML (@startuml). Which output format do you prefer?”
How to use this skill
CRITICAL: Mermaid is a Markdown-focused diagramming tool. This skill should be triggered when the user explicitly mentions “Mermaid”, needs diagrams for Markdown documentation, or wants diagrams that render directly in Markdown renderers (GitHub, GitLab, wikis, blogs).
Trigger this skill when you see:
- User says “ç¨ Mermaid” (use Mermaid), “Mermaid ç»å¾” (draw with Mermaid), “Markdown å¾” (Markdown diagram)
- User needs diagrams for Markdown documentation, GitHub, GitLab, wikis, or blogs
- User wants quick diagrams that render directly in Markdown renderers
- User mentions any diagram type for Markdown: flowchart, sequence diagram, class diagram, etc.
- User wants to visualize, represent, or illustrate something with a diagram in Markdown format
When both PlantUML and Mermaid are matched, ALWAYS ask the user to choose the output format or tool, as they are two different diagramming tools with different purposes.
To create a Mermaid diagram:
-
Identify the diagram type from the user’s request:
- Flowchart/flow chart/æµç¨å¾ â
flowchartorgraph - Sequence diagram/æ¶åºå¾ â
sequenceDiagram - Class diagram/ç±»å¾ â
classDiagram - State diagram/ç¶æå¾ â
stateDiagramorstateDiagram-v2 - Entity relationship diagram/å®ä½å
³ç³»å¾ â
erDiagram - User journey/ç¨æ·æ
ç¨å¾ â
journey - Gantt chart/çç¹å¾ â
gantt - Pie chart/é¥¼å¾ â
pie - Quadrant chart/象éå¾ â
quadrantChart - Requirement diagram/éæ±å¾ â
requirementDiagram - Git graph/Gitå¾ â
gitGraph - C4 diagram/C4å¾ â
C4Context,C4Container,C4Component,C4Deployment, orC4Dynamic - Mindmap/æç»´å¯¼å¾ â
mindmap - Timeline/æ¶é´çº¿å¾ â
timeline - ZenUML/ç¦
UML â
zenuml - Sankey diagram/æ¡åºå¾ â
sankey - XY chart/XYå¾ â
xychart - Block diagram/æ¹åå¾ â
block - Packet diagram/æ°æ®å
å¾ â
packet - Kanban/çæ¿å¾ â
kanban - Architecture diagram/æ¶æå¾ â
architecture-beta(requires Mermaid v11.1.0+) - Radar chart/é·è¾¾å¾ â
radar-beta(requires Mermaid v11.1.0+) - Treemap/æ ç¶å¾ â
treemap-beta(requires Mermaid v11.1.0+)
- Flowchart/flow chart/æµç¨å¾ â
-
Load the appropriate example file from the
examples/directory:examples/flowchart.md– For flowcharts and process diagramsexamples/sequence.md– For sequence diagrams showing interactionsexamples/class.md– For class diagrams and object-oriented designsexamples/state.md– For state diagrams and state machinesexamples/er.md– For entity relationship diagramsexamples/journey.md– For user journey mapsexamples/gantt.md– For Gantt charts and project timelinesexamples/pie.md– For pie chartsexamples/quadrant.md– For quadrant chartsexamples/requirement.md– For requirement diagramsexamples/gitgraph.md– For Git branching diagramsexamples/c4.md– For C4 architecture diagramsexamples/mindmap.md– For mindmapsexamples/timeline.md– For timeline diagramsexamples/zenuml.md– For ZenUML diagramsexamples/sankey.md– For Sankey flow diagramsexamples/xychart.md– For XY charts (bar/line charts)examples/block.md– For block diagramsexamples/packet.md– For packet diagramsexamples/kanban.md– For Kanban boardsexamples/architecture.md– For architecture diagramsexamples/radar.md– For radar chartsexamples/treemap.md– For treemap diagrams
-
Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- Beta diagram types (
architecture-beta,radar-beta,treemap-beta) require Mermaid v11.1.0 or higher - If the rendering environment doesn’t support beta diagram types, use the flowchart alternatives provided in the example files
- Always check the example file for version compatibility notes and alternative syntax options
- Beta diagram types (
-
Generate the Mermaid code wrapped in a Markdown code block with proper syntax highlighting:
IMPORTANT: Always wrap the Mermaid code in a Markdown code block with
mermaidlanguage tag. This ensures the format is preserved when users copy the content.Example format (use actual Mermaid syntax, not placeholders):
flowchart TD A[Start] --> B[Process] B --> C[End]Output Format Requirements:
- Always use triple backticks (“`) with
mermaidlanguage tag - Never output raw Mermaid code without code block markers
- The code block must be complete and properly formatted
- Use actual valid Mermaid syntax, not placeholders like
<diagram-type>or...diagram content... - This ensures users can copy the code without losing formatting
- Always use triple backticks (“`) with
-
Include styling and configuration when needed:
- Use
%%{ init: { theme: 'base' } }%%for theme configuration - Apply
styledirectives for node styling - Use
classDeffor reusable style classes
- Use
-
Validate the syntax:
- Ensure all required elements are present
- Check that relationships and connections are properly defined
- Verify date formats for Gantt charts (YYYY-MM-DD)
- Confirm data formats for charts (pie, quadrant, etc.)
- For ER diagrams: Use underscores instead of hyphens in entity names (e.g.,
LINE_ITEMnotLINE-ITEM) - For flowcharts: Avoid using “end” as a node label (use “End” or “END” instead)
- For class diagrams: Escape special characters in labels using backticks
- Check version compatibility for beta diagram types
-
Save the diagram to project directory:
- Default behavior: When generating a Mermaid diagram, save it to the current project directory
- Recommended locations:
docs/diagrams/– For documentation diagramsdocs/– For general documentationdiagrams/– For standalone diagram files- Current directory (
.) – If no specific directory structure exists
- File naming: Use descriptive names like
system-architecture.md,user-flow.md,database-schema.md, etc. - File format: Save as
.mdfile with the Mermaid code block inside - Example: If user requests a system architecture diagram, save it as
docs/diagrams/system-architecture.mdordiagrams/system-architecture.md - Ask if needed: If the project structure is unclear, ask the user where they’d like the diagram saved, but default to creating a
docs/ordiagrams/directory if it doesn’t exist
Output Format and File Saving:
When generating a diagram, follow this response structure:
-
Save the file first: Create the diagram file in the project directory (e.g.,
docs/diagrams/system-architecture.md) -
Inform the user: Tell them where the file was saved
-
Display the diagram: Show the Mermaid code in a properly formatted Markdown code block with
mermaidlanguage tag
Example Response Structure:
- First line: “I’ve created the Mermaid diagram and saved it to
docs/diagrams/system-architecture.md.” - Then show the diagram wrapped in a code block:
- Start with: three backticks +
mermaid+ newline - Then the Mermaid code
- End with: three backticks + newline
- Start with: three backticks +
Critical Requirements:
- The Mermaid code block MUST ALWAYS be properly formatted with triple backticks (“`) and
mermaidlanguage tag - NEVER output raw Mermaid code without code block markers
- The code block must be complete (opening and closing backticks)
- This ensures users can copy the code without losing formatting
- Always save the diagram file to the current project directory (default:
docs/diagrams/ordiagrams/)
If the diagram type doesn’t match any existing example, refer to the Mermaid documentation or ask the user for clarification about the desired visualization.
Version Compatibility
Some diagram types have specific version requirements:
-
Beta diagram types (require Mermaid v11.1.0+):
architecture-beta– Architecture diagramsradar-beta– Radar chartstreemap-beta– Treemap diagrams
-
Advanced features (require specific versions):
- Participant types with JSON configuration: Mermaid v10.0.0+
- Actor creation/destruction: Mermaid v10.3.0+
- Edge IDs and curve styles: Mermaid v11.10.0+
- New shapes with
@{}syntax: Mermaid v11.3.0+
If a beta diagram type is not supported, the example files provide flowchart alternatives that work with all Mermaid versions.
Best Practices
- Always use code blocks: Wrap all Mermaid code in Markdown code blocks with
mermaidlanguage tag - Check compatibility: Verify version requirements before using beta diagram types
- Use alternatives: When beta types aren’t supported, use the provided flowchart alternatives
- Follow naming conventions: Avoid reserved keywords and special characters in node labels
- Test syntax: Validate diagram syntax before saving to ensure proper rendering
- Organize files: Save diagrams in appropriate directories (
docs/diagrams/ordiagrams/) - Use descriptive names: Name diagram files clearly (e.g.,
system-architecture.md,user-flow.md)
Mermaid vs PlantUML – Key Differences
Mermaid (This Skill):
- Purpose: JavaScript-based diagramming tool designed for Markdown documentation
- Main Use Case: Help documentation catch up with development
- Best For:
- Markdown documents, GitHub, GitLab, wikis, blogs
- Quick diagrams that render directly in Markdown renderers
- Simple flowcharts, sequence diagrams, basic charts
- Rapid prototyping and iteration
- When the user explicitly requests Mermaid or needs Markdown-compatible diagrams
PlantUML (Different Skill):
- Purpose: Component for creating various UML diagrams through textual descriptions
- Main Use Case: UML-focused diagramming with emphasis on standard UML notation
- Best For:
- Complex UML diagrams requiring precise notation (class, component, deployment diagrams)
- Enterprise architecture diagrams and C4 model diagrams
- Standard UML compliance requirements
- Diagrams requiring advanced customization, styling, or layout control
- When the user explicitly requests PlantUML or UML diagrams
When Both Skills Are Matched:
- ALWAYS ask the user to choose: “I can create this diagram using either Mermaid or PlantUML. Mermaid is a JavaScript-based tool designed for Markdown documentation and renders directly in GitHub/GitLab. PlantUML is focused on UML diagrams and enterprise architecture. Which would you prefer?”
- These are two different diagramming tools with different purposes – do not automatically choose one
- If the user explicitly mentions one tool, use that tool
- If the user mentions both or neither, ask the user to choose based on their needs
Keywords
English keywords: mermaid, diagram, chart, graph, flowchart, flow chart, sequence diagram, class diagram, state diagram, entity relationship, ER diagram, user journey, Gantt chart, pie chart, quadrant chart, requirement diagram, Git graph, C4 diagram, mindmap, timeline, ZenUML, Sankey diagram, XY chart, block diagram, packet diagram, Kanban, architecture diagram, radar chart, treemap, draw, create, generate, make, build, visualize, visualization, drawing, plotting, mapping, schematics, blueprint, design diagram, system diagram, process flow, workflow, data visualization, visual representation
Chinese keywords (ä¸æå ³é®è¯): æµç¨å¾, æ¶åºå¾, ç±»å¾, ç¶æå¾, å®ä½å ³ç³»å¾, ç¨æ·æ ç¨å¾, çç¹å¾, 饼å¾, 象éå¾, éæ±å¾, Gitå¾, C4å¾, æç»´å¯¼å¾, æ¶é´çº¿å¾, æ¡åºå¾, XYå¾, æ¹åå¾, æ°æ®å å¾, çæ¿å¾, æ¶æå¾, é·è¾¾å¾, æ ç¶å¾, ç»å¾, ç»å¾, çæå¾, å建å¾, å¶ä½å¾, ç»æµç¨å¾, ç»æ¶æå¾, ç»æ¶åºå¾, ç»ç±»å¾, ç»ç¶æå¾, ç»çç¹å¾, ç»æç»´å¯¼å¾, ç»æ¶é´çº¿, å¯è§å, å¾è¡¨, å¾å½¢, 示æå¾, 设计å¾, ç³»ç»å¾, æµç¨å¾, æ¶æå¾, æ¶åºå¾, ç±»å¾, ç¶æå¾, çç¹å¾, æç»´å¯¼å¾, æ¶é´çº¿, ç¨å¾è¡¨ç¤º, ç»åºæ¥, ç»æç», 帮æç», ç»ä¸ä¸ª, å建ä¸ä¸ªå¾, çæä¸ä¸ªå¾, ç»ä¸ªå¾è¯´æ, ç¨å¾è¡¨å±ç¤º, å¯è§åå±ç¤º