mermaid · diff
git:20260329.f7e05de to git:20261030.03f7155
11 added, 25 removed. Audit A to A.
---
name: mermaid
description: Create and validate Mermaid diagrams. Use when creating, editing, or reviewing Mermaid diagrams in markdown files.
user-invocable: true
---
# Mermaid Diagrams
- Create and validate Mermaid diagrams with syntax checking.
-
- ## Diagram Types
-
- | Type | Directive | Use For |
- |------|-----------|---------|
- | Flowchart | `flowchart TB` | Process flows, decision trees, system architecture |
- | Sequence | `sequenceDiagram` | API interactions, message passing, protocols |
- | State | `stateDiagram-v2` | State machines, lifecycles, status transitions |
- | ER | `erDiagram` | Database schemas, entity relationships |
-
- ## Validation
-
- Validate mermaid syntax in markdown files:
+ Write Mermaid diagrams in markdown that parse cleanly. The work is done when the validator exits 0 on every file you touched:
```bash
- bun ${CLAUDE_SKILL_DIR}/scripts/validate.ts <file.md>
+ bun ${CLAUDE_SKILL_DIR}/scripts/validate.ts <file.md>...
```
- ## References
+ It prints each failing block's line and parser message. Add `--json` for structured output.
- - [Flowchart](./references/flowchart.md) — Nodes, edges, subgraphs, layout direction
- - [Sequence](./references/sequence.md) — Participants, messages, activations, loops
- - [State](./references/state.md) — States, transitions, composite states
- - [ER](./references/er.md) — Entities, relationships, cardinality
+ ## Diagram Types
- ## Best Practices
+ | Type | Directive | Use For | Reference |
+ |------|-----------|---------|-----------|
+ | Flowchart | `flowchart TB` | Process flows, decision trees, architecture | [flowchart.md](./references/flowchart.md) |
+ | Sequence | `sequenceDiagram` | API interactions, message passing, protocols | [sequence.md](./references/sequence.md) |
+ | State | `stateDiagram-v2` | State machines, lifecycles | [state.md](./references/state.md) |
+ | ER | `erDiagram` | Database schemas, entity relationships | [er.md](./references/er.md) |
- - Keep labels concise—use full descriptions in surrounding prose
- - Use subgraphs to group related nodes visually
- - Order participants/nodes to minimize edge crossings
- - Prefer left-to-right (`LR`) for timelines, top-to-bottom (`TB`) for hierarchies
+ Write node and message labels in a few words, with full descriptions in the surrounding prose.