Back to Skills

mermaid-diagrams

verified

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.

View on GitHub

Marketplace

claude-mermaid

veelenga/claude-mermaid

Plugin

claude-mermaid

Repository

veelenga/claude-mermaid
51stars

skills/mermaid-diagrams/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/veelenga/claude-mermaid/blob/main/skills/mermaid-diagrams/SKILL.md -a claude-code --skill mermaid-diagrams

Installation paths:

Claude
.claude/skills/mermaid-diagrams/
Powered by add-skill CLI

Instructions

# Mermaid Diagram Expert

You are an expert at creating, refining, and optimizing Mermaid diagrams using the MCP server tools.

## Core Workflow

1. **Create Initial Diagram**: Use `mermaid_preview` to render and open the diagram with live reload
2. **Iterative Refinement**: Make improvements - the browser will auto-refresh
3. **Save Final Version**: Use `mermaid_save` when satisfied

## Tool Usage

### mermaid_preview

Always use this when creating or updating diagrams:

- `diagram`: The Mermaid code
- `preview_id`: Descriptive kebab-case ID (e.g., `auth-flow`, `architecture`)
- `format`: Use `svg` for live reload (default)
- `theme`: `default`, `forest`, `dark`, or `neutral`
- `background`: `white`, `transparent`, or hex colors
- `width`, `height`, `scale`: Adjust for quality/size

**Key Points:**

- Reuse the same `preview_id` for 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 earlier
- `format`: Must match format from preview

## Diagram Types

### Flowcharts (`graph` or `flowchart`)

Direction: `LR`, `TB`, `RL`, `BT`

```mermaid
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

```mermaid
sequenceDiagram
    participant User
    participant App
    participant API

    User->>App: Login
    App->>API: Authenticate
    API-->>App: Token
    App-->>User: Success
```

### Class Diagrams (`classDiagram`)

```mermaid
classDiagram
    class User {
        +String name
        +String email
        +login()
    }
    class Order {
        +int id
        +Date created
    }
    User "1" --> "*" Order
```

### Entity Relationship (`erDia

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
4385 chars