Mermaid Diagram Creator

Mermaid diagrams

by davila7 · MIT license · ★ 32,299 on GitHub

Mermaid diagrams cover

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…

---
name: mermaid-diagrams
description: 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.
---

# Mermaid Diagramming

Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.

## Core Syntax Structure

All Mermaid diagrams follow this pattern:

```mermaid
diagramType
  definition content
```

Overview

Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.

Manual install (npx, ZIP)
Claude Codenpx skills add davila7/claude-code-templates --skill mermaid-diagrams -g -a claude-code
Claude Code (degit)npx degit davila7/claude-code-templates/cli-tool/components/skills/creative-design/mermaid-diagrams#main ~/.claude/skills/mermaid-diagrams
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md7.2 KB
Read SKILL.md here
davila7/main1 file shown
SKILL.md
Show the full text217 lines

Mermaid Diagramming

Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.

Core Syntax Structure

All Mermaid diagrams follow this pattern:

diagramType
  definition content

Key principles:

  • First line declares diagram type (e.g., classDiagram, sequenceDiagram, flowchart)
  • Use %% for comments
  • Line breaks and indentation improve readability but aren't required
  • Unknown words break diagrams; parameters fail silently

Diagram Type Selection Guide

Choose the right diagram type:

  1. Class Diagrams - Domain modeling, OOP design, entity relationships

    • Domain-driven design documentation
    • Object-oriented class structures
    • Entity relationships and dependencies
  2. Sequence Diagrams - Temporal interactions, message flows

    • API request/response flows
    • User authentication flows
    • System component interactions
    • Method call sequences
  3. Flowcharts - Processes, algorithms, decision trees

    • User journeys and workflows
    • Business processes
    • Algorithm logic
    • Deployment pipelines
  4. Entity Relationship Diagrams (ERD) - Database schemas

    • Table relationships
    • Data modeling
    • Schema design
  5. C4 Diagrams - Software architecture at multiple levels

    • System Context (systems and users)
    • Container (applications, databases, services)
    • Component (internal structure)
    • Code (class/interface level)
  6. State Diagrams - State machines, lifecycle states

  7. Git Graphs - Version control branching strategies

  8. Gantt Charts - Project timelines, scheduling

  9. Pie/Bar Charts - Data visualization

Quick Start Examples

Class Diagram (Domain Model)
classDiagram
    Title -- Genre
    Title *-- Season
    Title *-- Review
    User --> Review : creates
    
    class Title {
        +string name
        +int releaseYear
        +play()
    }
    
    class Genre {
        +string name
        +getTopTitles()
    }
Sequence Diagram (API Flow)
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
Flowchart (User Journey)
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
ERD (Database Schema)
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
    }

Detailed References

For in-depth guidance on specific diagram types, see:

Best Practices

  1. Start Simple - Begin with core entities/components, add details incrementally
  2. Use Meaningful Names - Clear labels make diagrams self-documenting
  3. Comment Extensively - Use %% comments to explain complex relationships
  4. Keep Focused - One diagram per concept; split large diagrams into multiple focused views
  5. Version Control - Store .mmd files alongside code for easy updates
  6. Add Context - Include titles and notes to explain diagram purpose
  7. Iterate - Refine diagrams as understanding evolves

Configuration and Theming

Configure diagrams using frontmatter:

---
config:
  theme: base
  themeVariables:
    primaryColor: "#ff6b6b"
---
flowchart LR
    A --> B

Available themes: default, forest, dark, neutral, base

Layout options:

  • layout: dagre (default) - Classic balanced layout
  • layout: elk - Advanced layout for complex diagrams (requires integration)

Look options:

  • look: classic - Traditional Mermaid style
  • look: handDrawn - Sketch-like appearance

Exporting and Rendering

Native support in:

  • GitHub/GitLab - Automatically renders in Markdown
  • VS Code - With Markdown Mermaid extension
  • Notion, Obsidian, Confluence - Built-in support

Export options:

  • Mermaid Live Editor - Online editor with PNG/SVG export
  • Mermaid CLI - npm install -g @mermaid-js/mermaid-cli then mmdc -i input.mmd -o output.png
  • Docker - docker run --rm -v $(pwd):/data minlag/mermaid-cli -i /data/input.mmd -o /data/output.png

Common Pitfalls

  • Breaking characters - Avoid {} in comments, use proper escape sequences for special characters
  • Syntax errors - Misspellings break diagrams; validate syntax in Mermaid Live
  • Overcomplexity - Split complex diagrams into multiple focused views
  • Missing relationships - Document all important connections between entities

When to Create Diagrams

