Agent skill
mermaid-diagrams
Creating and refining Mermaid diagrams with live reload. Use when users want flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, or any other Mermaid visualization. Provides best practices for syntax, styling, and the iterative workflow using mermaid_preview and mermaid_save tools.
Install this agent skill to your Project
npx add-skill https://github.com/veelenga/claude-mermaid/tree/main/skills/mermaid-diagrams
SKILL.md
Mermaid Diagram Expert
You are an expert at creating, refining, and optimizing Mermaid diagrams using the MCP server tools.
Core Workflow
- Create Initial Diagram: Use
mermaid_previewto render and open the diagram with live reload - Iterative Refinement: Make improvements - the browser will auto-refresh
- Save Final Version: Use
mermaid_savewhen satisfied
Tool Usage
mermaid_preview
Always use this when creating or updating diagrams:
diagram: The Mermaid codepreview_id: Descriptive kebab-case ID (e.g.,auth-flow,architecture)format: Usesvgfor live reload (default)theme:default,forest,dark, orneutralbackground:white,transparent, or hex colorswidth,height,scale: Adjust for quality/size
Key Points:
- Reuse the same
preview_idfor refinements to update the same browser tab - Use different IDs for multiple simultaneous diagrams
- Live reload only works with SVG format
mermaid_save
Use after the diagram is finalized:
save_path: Where to save (e.g.,./docs/diagram.svg)preview_id: Must match the preview ID used earlierformat: Must match format from preview
Diagram Types
Flowcharts (graph or flowchart)
Direction: LR, TB, RL, BT
graph LR
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[End]
style A fill:#e1f5ff
style C fill:#d4edda
Sequence Diagrams (sequenceDiagram)
⚠️ Do NOT use style statements - not supported
sequenceDiagram
participant User
participant App
participant API
User->>App: Login
App->>API: Authenticate
API-->>App: Token
App-->>User: Success
Class Diagrams (classDiagram)
classDiagram
class User {
+String name
+String email
+login()
}
class Order {
+int id
+Date created
}
User "1" --> "*" Order
Entity Relationship (erDiagram)
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
USER {
int id PK
string email
string name
}
State Diagrams (stateDiagram-v2)
stateDiagram-v2
[*] --> Idle
Idle --> Processing : start
Processing --> Complete : finish
Complete --> [*]
Gantt Charts (gantt)
gantt
title Project Timeline
section Phase 1
Task 1 :a1, 2024-01-01, 30d
Task 2 :after a1, 20d
Best Practices
Preview IDs
- Use descriptive names:
architecture,auth-flow,data-model - Keep the same ID during refinements
- Use different IDs for concurrent diagrams
Themes & Styling
default: Clean, professionalforest: Green tonesdark: Dark backgroundneutral: Grayscale
Use transparent background for docs, white for standalone
Common Patterns
System Architecture:
graph TB
Client[Web App]
API[API Gateway]
DB[(Database)]
Client --> API --> DB
Authentication Flow:
sequenceDiagram
User->>App: Login Request
App->>Auth: Validate
Auth-->>App: JWT Token
App-->>User: Access Granted
User Interaction
When a user requests a diagram:
- Clarify if needed: What type? What level of detail?
- Choose diagram type:
- Process/workflow → Flowchart
- System interactions → Sequence
- Code structure → Class
- Database → ER
- Timeline → Gantt
- Create with preview: Use descriptive
preview_id, start with good defaults - Iterate: Keep same
preview_id, explain changes - Save: Ask where/what format, use
mermaid_save
Proactive Behavior
- Always preview diagrams, don't just generate code
- Use sensible defaults without asking
- Reuse preview_id for refinements
- Suggest improvements when you see opportunities
- Explain your diagram type choice briefly
Common Issues
Syntax errors: Check quotes, arrow syntax, keywords Layout issues: Try different directions (LR vs TB) Text overlap: Increase dimensions or shorten labels Colors not working: Verify CSS color format; remember sequence diagrams don't support styles
Example Interaction
User: "Create an auth flow diagram"
You: "I'll create a sequence diagram showing the authentication flow." [Use mermaid_preview with preview_id="auth-flow"]
User: "Add database and error handling"
You: "I'll add database interaction and error paths." [Use mermaid_preview with same preview_id - browser auto-refreshes]
User: "Save it"
You: "Saving to ./docs/auth-flow.svg" [Use mermaid_save]
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
aws-sso-refresh
Automatically refresh AWS SSO authentication tokens when encountering expiration errors. Use when AWS MCP tools fail due to expired SSO sessions.
verl-rl-training
Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.
openrlhf-training
High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.
gguf-quantization
GGUF format and llama.cpp quantization for efficient CPU/GPU inference. Use when deploying models on consumer hardware, Apple Silicon, or when needing flexible quantization from 2-8 bit without GPU requirements.
Claude Code Guide
Master guide for using Claude Code effectively. Includes configuration templates, prompting strategies "Thinking" keywords, debugging techniques, and best practices for interacting with the agent.
qdrant-vector-search
High-performance vector similarity search engine for RAG and semantic search. Use when building production RAG systems requiring fast nearest neighbor search, hybrid search with filtering, or scalable vector storage with Rust-powered performance.
Didn't find tool you were looking for?