mermaid

mermaid is a cursor rule for coding agents from Mr-chen-05/rules-2.1-optimized. It costs 0 tokens per session (2,099 once invoked), scanned A, original, MIT.

A guide for creating Mermaid diagrams, which are text descriptions that render as visual diagrams. It covers flowcharts, sequence diagrams, class diagrams, and database relationship diagrams.

In plain words
What is it for?
Use it to document workflows, request sequences, software classes, or how database entities relate to one another.
Why use it?
It makes system structure, processes, interactions, and data relationships easier to represent and review.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/mr-chen-05/rules-2.1-optimized/mermaid
Clone the repo
git clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimized

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mermaid

README.md
[![agentmods](https://agentmods.dev/badge/rules/mr-chen-05/rules-2.1-optimized/mermaid.svg)](https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/mermaid)
Your own site
<a href="https://agentmods.dev/rules/mr-chen-05/rules-2.1-optimized/mermaid"><img src="https://agentmods.dev/badge/rules/mr-chen-05/rules-2.1-optimized/mermaid.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,099 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02099
Opus 5 $0.00000 $0.01050
Sonnet 5 $0.00000 $0.00420
Haiku 4.5 $0.00000 $0.00210

Measured 4d ago against content hash 10a9861e77f5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mermaid scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

project-rules/mermaid.mdc · 323 lines

How it starts

The opening of the file, as written. The whole thing — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.

📊 Mermaid Diagrams - Mermaid图表

使用Mermaid创建各种类型的图表和可视化。

🚀 Commands - 命令

  • /mermaid - 创建Mermaid图表
  • /flowchart - 创建流程图
  • /sequence - 创建时序图
  • /class-diagram - 创建类图
  • /er-diagram - 创建实体关系图

📋 Diagram Types - 图表类型

1. 🔄 流程图 (Flowchart)

flowchart TD
    A[开始] --> B{条件判断}
    B -->|是| C[执行操作A]
    B -->|否| D[执行操作B]
    C --> E[结束]
    D --> E

2. ⏱️ 时序图 (Sequence Diagram)

sequenceDiagram
    participant U as 用户
    participant F as 前端
    participant B as 后端
    participant D as 数据库
    
    U->>F: 登录请求
    F->>B: 验证用户
    B->>D: 查询用户信息
    D-->>B: 返回用户数据
    B-->>F: 返回认证结果
    F-->>U: 显示登录状态

3. 🏗️ 类图 (Class Diagram)

classDiagram
    class User {
        +String name
        +String email
        +login()
        +logout()
    }
    
    class Admin {
        +String permissions
        +manageUsers()
    }
    
    User <|-- Admin

4. 🗄️ 实体关系图 (ER Diagram)

erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ ORDER_ITEM : contains
    PRODUCT ||--o{ ORDER_ITEM : "ordered in"
    
    USER {
        int id PK
        string name
        string email
    }
    
    ORDER {
        int id PK
        int user_id FK
        date created_at
    }

5. 🌳 Git图 (Git Graph)

gitgraph
    commit id: "Initial"
    branch develop
    checkout develop
    commit id: "Feature A"
    commit id: "Feature B"
    checkout main
    merge develop
    commit id: "Release v1.0"

6. 📊 甘特图 (Gantt Chart)

gantt
    title 项目开发计划
    dateFormat  YYYY-MM-DD
    section 需求分析
    需求调研    :done, des1, 2024-01-01, 2024-01-05
    需求文档    :done, des2, after des1, 3d
    section 开发阶段
    前端开发    :active, dev1, 2024-01-08, 10d
    后端开发    :dev2, 2024-01-08, 12d
    section 测试阶段
    单元测试    :test1, after dev1, 3d
    集成测试    :test2, after dev2, 2d

7. 🍰 饼图 (Pie Chart)

pie title 技术栈分布
    "Vue.js" : 35
    "React" : 30
    "Angular" : 15
    "其他" : 20

Read the full file on GitHub · 323 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 323 lines · 0 tokens per session scan A 10a9861e77f5

Subscribe to this mod's changes

mermaid is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,099 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.