Always diagram when:

  • Starting new projects or features
  • Documenting complex systems
  • Explaining architecture decisions
  • Designing database schemas
  • Planning refactoring efforts
  • Onboarding new team members

Use diagrams to:

  • Align stakeholders on technical decisions
  • Document domain models collaboratively
  • Visualize data flows and system interactions
  • Plan before coding
  • Create living documentation that evolves with code
1---
2name: mermaid-diagrams
3description: 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.
4---
5 
6# Mermaid Diagramming
7 
8Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.
9 
10## Core Syntax Structure
11 
12All Mermaid diagrams follow this pattern:
13 
14```mermaid
15diagramType
16 definition content
17```
18 
19**Key principles:**
20- First line declares diagram type (e.g., `classDiagram`, `sequenceDiagram`, `flowchart`)
21- Use `%%` for comments
22- Line breaks and indentation improve readability but aren't required
23- Unknown words break diagrams; parameters fail silently
24 
25## Diagram Type Selection Guide
26 
27**Choose the right diagram type:**
28 
291. **Class Diagrams** - Domain modeling, OOP design, entity relationships
30 - Domain-driven design documentation
31 - Object-oriented class structures
32 - Entity relationships and dependencies
33 
342. **Sequence Diagrams** - Temporal interactions, message flows
35 - API request/response flows
36 - User authentication flows
37 - System component interactions
38 - Method call sequences
39 
403. **Flowcharts** - Processes, algorithms, decision trees
41 - User journeys and workflows
42 - Business processes
43 - Algorithm logic
44 - Deployment pipelines
45 
464. **Entity Relationship Diagrams (ERD)** - Database schemas
47 - Table relationships
48 - Data modeling
49 - Schema design
50 
515. **C4 Diagrams** - Software architecture at multiple levels
52 - System Context (systems and users)
53 - Container (applications, databases, services)
54 - Component (internal structure)
55 - Code (class/interface level)
56 
576. **State Diagrams** - State machines, lifecycle states
587. **Git Graphs** - Version control branching strategies
598. **Gantt Charts** - Project timelines, scheduling
609. **Pie/Bar Charts** - Data visualization
61 
62## Quick Start Examples
63 
64### Class Diagram (Domain Model)
65```mermaid
66classDiagram
67 Title -- Genre
68 Title *-- Season
69 Title *-- Review
70 User --> Review : creates
71 
72 class Title {
73 +string name
74 +int releaseYear
75 +play()
76 }
77 
78 class Genre {
79 +string name
80 +getTopTitles()
81 }
82```
83 
84### Sequence Diagram (API Flow)
85```mermaid
86sequenceDiagram
87 participant User
88 participant API
89 participant Database
90 
91 User->>API: POST /login
92 API->>Database: Query credentials
93 Database-->>API: Return user data
94 alt Valid credentials
95 API-->>User: 200 OK + JWT token
96 else Invalid credentials
97 API-->>User: 401 Unauthorized
98 end
99```
100 
101### Flowchart (User Journey)
102```mermaid
103flowchart TD
104 Start([User visits site]) --> Auth{Authenticated?}
105 Auth -->|No| Login[Show login page]
106 Auth -->|Yes| Dashboard[Show dashboard]
107 Login --> Creds[Enter credentials]
108 Creds --> Validate{Valid?}
109 Validate -->|Yes| Dashboard
110 Validate -->|No| Error[Show error]
111 Error --> Login
112```
113 
114### ERD (Database Schema)
115```mermaid
116erDiagram
117 USER ||--o{ ORDER : places
118 ORDER ||--|{ LINE_ITEM : contains
119 PRODUCT ||--o{ LINE_ITEM : includes
120 
121 USER {
122 int id PK
123 string email UK
124 string name
125 datetime created_at
126 }
127 
128 ORDER {
129 int id PK
130 int user_id FK
131 decimal total
132 datetime created_at
133 }
134```
135 
136## Detailed References
137 
138For in-depth guidance on specific diagram types, see:
139 
140- **[references/class-diagrams.md](references/class-diagrams.md)** - Domain modeling, relationships (association, composition, aggregation, inheritance), multiplicity, methods/properties
141- **[references/sequence-diagrams.md](references/sequence-diagrams.md)** - Actors, participants, messages (sync/async), activations, loops, alt/opt/par blocks, notes
142- **[references/flowcharts.md](references/flowcharts.md)** - Node shapes, connections, decision logic, subgraphs, styling
143- **[references/erd-diagrams.md](references/erd-diagrams.md)** - Entities, relationships, cardinality, keys, attributes
144- **[references/c4-diagrams.md](references/c4-diagrams.md)** - System context, container, component diagrams, boundaries
145- **[references/advanced-features.md](references/advanced-features.md)** - Themes, styling, configuration, layout options
146 
147## Best Practices
148 
1491. **Start Simple** - Begin with core entities/components, add details incrementally
1502. **Use Meaningful Names** - Clear labels make diagrams self-documenting
1513. **Comment Extensively** - Use `%%` comments to explain complex relationships
1524. **Keep Focused** - One diagram per concept; split large diagrams into multiple focused views
1535. **Version Control** - Store `.mmd` files alongside code for easy updates
1546. **Add Context** - Include titles and notes to explain diagram purpose
1557. **Iterate** - Refine diagrams as understanding evolves
156 
157## Configuration and Theming
158 
159Configure diagrams using frontmatter:
160 
161```mermaid
162---
163config:
164 theme: base
165 themeVariables:
166 primaryColor: "#ff6b6b"
167---
168flowchart LR
169 A --> B
170```
171 
172**Available themes:** default, forest, dark, neutral, base
173 
174**Layout options:**
175- `layout: dagre` (default) - Classic balanced layout
176- `layout: elk` - Advanced layout for complex diagrams (requires integration)
177 
178**Look options:**
179- `look: classic` - Traditional Mermaid style
180- `look: handDrawn` - Sketch-like appearance
181 
182## Exporting and Rendering
183 
184**Native support in:**
185- GitHub/GitLab - Automatically renders in Markdown
186- VS Code - With Markdown Mermaid extension
187- Notion, Obsidian, Confluence - Built-in support
188 
189**Export options:**
190- [Mermaid Live Editor](https://mermaid.live) - Online editor with PNG/SVG export
191- Mermaid CLI - `npm install -g @mermaid-js/mermaid-cli` then `mmdc -i input.mmd -o output.png`
192- Docker - `docker run --rm -v $(pwd):/data minlag/mermaid-cli -i /data/input.mmd -o /data/output.png`
193 
194## Common Pitfalls
195 
196- **Breaking characters** - Avoid `{}` in comments, use proper escape sequences for special characters
197- **Syntax errors** - Misspellings break diagrams; validate syntax in Mermaid Live
198- **Overcomplexity** - Split complex diagrams into multiple focused views
199- **Missing relationships** - Document all important connections between entities
200 
201## When to Create Diagrams
202 
203**Always diagram when:**
204- Starting new projects or features
205- Documenting complex systems
206- Explaining architecture decisions
207- Designing database schemas
208- Planning refactoring efforts
209- Onboarding new team members
210 
211**Use diagrams to:**
212- Align stakeholders on technical decisions
213- Document domain models collaboratively
214- Visualize data flows and system interactions
215- Plan before coding
216- Create living documentation that evolves with code
217 
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 32,299
Checked
Source
davila7/claude-code-templates ↗
Creator
davila7 · 212 listings
View creator

Similar skills

See all →
SkillCustom Diagram Designercathrynlavery/diagram-design · by cathrynlaveryCreate branded architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap and marimekko, heatmap, bar and dumbbell, waterfall, line (slopegraph, ridgeline, streamgraph, bump), Gantt and scatter charts (bubble, beeswarm), high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as HTML/SVG/PNG, with .drawio, Mermaid, and .excalidraw import, plus lifecycle phase maps, block decomposition trees, and onboarding guidance.★ 43.2k GitHub starsSkillArchitecture Pattern Reviewerpascalorg/editor · by pascalorgReview a PR against the Pascal architectural rules — package boundaries (core/viewer/editor/nodes), the registry-driven composition model (def.geometry / def.renderer / def.system), legacy-dispatch regressions, the slots + world-scale-UV convention for new nodes/geometry, hook hygiene (useEditor/useScene/useViewer), and selector performance. Use when the user asks to review a PR, audit a branch, or check that changes respect the codebase's architecture.★ 24.6k GitHub starsSkillArchitecture Diagram CreatorAgents365-ai/drawio-skill · by Agents365-aiCreate and edit draw.io/diagrams.net diagrams as editable `.drawio` files. Covers architecture, UML/ERD/sequence, BPMN, network, and swimlane views authored from a description or converted from code, IaC, SQL, and API schemas, plus sync, query, test, review, export, and publish of existing diagrams. Use when the user asks for draw.io/diagrams.net or an editable diagram; prefer Mermaid/PlantUML when diagrams-as-code is enough.★ 9.8k GitHub starsSkillArchitecture Diagram GeneratorCocoon-AI/architecture-diagram-generator · by Cocoon-AICreate polished dark-themed architecture diagrams as self-contained HTML+SVG files. Use when the user asks for system, infrastructure, cloud, security, or network topology diagrams.★ 7.4k GitHub starsSkillLLM Knowledge DistillationAr9av/obsidian-wiki · by Ar9avThe foundational knowledge distillation pattern for building and maintaining an AI-powered Obsidian wiki. Based on Andrej Karpathy's LLM Wiki architecture. Use this skill whenever the user wants to understand the wiki pattern, set up a new knowledge base, or needs guidance on the three-layer architecture (raw sources → wiki → schema). Also use when discussing knowledge management strategy, wiki structure decisions, or how to organize distilled knowledge. This is the "theory" skill — other skills handle specific operations (ingesting, querying, linting).★ 3.5k GitHub starsSkillSoftware Design Philosophywondelai/skills · by wondelaiManage software complexity through deep modules, information hiding, and strategic programming. Use when the user mentions "module design", "API too complex", "shallow class", "complexity budget", "strategic vs tactical", "deep module", "information leakage", "pass-through method", "this code is over-engineered", or "simplify this design". Also trigger when reviewing an interface for simplicity, evaluating whether an abstraction is pulling its weight, deciding whether a comment is worth writing, or choosing between general-purpose and special-purpose approaches. Covers deep vs shallow modules, red flags for complexity, and comments as design documentation. For code quality, see clean-code. For architecture boundaries, see clean-architecture.★ 2.2k GitHub stars

More from davila7

Skill2D Game Developmentdavila7/claude-code-templates · by davila72D game development principles. Sprites, tilemaps, physics, camera.★ 32.3k GitHub starsSkill3D Game Development Principlesdavila7/claude-code-templates · by davila73D game development principles. Rendering, shaders, physics, cameras.★ 32.3k GitHub starsSkill3D Web Experience Builderdavila7/claude-code-templates · by davila7Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.★ 32.3k GitHub starsSkillSplit Test Setupdavila7/claude-code-templates · by davila7When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," or "hypothesis." For tracking implementation, see analytics-tracking.★ 32.3k GitHub starsAgentResearch Literature Synthesizerdavila7/claude-code-templates · by davila7Academic research synthesis specialist. Use PROACTIVELY for comprehensive research on academic topics, literature reviews, technical investigations, and well-cited analysis combining multiple sources. <example>Context: A podcast episode needs a segment grounded in peer-reviewed evidence with formal citations. user: "Research the current state of transformer efficiency techniques for the episode, with proper academic citations." assistant: "I'll use the academic-research-synthesizer agent to search arXiv and Semantic Scholar, extract full-text findings via WebFetch, and produce a cited literature synthesis with confidence levels." <commentary>Use academic-research-synthesizer (not comprehensive-researcher) when the episode segment needs peer-reviewed sourcing, formal citation format, and explicit confidence tagging rather than general-purpose multi-source coverage.</commentary></example> <example>Context: The episode-orchestrator has routed a "literature review" request for a technical deep-dive segment. user: "Summarize the research landscape on federated learning privacy guarantees." assistant: "I'll invoke academic-research-synthesizer to systematically search academic sources, note peer-review status per source, and synthesize consensus vs. open debates."</example>★ 32.3k GitHub starsAgentAcademic Research Specialistdavila7/claude-code-templates · by davila7Academic research specialist for scholarly sources, peer-reviewed papers, and academic literature. Use PROACTIVELY for research paper analysis, literature reviews, citation tracking, and academic methodology evaluation. <example>Context: The research-orchestrator has kicked off Phase 4 parallel research on 'efficacy of intermittent fasting' and needs peer-reviewed evidence. user: "Find the academic evidence on intermittent fasting outcomes." assistant: "I'll use the academic-researcher agent to search Semantic Scholar, PubMed, and OpenAlex for peer-reviewed studies and write structured findings to academic-research.md." <commentary>The request is specifically for scholarly/peer-reviewed evidence rather than general web coverage or code, so academic-researcher (not web-researcher or technical-researcher) is the right specialist.</commentary></example> <example>Context: The user wants a literature review comparing methodologies across studies on a topic. user: "Can you review the literature on transformer model interpretability and identify research gaps?" assistant: "Let me invoke the academic-researcher agent to pull foundational and recent papers, extract methodologies, and surface open research gaps." <commentary>Literature review, methodology extraction, and research-gap identification are core academic-researcher capabilities, distinct from technical-researcher's focus on code repositories and implementations.</commentary></example>★ 32.3k GitHub stars