mermaid-studio
Expert Mermaid diagram creation, validation, and rendering with dual-engine output (SVG/PNG/ASCII). Supports all 20+ diagram types including C4 architecture, AWS architecture-beta with service icons, flowcharts, sequence, ERD, state, class, mindmap, timeline, git graph, sankey, and more. Features code-to-diagram analysis, batch rendering, 15+ themes, and syntax validation. Use when users ask to create diagrams, visualize architecture, render mermaid files, generate ASCII diagrams, document system flows, model databases, draw AWS infrastructure, analyze code structure, or anything involving "mermaid", "diagram", "flowchart", "architecture diagram", "sequence diagram", "ERD", "C4", "ASCII diagram". Do NOT use for non-Mermaid image generation, data plotting with chart libraries, or general documentation writing.
What this skill does
# Mermaid Studio
Expert-level Mermaid diagram creation, validation, and multi-format rendering. Creates diagrams from descriptions or code analysis, validates syntax, and renders to SVG, PNG, or ASCII with professional theming.
## Golden Rules — Elegant Diagrams by Default
Every diagram MUST follow these principles. They are not optional — they define the difference between a mediocre diagram and a gold-standard one.
### Rule 1: Always Use an Init Directive for Professional Styling
**NEVER** create a diagram without an `%%{init}` directive or frontmatter config. The default Mermaid theme produces harsh black lines and generic colors. Always apply a curated palette.
**For general diagrams (flowchart, sequence, state, class, ERD):**
```
%%{init: {'theme': 'base', 'themeVariables': {
'primaryColor': '#4f46e5', 'primaryTextColor': '#ffffff',
'primaryBorderColor': '#3730a3', 'lineColor': '#94a3b8',
'secondaryColor': '#10b981', 'tertiaryColor': '#f59e0b',
'background': '#ffffff', 'mainBkg': '#f8fafc',
'nodeBorder': '#cbd5e1', 'clusterBkg': '#f1f5f9',
'clusterBorder': '#e2e8f0', 'titleColor': '#1e293b',
'edgeLabelBackground': '#ffffff', 'textColor': '#334155'
}}}%%
```
**⚠️ Font Warning:** Do NOT set `fontFamily` in theme variables. The Mermaid default font (`trebuchet ms, verdana, arial, sans-serif`) works everywhere. Setting `system-ui`, `Segoe UI`, or `-apple-system` will render as Times New Roman in headless Chromium (used by `mmdc`).
**For C4 diagrams — see the dedicated C4 styling section below.**
**For architecture-beta diagrams — see the dedicated AWS/Architecture section below.**
### Rule 2: Soft Lines, Never Harsh Black
The single biggest visual improvement is using `lineColor: '#94a3b8'` (slate-400) instead of the default black. This creates a modern, breathable diagram. For dark themes, use `lineColor: '#64748b'` (slate-500).
### Rule 3: Limit Density — Breathe
- Maximum 15 nodes per diagram (not 20 — fewer is more elegant)
- Use `subgraph` or boundaries to create whitespace and visual grouping
- Prefer LR (left-right) for process flows — it reads more naturally
- Use invisible links (`A ~~~ B`) to add spacing when the layout is cramped
### Rule 4: Meaningful Labels and Consistent Style
- Node IDs: camelCase (`orderService`, not `s1` or `os`)
- Labels: short, clear natural language (`[Order Service]`)
- Arrows: action verbs with protocol info (`"Sends order via gRPC"`)
- Descriptions: one-line, role-focused (`"Handles order lifecycle"`)
### Rule 5: Color Harmony Over Color Variety
Use max 3-4 colors per diagram. Map colors to meaning:
- **Blue tones** (#4f46e5, #3b82f6) → primary systems, internal services
- **Green tones** (#10b981, #059669) → success states, data stores
- **Amber tones** (#f59e0b, #d97706) → external systems, warnings
- **Slate tones** (#64748b, #94a3b8) → lines, borders, secondary elements
- **Red tones** (#ef4444) → errors ONLY, never as decoration
## Modes of Operation
This skill operates in three modes based on user intent:
| Mode | Trigger | What happens |
| ---------- | ------------------------------------------------- | -------------------------- |
| **Create** | "draw a diagram of...", "visualize my..." | Generates .mmd code only |
| **Render** | "render this mermaid", "convert to SVG/PNG/ASCII" | Renders existing .mmd |
| **Full** | "create and render...", ambiguous requests | Create → Validate → Render |
Default to **Full** mode when intent is unclear.
## Step 1: Understand the Request
Before writing any Mermaid code, determine:
1. **What to diagram** — system, flow, schema, architecture, code structure?
2. **Which diagram type** — use the Decision Matrix below
3. **Output format** — code only, SVG, PNG, or ASCII?
4. **Theme preference** — ask only if rendering; default to `base` theme with curated palette
### Diagram Type Decision Matrix
| User describes... | Diagram Type | Syntax keyword |
| ---------------------------------------------- | ------------- | -------------------- |
| Process, algorithm, decision tree, workflow | Flowchart | `flowchart TD/LR` |
| API calls, message passing, request/response | Sequence | `sequenceDiagram` |
| Database schema, table relationships | ERD | `erDiagram` |
| OOP classes, domain model, interfaces | Class | `classDiagram` |
| State machine, lifecycle, transitions | State | `stateDiagram-v2` |
| High-level system overview (C4 Level 1) | C4 Context | `C4Context` |
| Applications, databases, services (C4 Level 2) | C4 Container | `C4Container` |
| Internal components (C4 Level 3) | C4 Component | `C4Component` |
| Request flows with numbered steps | C4 Dynamic | `C4Dynamic` |
| Infrastructure, cloud deployment | C4 Deployment | `C4Deployment` |
| Cloud services with icons (AWS/GCP/Azure) | Architecture | `architecture-beta` |
| Project timeline, scheduling | Gantt | `gantt` |
| Proportional data, percentages | Pie | `pie` |
| Brainstorming, hierarchical ideas | Mindmap | `mindmap` |
| Historical events, chronology | Timeline | `timeline` |
| Branching strategy, git history | Git Graph | `gitGraph` |
| Flow quantities, resource distribution | Sankey | `sankey-beta` |
| X/Y data visualization | XY Chart | `xychart-beta` |
| Priority matrix, strategic positioning | Quadrant | `quadrantChart` |
| Layout control, grid positioning | Block | `block-beta` |
| Network packets, protocol headers | Packet | `packet-beta` |
| Task boards, kanban workflow | Kanban | `kanban` |
| User experience, satisfaction scoring | User Journey | `journey` |
| System requirements traceability | Requirement | `requirementDiagram` |
If the user's description doesn't clearly map to one type, suggest 2-3 options with a brief rationale for each, then let them choose.
### When to Load References
Load reference files ONLY when needed for the specific diagram type:
- **C4 diagrams** → Read `references/c4-architecture.md` BEFORE writing code
- **AWS/Cloud architecture** → Read `references/aws-architecture.md` BEFORE writing code
- **Code-to-diagram** → Read `references/code-to-diagram.md` BEFORE analyzing
- **Theming/styling** → Read `references/themes.md` when user requests custom themes
- **Syntax errors** → Read `references/troubleshooting.md` when validation fails
- **Any diagram type details** → Read `references/diagram-types.md` for comprehensive syntax
## Step 2: Create the Diagram
### 2.1 — Write Mermaid Code
Follow these principles in order of priority:
1. **Elegance first** — every diagram must look professional with init directives and curated colors
2. **Correctness** — valid syntax that renders without errors
3. **Clarity** — meaningful labels, logical flow direction, clear relationships
4. **Simplicity** — under 15 nodes per diagram; split complex systems into multiple
5. **Consistency** — uniform naming (camelCase for IDs, descriptive labels in brackets)
### 2.2 — Structure Rules
```
%% Diagram: [Purpose] | Author: [auto] | Date: [auto]
%%{init: {'theme': 'base', 'themeVariables': { ... }}}%%
[diagramType]
[content]
```
**CRITICAL:** The `%%{init}` directive MUST go on the very first non-comment line, BEFORE the diagram type declaration. Alternatively, use YAML frontmatter at the absolute start of the file.
**Naming conventions:**
- Node IDs: camelCase, descriptivRelated 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.