diagram-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<identity> Diagram Generator Skill - Generates architecture, database, and system diagrams using Mermaid syntax to visualize system structure, relationships, and flows. </identity> <capabilities> - Creating architecture diagrams - Documenting database schemas - Visualizing component relationships - Documenting data flows - Creating sequence diagrams - Generating system overviews </capabilities> <instructions> <execution_process>
<identity> Diagram Generator Skill - 可使用Mermaid语法生成架构图、数据库图和系统图,可视化系统结构、关系与流程。 </identity> <capabilities> - 生成架构图 - 记录数据库schema - 可视化组件关系 - 记录数据流 - 生成时序图 - 产出系统概览 </capabilities> <instructions> <execution_process>

Step 1: Identify Diagram Type

步骤1:确定图表类型

Determine what type of diagram is needed:
  • Architecture Diagram: System structure and components
  • Database Diagram: Schema and relationships
  • Component Diagram: Component interactions
  • Sequence Diagram: Process flows
  • Flowchart: Decision flows
确定需要生成的图表类型:
  • 架构图:展示系统结构与组件
  • 数据库图:展示schema与关联关系
  • 组件图:展示组件交互逻辑
  • 时序图:展示流程流转
  • 流程图:展示决策流

Step 2: Extract Structure

步骤2:提取结构

Analyze code and documentation:
  • Read architecture documents
  • Analyze component structure
  • Extract database schema
  • Identify relationships
  • Understand data flows
分析代码与文档:
  • 阅读架构文档
  • 分析组件结构
  • 提取数据库schema
  • 识别关联关系
  • 理解数据流

Step 3: Generate Mermaid Diagram

步骤3:生成Mermaid图表

Create diagram using Mermaid syntax:
  • Use appropriate diagram type
  • Define nodes and relationships
  • Add labels and descriptions
  • Include styling if needed
使用Mermaid语法创建图表:
  • 选用合适的图表类型
  • 定义节点与关联关系
  • 添加标签与描述
  • 按需增加样式

Step 4: Embed in Documentation

步骤4:嵌入文档

Embed diagram in markdown:
  • Use mermaid code blocks
  • Add diagram description
  • Reference in documentation </execution_process>
<integration> **Integration with Architect Agent**: - Generates architecture diagrams - Documents system structure - Visualizes component relationships
Integration with Database Architect Agent:
  • Generates database schema diagrams
  • Documents table relationships
  • Visualizes data models
Integration with Technical Writer Agent:
  • Embeds diagrams in documentation
  • Creates visual documentation
  • Enhances documentation clarity </integration>
<best_practices>
  1. Use Mermaid: Standard syntax for compatibility
  2. Keep Clear: Simple, readable diagrams
  3. Show Relationships: Include all important connections
  4. Add Labels: Clear node and edge labels
  5. Update Regularly: Keep diagrams current with code </best_practices> </instructions>
<examples> <code_example> **Architecture Diagram**
mermaid
graph TB
    Client[Client Application]
    API[API Gateway]
    Auth[Auth Service]
    User[User Service]
    DB[(Database)]

    Client --> API
    API --> Auth
    API --> User
    User --> DB
    Auth --> DB
</code_example>
<code_example> Database Schema Diagram
mermaid
erDiagram
    USERS ||--o{ ORDERS : places
    USERS {
        uuid id PK
        string email
        string name
    }
    ORDERS ||--|{ ORDER_ITEMS : contains
    ORDERS {
        uuid id PK
        uuid user_id FK
        date created_at
    }
    ORDER_ITEMS {
        uuid id PK
        uuid order_id FK
        uuid product_id FK
        int quantity
    }
</code_example>
<code_example> Component Diagram
mermaid
graph LR
    A[Component A] --> B[Component B]
    A --> C[Component C]
    B --> D[Component D]
    C --> D
</code_example>
<code_example> Sequence Diagram
mermaid
sequenceDiagram
    participant User
    participant API
    participant Auth
    participant DB

    User->>API: Login Request
    API->>Auth: Validate Credentials
    Auth->>DB: Query User
    DB-->>Auth: User Data
    Auth-->>API: JWT Token
    API-->>User: Auth Response
</code_example> </examples>
<examples> <usage_example> **Example Commands**:
undefined
将图表嵌入markdown中:
  • 使用mermaid代码块
  • 添加图表说明
  • 在文档中引用 </execution_process>
<integration> **与Architect Agent集成**: - 生成架构图 - 记录系统结构 - 可视化组件关系
与Database Architect Agent集成
  • 生成数据库schema图
  • 记录表间关联关系
  • 可视化数据模型
与Technical Writer Agent集成
  • 将图表嵌入文档
  • 生成可视化文档
  • 提升文档清晰度 </integration>
<best_practices>
  1. 使用Mermaid:标准语法保证兼容性
  2. 保持简洁:图表简单易读
  3. 体现关联:包含所有重要连接关系
  4. 添加标签:清晰标注节点与边的说明
  5. 定期更新:保证图表与代码同步 </best_practices> </instructions>
<examples> <code_example> **架构图**
mermaid
graph TB
    Client[Client Application]
    API[API Gateway]
    Auth[Auth Service]
    User[User Service]
    DB[(Database)]

    Client --> API
    API --> Auth
    API --> User
    User --> DB
    Auth --> DB
</code_example>
<code_example> 数据库Schema图
mermaid
erDiagram
    USERS ||--o{ ORDERS : places
    USERS {
        uuid id PK
        string email
        string name
    }
    ORDERS ||--|{ ORDER_ITEMS : contains
    ORDERS {
        uuid id PK
        uuid user_id FK
        date created_at
    }
    ORDER_ITEMS {
        uuid id PK
        uuid order_id FK
        uuid product_id FK
        int quantity
    }
</code_example>
<code_example> 组件图
mermaid
graph LR
    A[Component A] --> B[Component B]
    A --> C[Component C]
    B --> D[Component D]
    C --> D
</code_example>
<code_example> 时序图
mermaid
sequenceDiagram
    participant User
    participant API
    participant Auth
    participant DB

    User->>API: Login Request
    API->>Auth: Validate Credentials
    Auth->>DB: Query User
    DB-->>Auth: User Data
    Auth-->>API: JWT Token
    API-->>User: Auth Response
</code_example> </examples>
<examples> <usage_example> **示例命令**:
undefined

Generate architecture diagram

Generate architecture diagram

Generate architecture diagram for the authentication system
Generate architecture diagram for the authentication system

Generate database schema diagram

Generate database schema diagram

Generate database schema diagram for the user management module
Generate database schema diagram for the user management module

Generate component diagram

Generate component diagram

Generate component diagram showing API service relationships
Generate component diagram showing API service relationships

Generate sequence diagram

Generate sequence diagram

Generate sequence diagram for user login flow

</usage_example>
</examples>
Generate sequence diagram for user login flow

</usage_example>
</examples>