agentleFS
veelengaveelenga/claude-mermaid/skills/mermaid-diagrams/SKILL.md

mermaid-diagrams

Skill214 starsChanged 6 months agoMITView on GitHub

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.

41 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use backend-to-frontend-handoff-docs, lesson-learned and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • softaworksSkill

    backend-to-frontend-handoff-docs

    Create API handoff documentation for frontend developers. Use when backend work is complete and needs to be documented for frontend integration, or user says 'create handoff', 'document API', 'frontend handoff', or 'API documentation'.

    Also in 3 projects that use this

  • softaworksSkill

    lesson-learned

    Analyze recent code changes via git history and extract software engineering lessons. Use when the user asks 'what is the lesson here?', 'what can I learn from this?', 'engineering takeaway', 'what did I just learn?', 'reflect on this code', or wants to extract principles from recent work.

    Also in 3 projects that use this

  • SupabaseSkill

    copywriting

    Write or audit UI copy (buttons, labels, empty states, error messages, tooltips, form text) anywhere in the monorepo. Load it before shipping or reviewing any user-facing text — including when copy is incidental to the task, like a new feature that adds buttons, toasts, dialogs, or validation messages.

    Also in 5 projects that use this

  • MicrosoftSkill

    skill-creator

    Guide for creating effective GitHub Copilot skills (.github/skills/) in this repository. Use when creating a new skill, updating an existing skill, or when asked about skill structure, format, or best practices for the vscode-documentdb project.

    Also in 7 projects that use this

  • VercelSkill

    agent-browser

    Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

    Also in 3 projects that use this

  • VercelSkill

    vercel-react-best-practices

    React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

    Also in 3 projects that use this

  • +2 more from softaworks
  • +1 more from vercel-labs

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 10 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 39 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create Initial Diagram: Use mermaid_preview to render and open the diagram with live reload

    line 13
  2. Very specific:

    Save Final Version: Use mermaid_save when satisfied

    line 15
  3. Distinctive:

    Always use this when creating or updating diagrams:

    line 21
  4. Distinctive:

    Use different IDs for multiple simultaneous diagrams

    line 33
  5. Distinctive:

    Use after the diagram is finalized:

    line 38
  6. Very specific:

    Use descriptive names: architecture, auth-flow, data-model

    line 130
  7. Distinctive:

    Keep the same ID during refinements

    line 131
  8. Distinctive:

    Use different IDs for concurrent diagrams

    line 132
  9. Very specific:

    Use transparent background for docs, white for standalone

    line 141
  10. Distinctive:

    When a user requests a diagram:

    line 168
  11. Very specific:

    Create with preview: Use descriptive preview_id, start with good defaults

    line 177
  12. Very specific:

    Iterate: Keep same preview_id, explain changes

    line 178
  13. Very specific:

    Save: Ask where/what format, use mermaid_save

    line 179
  14. Distinctive:

    Always preview diagrams, don't just generate code

    line 183
  15. Distinctive:

    Use sensible defaults without asking

    line 184
  16. Distinctive:

    Syntax errors: Check quotes, arrow syntax, keywords

    line 191
  17. Distinctive:

    Colors not working: Verify CSS color format; remember sequence diagrams don't support styles

    line 194

“Common” is measured: kept by at least 6 in 10 of the 39 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

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, professional
  • forest: Green tones
  • dark: Dark background
  • neutral: 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:

  1. Clarify if needed: What type? What level of detail?
  2. Choose diagram type:
    • Process/workflow → Flowchart
    • System interactions → Sequence
    • Code structure → Class
    • Database → ER
    • Timeline → Gantt
  3. Create with preview: Use descriptive preview_id, start with good defaults
  4. Iterate: Keep same preview_id, explain changes
  5. 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]

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.