mermaid
Generate Mermaid diagrams (.mmd, .mermaid files, or markdown code blocks) for flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, Gantt charts, pie charts, mindmaps, timelines, and git graphs. Use when user requests diagrams for documentation, markdown files, README visualizations, or any text-based diagram format that renders in GitHub/GitLab. Triggers on requests mentioning Mermaid, markdown diagrams, documentation diagrams, or when output needs to be embedded in markdown.
What this skill does
# Mermaid Diagram Generation
Generate text-based diagrams using Mermaid syntax. Mermaid diagrams render directly in GitHub, GitLab, Notion, and many markdown viewers.
## Quick Start
Minimal flowchart:
```mermaid
flowchart TD
A[Start] --> B[End]
```
## Output Formats
1. **Markdown code block** - Embed in `.md` files:
````markdown
```mermaid
flowchart TD
A --> B
```
````
2. **Standalone file** - `.mmd` or `.mermaid` extension:
```
flowchart TD
A --> B
```
## Workflow
1. **Identify diagram type** - Match user intent to diagram type
2. **Plan structure** - List nodes/entities and relationships
3. **Generate syntax** - Write Mermaid code following type-specific patterns
4. **Output** - Write to file or embed in markdown
## Diagram Types Overview
### Flowchart
Direction: `TD` (top-down), `LR` (left-right), `BT`, `RL`
```mermaid
flowchart TD
A[Start] --> B{Decision?}
B -->|Yes| C[Process]
B -->|No| D[End]
C --> D
```
### Sequence Diagram
```mermaid
sequenceDiagram
participant U as User
participant S as Server
U->>S: Request
S-->>U: Response
```
### Class Diagram
```mermaid
classDiagram
class Animal {
+String name
+makeSound()
}
class Dog {
+bark()
}
Animal <|-- Dog
```
### Entity Relationship (ER)
```mermaid
erDiagram
USER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : "ordered in"
```
### State Diagram
```mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Processing : start
Processing --> Done : complete
Done --> [*]
```
### Gantt Chart
```mermaid
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Phase 1
Task A :a1, 2024-01-01, 30d
Task B :after a1, 20d
```
### Pie Chart
```mermaid
pie title Distribution
"Category A" : 40
"Category B" : 30
"Category C" : 30
```
### Mindmap
```mermaid
mindmap
root((Central Topic))
Branch A
Leaf 1
Leaf 2
Branch B
Leaf 3
```
### Timeline
```mermaid
timeline
title History
2020 : Event A
2021 : Event B
2022 : Event C
```
### Git Graph
```mermaid
gitGraph
commit
branch develop
checkout develop
commit
checkout main
merge develop
commit
```
## Node Shapes (Flowchart)
| Shape | Syntax | Use For |
|-------|--------|---------|
| Rectangle | `[text]` | Process/action |
| Rounded | `(text)` | Start/end |
| Stadium | `([text])` | Terminal |
| Subroutine | `[[text]]` | Subprocess |
| Database | `[(text)]` | Data store |
| Circle | `((text))` | Connector |
| Diamond | `{text}` | Decision |
| Hexagon | `{{text}}` | Preparation |
| Parallelogram | `[/text/]` | Input/Output |
| Trapezoid | `[/text\]` | Manual operation |
## Arrow Types
| Arrow | Syntax | Meaning |
|-------|--------|---------|
| Solid | `-->` | Flow |
| Dotted | `-.->` | Optional/async |
| Thick | `==>` | Important |
| With text | `-->|label|` | Labeled flow |
| Open | `---` | Association |
## Styling
### Inline styling
```mermaid
flowchart TD
A[Start]:::green --> B[End]:::red
classDef green fill:#90EE90
classDef red fill:#FFB6C1
```
### Theme configuration
```mermaid
%%{init: {'theme': 'forest'}}%%
flowchart TD
A --> B
```
Available themes: `default`, `forest`, `dark`, `neutral`, `base`
## Critical Rules
1. **Indentation** - Use consistent 4-space indentation
2. **Node IDs** - Use short, unique identifiers (A, B, node1)
3. **Special characters** - Wrap text with special chars in quotes: `A["Text with (parens)"]`
4. **Subgraphs** - Close with `end` keyword
5. **No trailing whitespace** - Can cause parsing issues
## Subgraphs (Flowchart)
```mermaid
flowchart TD
subgraph Group1[First Group]
A --> B
end
subgraph Group2[Second Group]
C --> D
end
B --> C
```
## When to Use Mermaid
- Documentation in markdown files
- README diagrams (GitHub/GitLab render natively)
- Sequence diagrams for API flows
- Class diagrams for OOP design
- ER diagrams for database schema
- Gantt charts for project planning
- Quick diagrams that don't need precise positioning
## References
See `references/diagram-types.md` for complete examples of each diagram type.
See `references/syntax-reference.md` for detailed syntax and configuration options.
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate 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 development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.