Communitygithub.com

David-Li0406/meta-skill-evloving

使用 Mermaid 语法创建技术图表,包括架构图、时序图、ERD、流程图和状态机。适用于可视化系统设计、数据流和流程。触发词:diagram, mermaid, architecture diagram, sequence diagram, flowchart, ERD, entity relationship, state diagram, C4 model, component diagram, visualize, draw。

meta-skill-evloving 是什么?

该技能名为“Diagramming”,旨在帮助用户利用 Mermaid 语法创建清晰、可维护的技术图表。它覆盖了软件系统文档中常用的多种图表类型,包括架构图(C4 模型)、时序图、实体关系图(ERD)、流程图、状态图和类图。技能内容详细介绍了每种图表类型的适用场景、通用 Mermaid 编写原则,以及提高图表可读性和一致性的最佳实践。此外,还提供了大量可直接运行的代码示例,涵盖从系统上下文到组件级别的各种实际用例。该技能适用于任何支持 Mermaid 渲染的 AI 代理平台(如 Claude Code、Cursor 等),帮助开发者在设计会话中快速生成技术可视化内容,便于沟通和文档化。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/David-Li0406/meta-skill-evloving/tree/HEAD/AgentSkillOS/data/skill_seeds/diagramming

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

图表绘制

概述

使用 Mermaid 语法创建清晰、可维护的技术图表。本技能涵盖用于记录软件系统的架构图、时序图、实体关系图、流程图和状态图。

指导说明

1. 选择合适的图表类型

图表类型适用场景
架构图/C4展示系统结构和组件
时序图展示随时间推移的交互
ERD展示数据模型和关系
流程图展示决策逻辑和流程
状态图展示状态转换

2. 通用 Mermaid 原则

  • 保持图表聚焦于单一概念
  • 使用一致的命名约定
  • 为关系添加描述性标签
  • 限制复杂度(拆分大型图表)
  • 使用注释进行文档化

最佳实践

  • 简洁:一图一概念
  • 一致:相关图表间使用相同命名
  • 可读性:从左到右或从上到下的流程
  • 标签:始终标注关系和转换
  • 上下文:包含标题和简短描述

示例

架构图(C4 模型)

上下文图(第 1 层)

C4Context
    title 电商平台系统上下文图

    Person(customer, "顾客", "购买产品的用户")
    Person(admin, "管理员", "管理产品和订单")

    System(ecommerce, "电商平台", "允许顾客浏览和购买产品")

    System_Ext(payment, "支付网关", "处理支付")
    System_Ext(shipping, "物流供应商", "处理订单履约")
    System_Ext(email, "邮件服务", "发送通知")

    Rel(customer, ecommerce, "浏览、购买")
    Rel(admin, ecommerce, "管理")
    Rel(ecommerce, payment, "处理支付")
    Rel(ecommerce, shipping, "创建物流单")
    Rel(ecommerce, email, "发送邮件")

容器图(第 2 层)

C4Container
    title 电商平台容器图

    Person(customer, "顾客")

    Container_Boundary(ecommerce, "电商平台") {
        Container(web, "Web 应用", "React", "面向顾客的前端 UI")
        Container(api, "API 网关", "Node.js", "REST API")
        Container(cart, "购物车服务", "Node.js", "购物车管理")
        Container(catalog, "目录服务", "Python", "产品目录")
        Container(order, "订单服务", "Java", "订单处理")
        ContainerDb(db, "数据库", "PostgreSQL", "存储所有数据")
        ContainerQueue(queue, "消息队列", "RabbitMQ", "异步消息")
    }

    Rel(customer, web, "使用", "HTTPS")
    Rel(web, api, "调用", "JSON/HTTPS")
    Rel(api, cart, "路由到")
    Rel(api, catalog, "路由到")
    Rel(api, order, "路由到")
    Rel(cart, db, "读写")
    Rel(catalog, db, "读取")
    Rel(order, db, "读写")
    Rel(order, queue, "发布事件")

组件图(第 3 层)

flowchart TB
    subgraph "订单服务"
        controller[订单控制器]
        service[订单服务]
        repo[订单仓库]
        validator[订单验证器]
        publisher[事件发布器]
    end

    subgraph "外部"
        db[(PostgreSQL)]
        queue[RabbitMQ]
    end

    controller --> service
    service --> validator
    service --> repo
    service --> publisher
    repo --> db
    publisher --> queue

时序图

基本请求流程

sequenceDiagram
    autonumber
    participant C as 客户端
    participant G as API 网关
    participant A as 认证服务
    participant S as 服务
    participant D as 数据库

    C->>G: POST /api/resource
    G->>A: 验证令牌
    A-->>G: 令牌有效

    G->>S: 转发请求
    S->>D: 查询数据
    D-->>S: 返回结果

    S-->>G: 响应 (200 OK)
    G-->>C: 返回数据

