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

mermaid-diagrams

Skill223 starsChanged 43 days agoMITView on GitHub

Creating and refining Mermaid diagrams with live reload or as shareable Claude artifacts. Use when users want flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, or any other Mermaid visualization, and when writing, editing, restyling, or reviewing a Mermaid block in a Markdown file. Provides best practices for syntax, styling, and the iterative workflow using mermaid_preview and mermaid_save tools.

69 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analytics-metrics, aws-account-management 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.
  • hoodiniSkill

    analytics-metrics

    Build data visualization and analytics dashboards. Use when creating charts, KPI displays, metrics dashboards, or data visualization components. Triggers on analytics, dashboard, charts, metrics, KPI, data visualization, Recharts.

    Also in 3 projects that use this

  • hoodiniSkill

    aws-account-management

    Manage AWS accounts, organizations, IAM, and billing. Use when setting up AWS Organizations, managing IAM policies, controlling costs, or implementing multi-account strategies. Triggers on AWS Organizations, AWS IAM, AWS billing, Cost Explorer, SCPs, multi-account, AWS SSO, Identity Center.

    Also in 3 projects that use this

  • MongoDBSkill

    mongodb

    Front door for MongoDB and MongoDB Atlas. Use it before answering which database, MongoDB deployment, Atlas tier, or database hosting to use, even for advice-only questions. MongoDB updates frequently, so check this skill first. Also use it before setting up, provisioning, or connecting to MongoDB or Atlas, or creating a throwaway or prototype database. Also use when the user mentions "MongoDB", "Atlas", "MongoDB quickstart", "document database", "NoSQL", "BSON", "Mongoose", "PyMongo", "RAG", "Vector Search", "aggregation pipeline", "change streams", or "backend", and for general MongoDB development questions (CRUD, transactions, drivers and ODMs, server versions) from current docs. If a more specific MongoDB skill is installed and matches the task (schema design, query writing or optimization, search and vector search, stream processing, connection tuning, MCP server setup, queryable encryption sizing), load that instead; if it isn't installed, use this skill, which routes to it.

    Also in 4 projects that use this

  • lmuntaner-bahSkill

    professional-communication

    Guide technical communication for software developers. Covers email structure, team messaging etiquette, meeting agendas, and adapting messages for technical vs non-technical audiences. Use when drafting professional messages, preparing meeting communications, or improving written communication.

    Also in 3 projects that use this

  • imehrSkill

    railway

    Railway.com deployment and management - deployment, logs, migrations, troubleshooting, monorepo strategies, security, and CLI reference. Use when deploying to Railway, configuring services, managing environment variables, or debugging deployment issues.

    Also in 3 projects that use this

  • +7 more from hoodini

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. 0 are common, 12 are distinctive, and 12 are very specific to this project.

  • 0

    Common

    Most of the 65 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 12

    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:

    When the user asks for an artifact or a shareable page, call mermaid_preview with mode: "artifact".

    line 46
  7. Very specific:

    Keep passing mode: "artifact" on every later call for that diagram

    line 49
  8. Very specific:

    After every refinement, call mermaid_preview with the same preview_id, then republish the same path so the existing artifact URL is updated …

    line 50
  9. Distinctive:

    Never publish a different path for the same diagram.

    line 51
  10. Very specific:

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

    line 140
  11. Distinctive:

    Keep the same ID during refinements

    line 141
  12. Distinctive:

    Use different IDs for concurrent diagrams

    line 142
  13. Very specific:

    Use transparent background for docs, white for standalone

    line 151
  14. Distinctive:

    When a user requests a diagram:

    line 178
  15. Very specific:

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

    line 187
  16. Very specific:

    Iterate: Keep same preview_id, explain changes

    line 188
  17. Very specific:

    Save: Ask where/what format, use mermaid_save

    line 189
  18. Distinctive:

    Always preview diagrams, don't just generate code

    line 193
  19. Distinctive:

    Use sensible defaults without asking

    line 194
  20. Distinctive:

    Syntax errors: Check quotes, arrow syntax, keywords

    line 201
  21. Distinctive:

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

    line 204
  22. Very specific:

    Keep each <br/> line short, about 25 characters.

    line 212
  23. Very specific:

    When the diagram grows too wide, switch the direction (LR or TB) before shortening labels

    line 213
  24. Distinctive:

    Keep edges off subgraph titles: link a whole subgraph once instead of each node inside it

    line 214

“Common” is measured: kept by at least 6 in 10 of the 65 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
  • size, 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

Artifact mode

When the user asks for an artifact or a shareable page, call mermaid_preview with mode: "artifact". It does not open a browser. Instead its response contains an Artifact page: path.

  • Publish that path with the Artifact tool right away
  • Keep passing mode: "artifact" on every later call for that diagram
  • After every refinement, call mermaid_preview with the same preview_id, then republish the same path so the existing artifact URL is updated in place
  • Never publish a different path for the same diagram; that would create a new artifact
  • Share the artifact URL with the user once, and mention that later updates appear at the same URL

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

Diagrams in Markdown Files

A mermaid code block inside a document follows the same workflow:

  • Preview the block with mermaid_preview after every change, and look at the result before reporting
  • On light fills, set a dark text color in classDef or style (for example color:#0f172a), so labels stay readable
  • Keep each <br/> line short, about 25 characters. A longer line wraps again and leaves orphan words
  • When the diagram grows too wide, switch the direction (LR or TB) before shortening labels
  • Keep edges off subgraph titles: link a whole subgraph once instead of each node inside it

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, or republish the artifact page in artifact mode]

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.