AgentSkillsCN

mermaid-diagram

为视觉文档生成结构清晰的 Mermaid 图表。适用于系统设计、工作流程文档化、架构图绘制,或任何需要以可视化方式呈现流程、关系或结构的任务时使用。触发条件包括“创建图表”、“将此内容可视化”、“展示流程”、“绘制架构”,或在解释需要借助视觉辅助工具的复杂系统时使用。

SKILL.md
--- frontmatter
name: mermaid-diagram
description: Generate well-structured Mermaid diagrams for visual documentation. Use when designing systems, documenting workflows, creating architecture diagrams, or any task requiring visual representation of processes, relationships, or structures. Triggers include requests like "create a diagram", "visualize this", "show the flow", "draw the architecture", or when explaining complex systems that benefit from visual aids.

Mermaid Diagram

Generate proper, well-structured Mermaid diagrams for visual documentation and design presentations.

Diagram Selection

NeedDiagramReference
Process flow, decisionsFlowchartflowchart.md
API/service interactionsSequencesequence.md
Object-oriented designClassclass.md
Database schemaER Diagramer.md
State machines, lifecyclesStatestate.md
Software architecture (C4)C4c4.md
Cloud/infrastructureArchitecturearchitecture.md
Brainstorming, conceptsMindmapmindmap.md
Timelines, charts, gitOtherother-diagrams.md

Quick Examples

Flowchart

mermaid
flowchart TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Action]
    B -->|No| D[Other]
    C --> E[End]
    D --> E

Sequence

mermaid
sequenceDiagram
    Client->>+API: Request
    API->>DB: Query
    DB-->>API: Data
    API-->>-Client: Response

Class

mermaid
classDiagram
    class Animal {
        +String name
        +makeSound()
    }
    Animal <|-- Dog
    Animal <|-- Cat

ER

mermaid
erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ ITEM : contains

Best Practices

  1. Choose the right diagram - Match diagram type to what you're representing
  2. Keep it readable - Limit nodes, use clear labels, avoid crossing lines
  3. Use direction - LR for wide diagrams, TD for tall ones
  4. Group related items - Use subgraphs, boundaries, or namespaces
  5. Add context - Use notes and labels to explain non-obvious elements
  6. Style sparingly - Only highlight what needs attention

Output Format

Always wrap diagrams in fenced code blocks:

code
```mermaid
flowchart LR
    A --> B
```

Consult the appropriate reference file for detailed syntax before generating complex diagrams.