mermaid-diagrams
Guide for creating syntactically correct Mermaid diagrams that render properly on GitHub
What this skill does
# Mermaid Diagrams Skill
Use Mermaid syntax to create clear, maintainable diagrams directly in markdown. Mermaid diagrams are rendered by GitHub, GitLab, and many documentation tools.
## When to Use Mermaid
- **Flowcharts**: Process flows, decision trees, algorithms
- **Sequence Diagrams**: API calls, user interactions, system communication
- **Class Diagrams**: Object relationships, database schemas
- **State Diagrams**: State machines, workflow states
- **Entity Relationship Diagrams**: Database design
- **Gantt Charts**: Project timelines, task scheduling
- **Git Graphs**: Branch strategies, release flows
## IMPORTANT INSTRUCTIONS
### 1. NEVER use parentheses inside a label
**Using parentheses inside a label causes syntax errors when rendering on GitHub.**
**NEVER DO THIS:**
```mermaid
flowchart TD
Start[Start agent loop (beginning)]
Criteria[Define completion criteria checklist 3-5]
ShowCriteria[Show criteria to user for approval]
CriteriaOK{User approved (causes errors)}
```
**ALWAYS DO THIS INSTEAD:**
```mermaid
flowchart TD
Start[Start agent loop - beginning]
Criteria[Define completion criteria checklist 3-5]
ShowCriteria[Show criteria to user for approval]
CriteriaOK{User approved}
```
### 2. ALWAYS ensure that labels are wrapped in matching brackets
**Labels must have matching opening and closing brackets based on their shape.**
**CORRECT - Matching brackets:**
```mermaid
flowchart TD
Start[Start agent loop]
Criteria[Define completion criteria checklist 3-5]
ShowCriteria[Show criteria to user for approval]
CriteriaOK{User approved}
```
**INCORRECT - Mismatched brackets:**
```mermaid
flowchart TD
Start[Start agent loop]
Criteria[Define completion criteria checklist 3-5]
ShowCriteria[Show criteria to user for approval]
CriteriaOK{User approved]
```
Notice that the brackets do not match on the label for CriteriaOK (`{` opens but `]` closes).
## Basic Syntax Examples
### Flowchart
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
```
### Sequence Diagram
```mermaid
sequenceDiagram
participant Client
participant API
participant Database
Client->>API: Request data
API->>Database: Query
Database-->>API: Results
API-->>Client: Response
```
### Class Diagram
```mermaid
classDiagram
class User {
+String name
+String email
+login()
+logout()
}
class Post {
+String title
+String content
+publish()
}
User "1" --> "*" Post : creates
```
### State Diagram
```mermaid
stateDiagram-v2
[*] --> Draft
Draft --> Review: submit
Review --> Published: approve
Review --> Draft: reject
Published --> [*]
```
### Entity Relationship Diagram
```mermaid
erDiagram
USER ||--o{ POST : creates
USER {
int id PK
string name
string email
}
POST {
int id PK
int user_id FK
string title
text content
}
```
## Best Practices
1. **Keep it Simple**: Start with basic shapes and relationships
2. **Use Descriptive Labels**: Make node names clear and meaningful
3. **Limit Complexity**: Break complex diagrams into multiple smaller ones
4. **Add Context**: Include a brief description above the diagram
5. **Test Rendering**: Verify diagrams render correctly in your target environment
## Common Patterns
### API Flow
```mermaid
sequenceDiagram
participant U as User
participant F as Frontend
participant A as API
participant D as Database
U->>F: Click button
F->>A: POST /api/resource
A->>D: INSERT data
D-->>A: Success
A-->>F: 201 Created
F-->>U: Show confirmation
```
### Decision Flow
```mermaid
flowchart TD
Start[Receive Request] --> Auth{Authenticated?}
Auth -->|No| Reject[Return 401]
Auth -->|Yes| Valid{Valid Input?}
Valid -->|No| BadReq[Return 400]
Valid -->|Yes| Process[Process Request]
Process --> Success[Return 200]
```
### System Architecture
```mermaid
flowchart LR
Client[Client App]
LB[Load Balancer]
API1[API Server 1]
API2[API Server 2]
Cache[(Redis Cache)]
DB[(Database)]
Client --> LB
LB --> API1
LB --> API2
API1 --> Cache
API2 --> Cache
API1 --> DB
API2 --> DB
```
## Syntax Reference
### Node Shapes
- `[Rectangle]` - Basic box
- `(Rounded)` - Rounded edges
- `{Diamond}` - Decision point
- `([Stadium])` - Pill shape
- `[[Subroutine]]` - Double border
- `[(Database)]` - Cylinder
- `((Circle))` - Circle
### Arrow Types
- `-->` - Solid arrow
- `-.->` - Dotted arrow
- `==>` - Thick arrow
- `--text-->` - Labeled arrow
- `---` - Line (no arrow)
### Styling
```mermaid
flowchart TD
A[Normal]
B[Highlighted]
style B fill:#f96,stroke:#333,stroke-width:4px
```
## Tips for Documentation
1. **Inline Diagrams**: Embed directly in documentation for context
2. **Version Control**: Mermaid is text, so it diffs well in git
3. **Collaboration**: Team members can edit without special tools
4. **Automation**: Generate diagrams from code or data
5. **Accessibility**: Add alt text descriptions for screen readers
## Resources
- [Mermaid Official Docs](https://mermaid.js.org/)
- [Live Editor](https://mermaid.live/)
- GitHub/GitLab automatically render Mermaid in markdown
## Tool Usage
When asked to create diagrams:
1. Choose the appropriate Mermaid diagram type
2. **NEVER use parentheses inside labels** - use dashes or commas instead
3. **ALWAYS ensure brackets match** - `[...]`, `{...}`, `(...)`, etc.
4. Use clear, descriptive labels
5. Keep complexity manageable
6. Add a brief description above the diagram
7. Verify syntax is correct (no trailing commas, proper formatting)
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.