mermaid-studio
Skill này làm gì
Skill này viết mã sơ đồ Mermaid, kiểm tra lỗi và hiển thị thành file ảnh. Skill dành cho lập trình viên và người viết tài liệu muốn có sơ đồ rõ ràng trong tài liệu mà không phải vẽ tay.
Khi nào nên dùng
- ✓Khi bạn muốn một lưu đồ, sơ đồ tuần tự hoặc sơ đồ cơ sở dữ liệu được viết bằng mã Mermaid.
- ✓Khi bạn cần hiển thị một sơ đồ thành file ảnh cho tài liệu hoặc bài thuyết trình.
- ✓Khi bạn muốn biến mã có sẵn thành sơ đồ giải thích cách nó hoạt động.
Liên kết skill
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(tooling)/mermaid-studio/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể tạo một sơ đồ tuần tự Mermaid cho luồng đăng nhập của tôi và xuất ra file PNG không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent viết mã Mermaid với một chủ đề màu, kiểm tra cú pháp rồi hiển thị kết quả. Agent cũng có thể phân tích mã có sẵn để tạo sơ đồ cấu trúc của nó.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Mermaid Studio
Expert-level Mermaid diagram creation, validation, and multi-format rendering. Creates diagrams from descriptions or code analysis, validates syntax, and renders to SVG, PNG, or ASCII with professional theming.
Golden Rules — Elegant Diagrams by Default
Every diagram MUST follow these principles. They are not optional — they define the difference between a mediocre diagram and a gold-standard one.
Rule 1: Always Use an Init Directive for Professional Styling
NEVER create a diagram without an %%{init} directive or frontmatter config. The default Mermaid theme produces harsh black lines and generic colors. Always apply a curated palette.
For general diagrams (flowchart, sequence, state, class, ERD):
%%{init: {'theme': 'base', 'themeVariables': {
'primaryColor': '#4f46e5', 'primaryTextColor': '#ffffff',
'primaryBorderColor': '#3730a3', 'lineColor': '#94a3b8',
'secondaryColor': '#10b981', 'tertiaryColor': '#f59e0b',
'background': '#ffffff', 'mainBkg': '#f8fafc',
'nodeBorder': '#cbd5e1', 'clusterBkg': '#f1f5f9',
'clusterBorder': '#e2e8f0', 'titleColor': '#1e293b',
'edgeLabelBackground': '#ffffff', 'textColor': '#334155'
}}}%%
⚠️ Font Warning: Do NOT set fontFamily in theme variables. The Mermaid default font (trebuchet ms, verdana, arial, sans-serif) works everywhere. Setting system-ui, Segoe UI, or -apple-system will render as Times New Roman in headless Chromium (used by mmdc).
For C4 diagrams — see the dedicated C4 styling section below.
For architecture-beta diagrams — see the dedicated AWS/Architecture section below.
Rule 2: Soft Lines, Never Harsh Black
The single biggest visual improvement is using lineColor: '#94a3b8' (slate-400) instead of the default black. This creates a modern, breathable diagram. For dark themes, use lineColor: '#64748b' (slate-500).
Rule 3: Limit Density — Breathe
- Maximum 15 nodes per diagram (not 20 — fewer is more elegant)
- Use
subgraphor boundaries to create whitespace and visual grouping - Prefer LR (left-right) for process flows — it reads more naturally
- Use invisible links (
A ~~~ B) to add spacing when the layout is cramped
Rule 4: Meaningful Labels and Consistent Style
- Node IDs: camelCase (
orderService, nots1oros) - Labels: short, clear natural language (
[Order Service]) - Arrows: action verbs with protocol info (
"Sends order via gRPC") - Descriptions: one-line, role-focused (
"Handles order lifecycle")
Rule 5: Color Harmony Over Color Variety
Use max 3-4 colors per diagram. Map colors to meaning:
- Blue tones (#4f46e5, #3b82f6) → primary systems, internal services
- Green tones (#10b981, #059669) → success states, data stores
- Amber tones (#f59e0b, #d97706) → external systems, warnings
- Slate tones (#64748b, #94a3b8) → lines, borders, secondary elements
- Red tones (#ef4444) → errors ONLY, never as decoration
Modes of Operation
This skill operates in three modes based on user intent:
| Mode | Trigger | What happens |
|---|---|---|
| Create | "draw a diagram of...", "visualize my..." | Generates .mmd code only |
| Render | "render this mermaid", "convert to SVG/PNG/ASCII" | Renders existing .mmd |
| Full | "create and render...", ambiguous requests | Create → Validate → Render |
Default to Full mode when intent is unclear.
Step 1: Understand the Request
Before writing any Mermaid code, determine:
- What to diagram — system, flow, schema, architecture, code structure?
- Which diagram type — use the Decision Matrix below
- Output format — code only, SVG, PNG, or ASCII?
- Theme preference — ask only if rendering; default to
basetheme with curated palette
Diagram Type Decision Matrix
| User describes... | Diagram Type | Syntax keyword |
|---|---|---|
| Process, algorithm, decision tree, workflow | Flowchart | flowchart TD/LR |
| API calls, message passing, request/response | Sequence | sequenceDiagram |
| Database schema, table relationships | ERD | erDiagram |
| OOP classes, domain model, interfaces | Class | `classDiagra |
Câu hỏi thường gặp
Skill hỗ trợ những loại sơ đồ nào?
Skill hỗ trợ hơn 20 loại Mermaid, gồm lưu đồ, tuần tự, ERD, trạng thái, lớp và kiến trúc.
Skill xuất ra những định dạng nào?
Skill hiển thị thành SVG, PNG hoặc ASCII.
Skill có kiểm tra sơ đồ trước khi hiển thị không?
Có. Skill kiểm tra cú pháp nên lỗi được phát hiện trước khi file được tạo.
Chi tiết
Mô tả gốc của tác giả
Expert Mermaid diagram creation, validation, and rendering with dual-engine output (SVG/PNG/ASCII). Supports all 20+ diagram types including C4 architecture, AWS architecture-beta with service icons, flowcharts, sequence, ERD, state, class, mindmap, timeline, git graph, sankey, and more. Features code-to-diagram analysis, batch rendering, 15+ themes, and syntax validation. Use when users ask to create diagrams, visualize architecture, render mermaid files, generate ASCII diagrams, document system flows, model databases, draw AWS infrastructure, analyze code structure, or anything involving "me
Độ phổ biến
- Sao GitHub
- 7.1k
- Vị trí xếp hạng
- #13570
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
component-common-domain-detection
7.1kGiúp agent của bạn tìm logic nghiệp vụ bị lặp lại ở nhiều phần của codebase và gợi ý cách gộp nó lại.
component-flattening-analysis
7.1kGiúp agent của bạn tìm mã nằm sai chỗ và làm phẳng các cấu trúc thư mục component lộn xộn, để mỗi phần nằm đúng vị trí.
component-identification-sizing
7.1kGiúp agent của bạn lập bản đồ các phần của codebase và đo kích thước của chúng, để tìm module nên tách trước.
coupling-analysis
7.1kGiúp agent của bạn kiểm tra mức độ phụ thuộc chặt chẽ giữa các phần của codebase, và nên nới lỏng những kết nối nào trước.
Skill tương tự
technical-documentation
394kGiúp agent của bạn viết và rà soát tài liệu kỹ thuật cùng file hướng dẫn cho agent, rõ ràng để mọi người và công cụ AI đều dễ làm theo.
architecture-decision-records
280kGiúp agent của bạn ghi lại các quyết định quan trọng về cấu trúc dự án, giúp hiểu lý do đằng sau các lựa chọn và giữ lịch sử thay đổi rõ ràng.
code-tour
280kGiúp agent của bạn tạo các hướng dẫn đọc code từng bước, có tham chiếu chính xác đến file và dòng, hữu ích cho phần giới thiệu, giải thích và rà soát.