Mermaid Diagrams
by Luscii
Create and embed Mermaid diagrams in Markdown files for visualizing documentation, features, architecture, workflows, and processes. Use when asked to "add a diagram", "create a flowchart", "visualize the workflow", "show the architecture", or when documentation needs visual enhancement. Supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, and more.
Skill Details
Repository Files
1 file in this skill directory
name: mermaid-diagrams description: 'Create and embed Mermaid diagrams in Markdown files for visualizing documentation, features, architecture, workflows, and processes. Use when asked to "add a diagram", "create a flowchart", "visualize the workflow", "show the architecture", or when documentation needs visual enhancement. Supports flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, and more.'
Mermaid Diagrams
Create visual diagrams directly in Markdown files using Mermaid syntax. Diagrams render automatically on GitHub, in VS Code, and many other Markdown viewers.
When to Use This Skill
- User asks to "add a diagram", "create a chart", "visualize", or "show graphically"
- Documentation needs visual representation of workflows, processes, or architecture
- Feature files or ADRs would benefit from visual diagrams
- Explaining complex logic flows, state machines, or relationships
- Creating documentation for system architecture or data models
- Visualizing timelines, schedules, or project plans
Supported Diagram Types
| Type | Use For | Example Triggers |
|---|---|---|
| Flowchart | Processes, decision trees, workflows | "show the flow", "decision logic" |
| Sequence Diagram | Interactions, API calls, message flows | "show the sequence", "API interaction" |
| Class Diagram | Object structures, relationships | "class structure", "data model" |
| State Diagram | State machines, transitions | "state transitions", "lifecycle" |
| Entity Relationship | Database schemas, data models | "database schema", "ER diagram" |
| Gantt Chart | Timelines, project schedules | "timeline", "project schedule" |
| Pie Chart | Proportions, distributions | "distribution", "breakdown" |
| Git Graph | Git branching strategies | "git workflow", "branching strategy" |
| Mindmap | Hierarchical concepts | "concept map", "hierarchy" |
| Timeline | Historical events, milestones | "history", "milestones" |
| Quadrant Chart | 2D categorization | "prioritization", "quadrants" |
| User Journey | User experiences, flows | "user flow", "journey map" |
Creating Mermaid Diagrams
Basic Syntax
Wrap Mermaid code in fenced code blocks with mermaid language identifier:
```mermaid
<diagram-type>
<diagram-content>
```
Flowchart Example
```mermaid
flowchart TD
Start([Start]) --> Input[Get User Input]
Input --> Validate{Valid?}
Validate -->|Yes| Process[Process Data]
Validate -->|No| Error[Show Error]
Process --> Save[(Save to DB)]
Save --> End([End])
Error --> Input
```
Sequence Diagram Example
```mermaid
sequenceDiagram
participant User
participant API
participant Database
User->>API: POST /create
API->>Database: INSERT query
Database-->>API: Success
API-->>User: 201 Created
```
Class Diagram Example
```mermaid
classDiagram
class Module {
+String name
+String version
+deploy()
+validate()
}
class Resource {
+String id
+Map tags
}
Module --> Resource : creates
```
State Diagram Example
```mermaid
stateDiagram-v2
[*] --> Pending
Pending --> Running : start
Running --> Completed : success
Running --> Failed : error
Failed --> Pending : retry
Completed --> [*]
```
Entity Relationship Diagram Example
```mermaid
erDiagram
MODULE ||--o{ RESOURCE : creates
MODULE {
string name
string version
string provider
}
RESOURCE {
string id
string type
map tags
}
```
Gantt Chart Example
```mermaid
gantt
title Implementation Timeline
dateFormat YYYY-MM-DD
section Phase 1
Design :2026-01-01, 7d
Implementation :2026-01-08, 14d
section Phase 2
Testing :2026-01-22, 7d
Deployment :2026-01-29, 3d
```
Best Practices
1. Choose the Right Diagram Type
| Need | Recommended Type |
|---|---|
| Show process steps | Flowchart |
| Show interactions | Sequence Diagram |
| Show data structure | Class Diagram or ER Diagram |
| Show state changes | State Diagram |
| Show timeline | Gantt Chart or Timeline |
| Show proportions | Pie Chart |
| Show branching | Git Graph |
| Show concepts | Mindmap |
2. Keep Diagrams Simple
- Limit nodes: 10-15 nodes per diagram (split complex flows)
- Use clear labels: Short, descriptive text
- Avoid clutter: One main concept per diagram
- Use subgraphs: Group related elements
3. Use Consistent Styling
```mermaid
flowchart LR
style Start fill:#90EE90
style End fill:#FFB6C1
style Error fill:#FFA07A
Start --> Process
Process --> End
Process --> Error
```
4. Add Descriptive Context
Always add explanatory text before and/or after diagrams:
## Deployment Workflow
The following diagram shows the complete deployment process from code commit to production:
```mermaid
flowchart TD
Commit --> CI
CI --> Test
Test --> Deploy
```
After deployment, the system automatically runs health checks and monitoring.
Common Patterns
Agent Handoff Workflow
```mermaid
flowchart LR
Plan[Implementation Plan] --> Shaper[Scenario Shaper]
Shaper --> Tester[Terraform Tester]
Tester --> Module[Module Specialist]
Module --> Docs[Documentation]
Docs --> Examples[Examples]
Module -.feedback.-> Tester
Module -.feedback.-> Shaper
Docs -.feedback.-> Module
Examples -.feedback.-> Module
```
TDD Workflow
```mermaid
stateDiagram-v2
[*] --> WriteScenario
WriteScenario --> WriteTest
WriteTest --> RunTest
RunTest --> TestFails
TestFails --> Implement
Implement --> RunTest
RunTest --> TestPasses
TestPasses --> Refactor
Refactor --> [*]
```
Module Architecture
```mermaid
graph TB
subgraph "Module Root"
Main[main.tf]
Vars[variables.tf]
Outputs[outputs.tf]
end
subgraph "Examples"
Basic[examples/basic/]
Complete[examples/complete/]
end
subgraph "Tests"
Unit[tests/unit.tftest.hcl]
Integration[tests/integration.tftest.hcl]
end
Main --> Examples
Tests -.validates.-> Main
```
Troubleshooting
| Issue | Solution |
|---|---|
| Diagram not rendering | Check syntax, ensure language is mermaid not mmd |
| Syntax errors | Validate at Mermaid Live Editor |
| Diagram too complex | Split into multiple smaller diagrams |
| Text overlapping | Use shorter labels or adjust direction (TD, LR, etc.) |
| Links not clickable | Use click syntax: click Node "https://url" |
Advanced Features
Clickable Nodes
```mermaid
flowchart LR
A[Documentation] --> B[Examples]
click A "https://github.com/repo/docs" "View Docs"
click B "https://github.com/repo/examples" "View Examples"
```
Styling and Themes
```mermaid
%%{init: {'theme':'forest'}}%%
flowchart TD
A --> B
```
Available themes: default, forest, dark, neutral, base
Subgraphs for Organization
```mermaid
flowchart TB
subgraph "Frontend"
UI[User Interface]
API[API Client]
end
subgraph "Backend"
Server[API Server]
DB[(Database)]
end
UI --> API
API --> Server
Server --> DB
```
References
- Mermaid Syntax Reference: https://mermaid.js.org/intro/syntax-reference.html
- GitHub Diagrams Documentation: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams
- Mermaid Live Editor: https://mermaid.live/ (for testing/validation)
- Flowchart Syntax: https://mermaid.js.org/syntax/flowchart.html
- Sequence Diagram Syntax: https://mermaid.js.org/syntax/sequenceDiagram.html
- Class Diagram Syntax: https://mermaid.js.org/syntax/classDiagram.html
- State Diagram Syntax: https://mermaid.js.org/syntax/stateDiagram.html
- ER Diagram Syntax: https://mermaid.js.org/syntax/entityRelationshipDiagram.html
- Gantt Chart Syntax: https://mermaid.js.org/syntax/gantt.html
Quick Start Checklist
- Identify what needs visualization
- Choose appropriate diagram type
- Draft diagram structure (nodes, connections, flow)
- Add Mermaid code block to Markdown file
- Validate syntax at mermaid.live
- Add explanatory text around diagram
- Test rendering on GitHub/VS Code
- Refine styling and layout if needed
Related Skills
Team Composition Analysis
This skill should be used when the user asks to "plan team structure", "determine hiring needs", "design org chart", "calculate compensation", "plan equity allocation", or requests organizational design and headcount planning for a startup.
Startup Financial Modeling
This skill should be used when the user asks to "create financial projections", "build a financial model", "forecast revenue", "calculate burn rate", "estimate runway", "model cash flow", or requests 3-5 year financial planning for a startup.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Startup Metrics Framework
This skill should be used when the user asks about "key startup metrics", "SaaS metrics", "CAC and LTV", "unit economics", "burn multiple", "rule of 40", "marketplace metrics", or requests guidance on tracking and optimizing business performance metrics.
Market Sizing Analysis
This skill should be used when the user asks to "calculate TAM", "determine SAM", "estimate SOM", "size the market", "calculate market opportunity", "what's the total addressable market", or requests market sizing analysis for a startup or business opportunity.
Clinical Decision Support
Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug develo
Anndata
This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.
Geopandas
Python library for working with geospatial vector data including shapefiles, GeoJSON, and GeoPackage files. Use when working with geographic data for spatial analysis, geometric operations, coordinate transformations, spatial joins, overlay operations, choropleth mapping, or any task involving reading/writing/analyzing vector geographic data. Supports PostGIS databases, interactive maps, and integration with matplotlib/folium/cartopy. Use for tasks like buffer analysis, spatial joins between dat
Market Research Reports
Generate comprehensive market research reports (50+ pages) in the style of top consulting firms (McKinsey, BCG, Gartner). Features professional LaTeX formatting, extensive visual generation with scientific-schematics and generate-image, deep integration with research-lookup for data gathering, and multi-framework strategic analysis including Porter's Five Forces, PESTLE, SWOT, TAM/SAM/SOM, and BCG Matrix.
Plotly
Interactive scientific and statistical data visualization library for Python. Use when creating charts, plots, or visualizations including scatter plots, line charts, bar charts, heatmaps, 3D plots, geographic maps, statistical distributions, financial charts, and dashboards. Supports both quick visualizations (Plotly Express) and fine-grained customization (graph objects). Outputs interactive HTML or static images (PNG, PDF, SVG).