错误处理流程

sequenceDiagram
    participant C as 客户端
    participant S as 服务
    participant D as 数据库

    C->>S: POST /api/users
    S->>S: 验证输入

    alt 验证失败
        S-->>C: 400 错误请求
    else 验证通过
        S->>D: INSERT user
        alt 数据库错误
            D-->>S: 约束违反
            S-->>C: 409 冲突
        else 成功
            D-->>S: 用户创建成功
            S-->>C: 201 已创建
        end
    end

异步处理

sequenceDiagram
    participant C as 客户端
    participant API as API
    participant Q as 队列
    participant W as 工作者
    participant N as 通知

    C->>API: 提交作业
    API->>Q: 入队作业
    API-->>C: 202 已接受 (作业 ID)

    Note over Q,W: 异步处理

    Q->>W: 出队作业
    W->>W: 处理作业
    W->>N: 发送通知
    N-->>C: 作业完成通知

实体关系图

基本 ERD

erDiagram
    USER ||--o{ ORDER : 下单
    USER {
        uuid id PK
        string email UK
        string name
        timestamp created_at
    }

    ORDER ||--|{ ORDER_ITEM : 包含
    ORDER {
        uuid id PK
        uuid user_id FK
        decimal total
        string status
        timestamp created_at
    }

    ORDER_ITEM }|--|| PRODUCT : 引用
    ORDER_ITEM {
        uuid id PK
        uuid order_id FK
        uuid product_id FK
        int quantity
        decimal price
    }

    PRODUCT ||--o{ PRODUCT_CATEGORY : 属于
    PRODUCT {
        uuid id PK
        string name
        text description
        decimal price
        int stock
    }

    CATEGORY ||--o{ PRODUCT_CATEGORY : 包含
    CATEGORY {
        uuid id PK
        string name
        uuid parent_id FK
    }

    PRODUCT_CATEGORY {
        uuid product_id PK,FK
        uuid category_id PK,FK
    }

带关系说明的 ERD

erDiagram
    CUSTOMER ||--o{ ORDER : "下单 (1:N)"
    ORDER ||--|{ LINE_ITEM : "包含 (1:N, 必需)"
    PRODUCT ||--o{ LINE_ITEM : "出现在 (1:N)"
    CUSTOMER }|--|| ADDRESS : "拥有账单地址 (N:1, 必需)"
    CUSTOMER }o--o{ ADDRESS : "拥有收货地址 (N:N)"

关系符号说明:

  • || 恰好一个
  • o| 零或一个
  • }| 一个或多个
  • }o 零或多个

流程图

决策逻辑

flowchart TD
    A[开始:用户登录] --> B{凭证有效?}
    B -->|是| C{启用 2FA?}
    B -->|否| D[显示错误消息]
    D --> A

    C -->|是| E[发送 2FA 验证码]
    E --> F{验证码正确?}
    F -->|是| G[创建会话]
    F -->|否| H{尝试次数 < 3?}
    H -->|是| E
    H -->|否| I[锁定账户]

    C -->|否| G
    G --> J[重定向到仪表盘]
    J --> K[结束]
    I --> K

流程

flowchart LR
    subgraph "CI 流水线"
        A[推送代码] --> B[运行测试]
        B --> C{测试通过?}
        C -->|是| D[构建镜像]
        C -->|否| E[通知开发者]
        D --> F[推送到仓库]
    end

    subgraph "CD 流水线"
        F --> G[部署到预发布环境]
        G --> H[运行端到端测试]
        H --> I{测试通过?}
        I -->|是| J[部署到生产环境]
        I -->|否| K[回滚]
    end

状态图

订单状态机

stateDiagram-v2
    [*] --> Draft: 创建订单

    Draft --> Pending: 提交
    Draft --> Cancelled: 取消

    Pending --> Confirmed: 收到付款
    Pending --> Cancelled: 付款失败
    Pending --> Cancelled: 超时 (24h)

    Confirmed --> Processing: 开始履约
    Confirmed --> Cancelled: 客户取消

    Processing --> Shipped: 发货
    Processing --> Cancelled: 缺货

    Shipped --> Delivered: 确认送达
    Shipped --> Returned: 发起退货

    Delivered --> Returned: 请求退货
    Delivered --> [*]: 完成

    Returned --> Refunded: 处理退款
    Refunded --> [*]: 完成

    Cancelled --> [*]: 完成

连接状态机

stateDiagram-v2
    [*] --> Disconnected

    Disconnected --> Connecting: connect()
    Connecting --> Connected: 成功
    Connecting --> Disconnected: 失败

    Connected --> Disconnected: disconnect()
    Connected --> Reconnecting: 连接丢失

    Reconnecting --> Connected: 成功
    Reconnecting --> Disconnected: 超过最大重试次数

    note right of Reconnecting
        指数退避
        最多重试 5 次
    end note

类图

classDiagram
    class Repository~T~ {
        <<interface>>
        +findById(id: string) T
        +findAll() List~T~
        +save(entity: T) T
        +delete(id: string) void
    }

    class UserRepository {
        -db: Database
        +findById(id: string) User
        +findAll() List~User~
        +save(entity: User) User
        +delete(id: string) void
        +findByEmail(email: string) User
    }

    class User {
        +id: string
        +email: string
        +name: string
        +createdAt: Date
        +validate() boolean
    }

    Repository~T~ <|.. UserRepository
    UserRepository --> User

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

David-Li0406/meta-skill-evloving

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

David-Li0406/meta-skill-evloving

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

David-Li0406/meta-skill-evloving

Complete color manipulation and green screen effects system. PROACTIVELY activate for: (1) Green screen/chromakey removal, (2) Color grading with LUTs, (3) Color correction (levels, curves, white balance), (4) Colorkey/color removal effects, (5) Hue/saturation manipulation, (6) Color space conversions (BT.709, BT.2020, HDR), (7) Color isolation effects, (8) Teal and orange look, (9) Vintage/film looks, (10) Color keying for transparency. Provides: chromakey and colorkey filters, LUT application (lut3d), curves and levels adjustment, color balance, selective color manipulation, color space handling, HDR tone mapping, professional color grading chains.

David-Li0406/meta-skill-evloving

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

David-Li0406/meta-skill-evloving

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

David-Li0406/meta-skill-evloving

Build with OpenAI's stateless APIs - Chat Completions (GPT-5, GPT-4o), Embeddings, Images (DALL-E 3), Audio (Whisper + TTS), and Moderation. Includes Node.js SDK and fetch-based approaches for Cloudflare Workers. Use when: implementing chat completions with GPT-5/GPT-4o, streaming responses with SSE, using function calling/tools, creating structured outputs with JSON schemas, generating embeddings for RAG (text-embedding-3-small/large), generating images with DALL-E 3, editing images with GPT-Image-1, transcribing audio with Whisper, synthesizing speech with TTS (11 voices), moderating content (11 safety categories), or troubleshooting rate limits (429), invalid API keys (401), function calling failures, streaming parse errors, embeddings dimension mismatches, or token limit exceeded.

David-Li0406/meta-skill-evloving

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

David-Li0406/meta-skill-evloving

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

David-Li0406/meta-skill-evloving

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

David-Li0406/meta-skill-evloving

Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.

David-Li0406/meta-skill-evloving

Best practices for Remotion - Video creation in React

David-Li0406/meta-skill-evloving

Provides bidirectional translation (Chinese/English), grammar checking, and sentence polishing. Supports specific tense constraints, context-aware tone adjustment, and natural expression optimization. Outputs direct text without formatting.

David-Li0406/meta-skill-evloving

指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。

David-Li0406/meta-skill-evloving

生成Python脚本,利用FFmpeg将图片序列按3x3布局合并,或将合并图拆分。要求使用subprocess模块执行命令,并支持用户交互式输入路径。

David-Li0406/meta-skill-evloving

SOP for extracting and analyzing promotional activity details, handling time formatting, location mapping, payment logic, and step-by-step process validation.

David-Li0406/meta-skill-evloving

Specializes in creating TikTok short video scripts using an anthropomorphic 'Chef' perspective to explain wildlife food chains and survival environments, utilizing real field footage.

David-Li0406/meta-skill-evloving

针对TikTok平台,以拟人化视角(如动物作为厨师)创作系列短视频脚本。重点介绍野生动物、食物链及生态环境,要求使用野外实拍素材,风格幽默且具有教育意义。

David-Li0406/meta-skill-evloving

Generates KWL (Know, Want to know, Learned) charts for educational videos, specifically BrainPOP, using simple 7th-grade language and short, concise bullet points.

David-Li0406/meta-skill-evloving

Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.

David-Li0406/meta-skill-evloving

Tracks complex, multi-session work using the Beads issue tracker and dependency graphs, and provides persistent memory that survives conversation compaction. Use when work spans multiple sessions, has complex dependencies, or needs persistent context across compaction cycles. Trigger with phrases like "create task for", "what's ready to work on", "show task", "track this work", "what's blocking", or "update status".

相关技能