Mermaid Syntax

by melodic-software

skill

Authoritative reference for Mermaid diagram syntax. Provides diagram types, syntax patterns, examples, and platform integration guidance for generating accurate Mermaid diagrams.

Skill Details

Repository Files

6 files in this skill directory


name: mermaid-syntax description: Authoritative reference for Mermaid diagram syntax. Provides diagram types, syntax patterns, examples, and platform integration guidance for generating accurate Mermaid diagrams. allowed-tools: Read, Glob, Grep

Mermaid Syntax Reference

Overview

Mermaid is a JavaScript-based diagramming tool that renders diagrams from Markdown-inspired text definitions. Diagrams render as SVG directly in browsers and are natively supported by GitHub, GitLab, Azure DevOps, Obsidian, and Notion.

Key advantages:

  • Zero setup (browser-based rendering)
  • Native Markdown integration (diagrams auto-sync with definitions)
  • Simpler syntax than PlantUML
  • No external dependencies

Limitations:

  • Less customization than PlantUML
  • C4 support is experimental
  • No MindMap or JSON visualization

Diagram Types Quick Reference

Type Keyword Best For
Flowchart flowchart or graph Process flows, decision trees, workflows
Sequence sequenceDiagram API calls, request/response flows
Class classDiagram OOP structures, inheritance, relationships
State stateDiagram-v2 State machines, lifecycle states
ER erDiagram Database schemas, entity relationships
Gantt gantt Project timelines, schedules
Pie pie Distribution, proportions
Git Graph gitGraph Branching strategies, commit history
C4 Context C4Context System architecture (experimental)
Timeline timeline Chronological events

Markdown Integration

Mermaid diagrams are embedded in Markdown using fenced code blocks:

```mermaid
flowchart TD
    A[Start] --> B[End]
```

Platform support:

  • GitHub: Native rendering in README, issues, PRs, wikis
  • GitLab: Native rendering in Markdown files
  • Azure DevOps: Native rendering in wikis and repos
  • Obsidian: Native with core plugin
  • VS Code: With Markdown Preview Mermaid Support extension

Quick Reference Card

Flowchart

flowchart TD
    A[Box] --> B{Decision}
    B -->|Yes| C[Action]
    B -->|No| D[Other]

Sequence

sequenceDiagram
    A->>B: Request
    B-->>A: Response

Class

classDiagram
    class Name {
        +attribute type
        +method() return
    }
    A <|-- B : inherits

State

stateDiagram-v2
    [*] --> State1
    State1 --> State2 : event
    State2 --> [*]

ER

erDiagram
    ENTITY1 ||--o{ ENTITY2 : relationship
    ENTITY1 {
        type attribute PK
    }

References

For detailed syntax and complete examples, see:

Reference Content When to Load
flowchart.md Node shapes, edge types, subgraphs Creating flowcharts
sequence.md Participants, arrows, activation, alt/loop Creating sequence diagrams
class.md Classes, visibility, relationships, cardinality Creating class diagrams
state-er.md State machines, ER diagrams, relationships Creating state/ER diagrams
special-diagrams.md Gantt, Git Graph, C4, styling, gotchas Creating special diagrams

Test Scenarios

Scenario 1: Creating a flowchart

Query: "Create a Mermaid flowchart for user registration process"

Expected: Skill activates, provides flowchart syntax with decision nodes and subgraphs

Scenario 2: Creating a sequence diagram

Query: "Generate a Mermaid sequence diagram for API authentication"

Expected: Skill activates, provides sequence syntax with participants and alt/loop blocks

Scenario 3: Creating an ER diagram

Query: "Create a Mermaid ER diagram for a blog database"

Expected: Skill activates, directs to state-er.md reference for entity attributes and relationships


Last Updated: 2025-12-28 Mermaid Version: 10.x / 11.x

Version History

  • v1.1.0 (2025-12-28): Refactored to progressive disclosure - extracted content to references/
  • v1.0.0 (2025-12-26): Initial release

Related Skills

Attack Tree Construction

Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.

skill

Grafana Dashboards

Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.

skill

Matplotlib

Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.

skill

Scientific Visualization

Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.

skill

Seaborn

Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.

skill

Shap

Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Query Writing

For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Scientific Visualization

Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.

skill

Skill Information

Category:Skill
Allowed Tools:Read, Glob, Grep
Last Updated:12/28/2025