All skills
softaworks avatar

/mermaid-diagrams

@b00cf84
by softaworkssoftaworks/agent-toolkit2.5k stars
230

Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts, gantt charts, or any other diagram type. Triggers include requests to "diagram", "visualize", "model", "map out", "show the flow", or when explaining system architecture, database design, code structure, or user/application flows.

Use this Skill: https://skilld.dev/gh/softaworks/agent-toolkit/mermaid-diagrams

This session only. Nothing lands on disk.

README.md

≈2.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Mermaid Diagrams Skill

A comprehensive guide for creating professional software diagrams using Mermaid's text-based syntax. This skill enables you to visualize system architecture, document code structure, model databases, and communicate technical concepts through diagrams.

Purpose

Transform complex technical concepts into clear, maintainable diagrams that can be version-controlled alongside your code. Mermaid diagrams are rendered from simple text definitions, making them easy to update, review in pull requests, and maintain over time.

When to Use This Skill

Use this skill when you need to:

  • Document architecture - Visualize system context, containers, components, and deployment
  • Model domains - Create domain models with entities, relationships, and behaviors
  • Explain flows - Show API interactions, user journeys, authentication sequences
  • Design databases - Document table relationships, keys, and schema structure
  • Plan processes - Map workflows, decision trees, algorithms, and pipelines
  • Communicate designs - Align stakeholders on technical decisions before coding

Trigger Phrases

The skill activates when you mention:

  • "diagram", "visualize", "model", "map out", "show the flow"
  • "architecture diagram", "class diagram", "sequence diagram", "flowchart"
  • "database schema", "ERD", "entity relationship"
  • "system design", "data model", "domain model"

How It Works

  1. Choose the right diagram type based on what you want to communicate
  2. Start with core elements - entities, actors, or components
  3. Add relationships - connections, flows, interactions
  4. Refine incrementally - add details, styling, notes
  5. Export or embed - use in documentation, PRs, wikis

Mermaid syntax is intuitive and follows a consistent pattern across all diagram types:

diagramType
  definition content

Key Features

9 Diagram Types Supported

  1. Class Diagrams - Domain models, OOP design, entity relationships
  2. Sequence Diagrams - API flows, user interactions, temporal sequences
  3. Flowcharts - User journeys, processes, decision logic, pipelines
  4. Entity Relationship Diagrams - Database schemas, table relationships
  5. C4 Architecture Diagrams - System context, containers, components
  6. State Diagrams - State machines, lifecycle states
  7. Git Graphs - Branching strategies, version control flows
  8. Gantt Charts - Project timelines, scheduling
  9. Pie/Bar Charts - Data visualization, metrics

Advanced Capabilities

  • Themes and styling - Default, forest, dark, neutral, base themes
  • Custom theming - Configure colors, fonts, and layout
  • Layout options - Dagre (balanced) or ELK (advanced)
  • Look options - Classic or hand-drawn sketch style
  • Subgraphs - Group related elements for clarity
  • Notes and comments - Add context and explanations
  • Alt/loop/opt blocks - Complex flow control in sequences

Integration Support

  • GitHub/GitLab - Automatic rendering in Markdown files
  • VS Code - Preview with Markdown Mermaid extension
  • Notion, Obsidian, Confluence - Built-in support
  • Export - PNG, SVG, PDF via Mermaid Live or CLI

Usage Examples

Example 1: Document a Domain Model

When: You're designing a video streaming platform and need to model core entities.

classDiagram
    Title -- Genre
    Title *-- Season
    Title *-- Review
    User --> Review : creates

    class Title {
        +string name
        +int releaseYear
        +play()
    }

    class Genre {
        +string name
        +getTopTitles()
    }

Example 2: Explain an API Authentication Flow

When: You need to document how login works for frontend developers.

sequenceDiagram
    participant User
    participant API
    participant Database

    User->>API: POST /login
    API->>Database: Query credentials
    Database-->>API: Return user data
    alt Valid credentials
        API-->>User: 200 OK + JWT token
    else Invalid credentials
        API-->>User: 401 Unauthorized
    end

Example 3: Map a User Journey

When: You're planning a feature and need to visualize the user flow.

flowchart TD
    Start([User visits site]) --> Auth{Authenticated?}
    Auth -->|No| Login[Show login page]
    Auth -->|Yes| Dashboard[Show dashboard]
    Login --> Creds[Enter credentials]
    Creds --> Validate{Valid?}
    Validate -->|Yes| Dashboard
    Validate -->|No| Error[Show error]
    Error --> Login

Example 4: Design a Database Schema

When: You're planning table relationships for a new feature.

erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    PRODUCT ||--o{ LINE_ITEM : includes

    USER {
        int id PK
        string email UK
        string name
        datetime created_at
    }

    ORDER {
        int id PK
        int user_id FK
        decimal total
        datetime created_at
    }

Example 5: Visualize System Architecture (C4)

When: You need to show how systems and external services interact.

C4Context
    title System Context Diagram for E-commerce Platform

    Person(customer, "Customer", "A user browsing and purchasing products")
    System(webApp, "Web Application", "Provides product catalog and checkout")
    System_Ext(payment, "Payment Gateway", "Processes payments")
    System_Ext(email, "Email Service", "Sends order confirmations")

    Rel(customer, webApp, "Browses products, places orders")
    Rel(webApp, payment, "Processes payments", "HTTPS")
    Rel(webApp, email, "Sends notifications", "SMTP")

Getting Started

  1. Identify what you need to communicate - Architecture? Flow? Data model?
  2. Choose the appropriate diagram type - See "Diagram Type Selection Guide" in SKILL.md
  3. Start simple - Add core entities/components first
  4. Add relationships - Connect elements with appropriate connectors
  5. Refine and style - Add details, notes, and custom theming
  6. Validate - Test in Mermaid Live Editor
  7. Embed or export - Use in Markdown, export as image, or integrate

Detailed References

For comprehensive syntax and advanced features, see:

Best Practices

  1. Start simple, iterate - Begin with core elements, add complexity gradually
  2. One diagram, one concept - Keep diagrams focused and split large views
  3. Use meaningful names - Clear labels make diagrams self-documenting
  4. Comment liberally - Use %% to explain non-obvious relationships
  5. Version control - Store .mmd files with code, update as system evolves
  6. Add context - Include titles and notes explaining diagram purpose
  7. Validate syntax - Test in Mermaid Live before committing
  8. Keep it readable - Don't overcrowd; split into multiple diagrams if needed

Common Use Cases

  • Onboarding - Help new team members understand system structure
  • Design reviews - Visualize proposals before implementation
  • Documentation - Create living docs that evolve with code
  • Architecture decisions - Align stakeholders on technical choices
  • Refactoring - Plan restructuring with before/after diagrams
  • API handoffs - Document flows for frontend/backend coordination
  • Database migrations - Visualize schema changes

Tips for Success

  • Test incrementally - Validate syntax as you build to catch errors early
  • Use consistent naming - Match diagram names to code/database names
  • Leverage GitHub rendering - Diagrams appear automatically in .md files
  • Export for presentations - Use Mermaid Live or CLI for high-res exports
  • Collaborate - Diagrams are great for PR discussions and design docs
  • Keep updated - Update diagrams when code changes to prevent drift

Tools and Resources

  • Mermaid Live Editor - Interactive editor with instant preview and export
  • Official Documentation - Comprehensive syntax reference
  • Mermaid CLI - npm install -g @mermaid-js/mermaid-cli for batch exports
  • VS Code Extension - "Markdown Preview Mermaid Support" for live preview
  • GitHub - Native rendering in all .md files

Support

For questions, syntax help, or advanced features, refer to:

  • SKILL.md for quick reference
  • Reference files in references/ for detailed syntax
  • Mermaid official docs for latest features

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a comprehensive documentation set and syntax guide for creating software diagrams using Mermaid. It provides clear instructions and examples for various diagram types and references official, well-known tools and resources. No security issues were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    9 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at b00cf84. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
  • Documentation
  • mermaid
  • diagrams
  • visualization
  • architecture
  • flowchart
  • sequence-diagram
  • class-diagram
  • erd
  • c4

README badge

README badge for softaworks/agent-toolkit/mermaid-diagrams

Guides Claude in creating software diagrams using Mermaid's text-based syntax, covering class diagrams for domain modeling, sequence diagrams for API flows, flowcharts for processes, ERDs for database schemas, C4 architecture diagrams, and state/git/gantt charts. Use this skill when documenting system architecture, visualizing code structure, or explaining application flows.

Generated from the current SKILL.md.

What diagram types does this skill support?
Mermaid supports class diagrams, sequence diagrams, flowcharts, entity relationship diagrams, C4 architecture diagrams, state diagrams, git graphs, Gantt charts, and pie/bar charts.
Can I use Mermaid diagrams in GitHub or GitLab?
Yes. GitHub and GitLab automatically render Mermaid diagrams in Markdown files without additional configuration.
How do I export Mermaid diagrams as images?
You can use the Mermaid Live Editor for online export, the Mermaid CLI (`mmdc` command), or Docker to convert `.mmd` files to PNG or SVG.
Does this skill cover styling and theming?
Yes. The skill includes configuration options for themes (default, forest, dark, neutral, base), layout algorithms (dagre, elk), and visual appearance (classic or hand-drawn look).

Generated from the current SKILL.md. These answers refresh after source changes.