| name | CURV Mermaid Diagrams |
| description | Create perfectly styled Mermaid diagrams with black background, white transparent nodes, readable white text, proper spacing, and legend placement that never overlaps nodes. CURV brand accent options included. |
| when_to_use | For ANY diagram creation: flowcharts, system architecture, process flows, decision trees, workflows, sequence diagrams, state machines, entity relationships, git graphs, or any visual logic representation |
| version | 1.0.0 |
| dependencies | mermaid.js |
CURV Mermaid Diagrams - Styling & Layout Skill
🎯 CORE PRINCIPLE
Black backgrounds, white transparent nodes, zero overlap, CURV accents
Every Mermaid diagram must:
- Black background (#000000)
- White transparent nodes (no fill, visible text)
- White connectors/lines
- Legend OUTSIDE diagram (never overlaps)
- Proper spacing (minimum 100px between nodes)
- Optional CURV purple accents for highlights
📐 DEFAULT CONFIGURATION
Base Mermaid Init
%%{init: {
'theme':'dark',
'themeVariables': {
'primaryColor':'#000000',
'primaryTextColor':'#ffffff',
'primaryBorderColor':'#ffffff',
'lineColor':'#ffffff',
'secondaryColor':'#000000',
'tertiaryColor':'#000000',
'fontSize':'16px',
'fontFamily':'Inter, sans-serif'
},
'flowchart': {
'nodeSpacing': 100,
'rankSpacing': 80,
'padding': 40,
'curve': 'basis'
}
}}%%
Node Class Definitions
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
classDef highlight fill:transparent,stroke:#9d4edd,stroke-width:3px,color:#ffffff
classDef accent fill:transparent,stroke:#c084fc,stroke-width:2px,color:#ffffff
classDef success fill:transparent,stroke:#10b981,stroke-width:2px,color:#ffffff
classDef warning fill:transparent,stroke:#f59e0b,stroke-width:2px,color:#ffffff
classDef error fill:transparent,stroke:#ef4444,stroke-width:2px,color:#ffffff
classDef dashed fill:transparent,stroke:#ffffff,stroke-width:2px,stroke-dasharray:5,color:#ffffff
🎨 ARTIFACT STRUCTURE
Always create Mermaid diagrams as complete HTML artifacts with this structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mermaid Diagram</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000000;
color: #ffffff;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
padding: 40px;
min-height: 100vh;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
h1 {
font-size: 2rem;
margin-bottom: 10px;
color: #ffffff;
}
.subtitle {
color: #cccccc;
margin-bottom: 40px;
font-size: 1.1rem;
}
.diagram-container {
background: #000000;
padding: 40px;
border: 1px solid #ffffff;
border-radius: 12px;
margin-bottom: 40px;
}
.mermaid {
display: flex;
justify-content: center;
background: #000000;
}
/* Legend styling - OUTSIDE diagram to prevent overlap */
.legend {
background: rgba(0, 0, 0, 0.9);
border: 1px solid #ffffff;
border-radius: 8px;
padding: 24px;
margin-top: 40px;
}
.legend h3 {
font-size: 1.2rem;
margin-bottom: 16px;
color: #ffffff;
}
.legend-items {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
}
.legend-item {
display: flex;
align-items: center;
gap: 12px;
padding: 8px;
color: #ffffff;
}
.legend-symbol {
width: 40px;
height: 30px;
border: 2px solid #ffffff;
border-radius: 4px;
background: transparent;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.legend-symbol.highlight {
border-color: #9d4edd;
border-width: 3px;
}
.legend-symbol.accent {
border-color: #c084fc;
}
.legend-symbol.success {
border-color: #10b981;
}
.legend-symbol.warning {
border-color: #f59e0b;
}
.legend-symbol.error {
border-color: #ef4444;
}
.legend-symbol.dashed {
border-style: dashed;
}
.legend-arrow {
width: 40px;
height: 2px;
background: #ffffff;
position: relative;
}
.legend-arrow::after {
content: '';
position: absolute;
right: 0;
top: -4px;
width: 0;
height: 0;
border-left: 8px solid #ffffff;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
}
</style>
</head>
<body>
<div class="container">
<h1>Diagram Title</h1>
<p class="subtitle">Brief description of diagram purpose</p>
<div class="diagram-container">
<div class="mermaid">
%%{init: {
'theme':'dark',
'themeVariables': {
'primaryColor':'#000000',
'primaryTextColor':'#ffffff',
'primaryBorderColor':'#ffffff',
'lineColor':'#ffffff',
'secondaryColor':'#000000',
'tertiaryColor':'#000000',
'fontSize':'16px'
},
'flowchart': {
'nodeSpacing': 100,
'rankSpacing': 80,
'padding': 40
}
}}%%
flowchart TB
A[Node 1] --> B[Node 2]
B --> C[Node 3]
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
</div>
</div>
<!-- LEGEND OUTSIDE DIAGRAM -->
<div class="legend">
<h3>Legend</h3>
<div class="legend-items">
<div class="legend-item">
<div class="legend-symbol"></div>
<span>Standard Node</span>
</div>
<div class="legend-item">
<div class="legend-symbol highlight"></div>
<span>Highlighted Node</span>
</div>
<div class="legend-item">
<div class="legend-arrow"></div>
<span>Process Flow</span>
</div>
</div>
</div>
</div>
<script>
mermaid.initialize({
startOnLoad: true,
theme: 'dark',
securityLevel: 'loose'
});
</script>
</body>
</html>
📊 DIAGRAM TYPE TEMPLATES
1. Flowchart (Top to Bottom)
%%{init: {'theme':'dark', 'themeVariables': {'primaryColor':'#000000','primaryTextColor':'#ffffff','primaryBorderColor':'#ffffff','lineColor':'#ffffff'}}}%%
flowchart TB
Start[Start Process] --> Input[Gather Input]
Input --> Process[Process Data]
Process --> Decision{Valid?}
Decision -->|Yes| Output[Generate Output]
Decision -->|No| Error[Handle Error]
Output --> End[Complete]
Error --> End
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
classDef highlight fill:transparent,stroke:#9d4edd,stroke-width:3px,color:#ffffff
class Process,Output highlight
2. Flowchart (Left to Right)
%%{init: {'theme':'dark'}}%%
flowchart LR
A[Stage 1] --> B[Stage 2]
B --> C[Stage 3]
C --> D[Stage 4]
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
3. System Architecture
%%{init: {'theme':'dark'}}%%
graph TB
subgraph Frontend
UI[User Interface]
Router[Router]
end
subgraph Backend
API[API Gateway]
Auth[Authentication]
Logic[Business Logic]
end
subgraph Data
DB[(Database)]
Cache[(Cache)]
end
UI --> Router
Router --> API
API --> Auth
Auth --> Logic
Logic --> DB
Logic --> Cache
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
classDef highlight fill:transparent,stroke:#9d4edd,stroke-width:3px,color:#ffffff
class API,Logic highlight
4. Decision Tree
%%{init: {'theme':'dark'}}%%
flowchart TB
Start[Start] --> Q1{Question 1?}
Q1 -->|Yes| Q2{Question 2?}
Q1 -->|No| Result1[Result A]
Q2 -->|Yes| Result2[Result B]
Q2 -->|No| Result3[Result C]
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
classDef success fill:transparent,stroke:#10b981,stroke-width:2px,color:#ffffff
classDef error fill:transparent,stroke:#ef4444,stroke-width:2px,color:#ffffff
class Result2 success
class Result1,Result3 error
5. Process Workflow
%%{init: {'theme':'dark'}}%%
flowchart LR
subgraph Input
A[Data Source]
end
subgraph Processing
B[Validate]
C[Transform]
D[Enrich]
end
subgraph Output
E[Save]
F[Notify]
end
A --> B
B --> C
C --> D
D --> E
E --> F
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
6. State Machine
%%{init: {'theme':'dark'}}%%
stateDiagram-v2
[*] --> Idle
Idle --> Processing: Start
Processing --> Success: Complete
Processing --> Error: Fail
Success --> [*]
Error --> Retry: Retry
Retry --> Processing
Error --> [*]: Cancel
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
7. Git Flow
%%{init: {'theme':'dark'}}%%
gitGraph
commit
branch develop
checkout develop
commit
commit
branch feature
checkout feature
commit
commit
checkout develop
merge feature
checkout main
merge develop
commit
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
🎨 CURV ACCENT COLORS
When to Use Each Color
Default (White): Standard nodes, normal flow
fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
Highlight (CURV Purple): Important nodes, key steps, primary focus
fill:transparent,stroke:#9d4edd,stroke-width:3px,color:#ffffff
Accent (Light Purple): Secondary emphasis, related nodes
fill:transparent,stroke:#c084fc,stroke-width:2px,color:#ffffff
Success (Green): Positive outcomes, completed states, success paths
fill:transparent,stroke:#10b981,stroke-width:2px,color:#ffffff
Warning (Orange): Caution states, review needed, attention required
fill:transparent,stroke:#f59e0b,stroke-width:2px,color:#ffffff
Error (Red): Error states, failure paths, invalid conditions
fill:transparent,stroke:#ef4444,stroke-width:2px,color:#ffffff
Dashed (White): Optional paths, future features, conditional flows
fill:transparent,stroke:#ffffff,stroke-width:2px,stroke-dasharray:5,color:#ffffff
📏 SPACING STANDARDS
Minimum Spacing Requirements
nodeSpacing: 100 # Horizontal space between nodes
rankSpacing: 80 # Vertical space between levels
padding: 40 # Diagram container padding
minEdgeLength: 150 # Minimum connector length
Layout Directions
TB- Top to Bottom (default for processes)LR- Left to Right (good for timelines)BT- Bottom to Top (rare, reverse flow)RL- Right to Left (rare, reverse timeline)
When to Use Each Layout
- TB (Top to Bottom): Workflows, decision trees, hierarchies
- LR (Left to Right): Timelines, pipelines, sequential processes
- Subgraphs: Group related components, isolate systems
🔧 LEGEND BEST PRACTICES
Rule 1: ALWAYS Place Legend Outside Diagram
<!-- NEVER put legend inside <div class="mermaid"> -->
<!-- ALWAYS put legend in separate container -->
<div class="legend">
<h3>Legend</h3>
<div class="legend-items">
<!-- Legend items here -->
</div>
</div>
Rule 2: Minimum 40px Margin from Diagram
.legend {
margin-top: 40px; /* MINIMUM - prevents overlap */
}
Rule 3: Use Visual Symbols, Not Just Text
<div class="legend-item">
<div class="legend-symbol highlight"></div>
<span>Highlighted Process</span>
</div>
Rule 4: Keep Legend Items Scannable
- Max 6-8 legend items
- Grid layout for 4+ items
- Clear visual distinction between symbols
- Consistent symbol sizing (40px × 30px)
🚨 COMMON PITFALLS TO AVOID
❌ DON'T: Use Default Mermaid (Light Background)
flowchart TB
A --> B
Why: Doesn't match CURV dark aesthetic
❌ DON'T: Fill Nodes with Color
classDef myNode fill:#9d4edd
Why: Text becomes unreadable, breaks design system
❌ DON'T: Put Legend Inside Diagram
flowchart TB
A --> B
subgraph Legend
L1[Item 1]
end
Why: ALWAYS overlaps with nodes, looks terrible
❌ DON'T: Use Tiny Spacing
'flowchart': { 'nodeSpacing': 20 }
Why: Nodes touch, text overlaps, illegible
❌ DON'T: Forget Class Definitions
flowchart TB
A --> B
Why: Nodes have default colored fill, text invisible
✅ CORRECT PATTERNS
✅ DO: Apply Classes to All Nodes
flowchart TB
A[Node] --> B[Node]
classDef default fill:transparent,stroke:#ffffff,stroke-width:2px,color:#ffffff
✅ DO: Use Descriptive Node Labels
flowchart TB
A[User Login] --> B[Validate Credentials]
B --> C[Grant Access]
✅ DO: Group Related Nodes in Subgraphs
flowchart TB
subgraph Authentication
A[Login] --> B[Verify]
end
subgraph Authorization
C[Check Permissions]
end
B --> C
✅ DO: Use Meaningful Edge Labels
flowchart TB
A[Process] -->|Success| B[Continue]
A -->|Failure| C[Retry]
📋 CREATION CHECKLIST
Before delivering any Mermaid diagram:
- Black background (#000000) applied
- All nodes have transparent fill
- All nodes have white stroke (2px minimum)
- Text color is white (#ffffff)
- Connectors/lines are white
- nodeSpacing: 100 minimum
- rankSpacing: 80 minimum
- Legend is OUTSIDE diagram
- Legend has 40px+ margin from diagram
- Class definitions included
- Title and subtitle present
- Artifact is complete HTML file
🎯 USAGE EXAMPLES
Example 1: Simple Process
User Request: "Create flowchart for our onboarding process"
Output:
Complete HTML artifact with:
- Black background
- 5-step onboarding flow (TB layout)
- White transparent nodes
- Purple highlight on critical step
- External legend with 3 items
- Clean spacing (100/80)
Example 2: System Architecture
User Request: "Show our app architecture"
Output:
Complete HTML artifact with:
- Black background
- 3 subgraphs (Frontend, Backend, Data)
- LR layout for clarity
- White nodes with purple highlights on APIs
- Legend showing component types
Example 3: Decision Tree
User Request: "User eligibility decision flow"
Output:
Complete HTML artifact with:
- Black background
- Diamond decision nodes
- Green for approved paths
- Red for rejected paths
- White for neutral
- Clear yes/no labels on edges
🔄 MODIFICATION PATTERNS
Add Highlight to Node
User: "Highlight the validation step"
Claude: [Adds class highlight to that node]
Change Layout Direction
User: "Make it left to right"
Claude: [Changes flowchart TB to flowchart LR]
Add Conditional Path
User: "Add error handling path"
Claude: [Adds dashed line with error class node]
Extend Diagram
User: "Add 3 more steps at the end"
Claude: [Extends existing flow, maintains styling]
💾 EXPORT & SHARING
After creating diagram:
"Diagram created. [View Mermaid Diagram]
To export as image:
1. Open diagram in browser
2. Right-click diagram area
3. 'Save image as PNG'
Or use Mermaid Live Editor to export SVG/PNG"
🎨 ADVANCED: CURV GLOW EFFECT
For special emphasis (use sparingly):
classDef glow fill:transparent,stroke:#9d4edd,stroke-width:3px,color:#ffffff,filter:drop-shadow(0 0 10px #9d4edd)
📊 TOKEN OPTIMIZATION
Efficient Diagram Creation
- Build diagram in single pass
- Apply all classes at end (not per node)
- Reference this skill for styling (don't re-explain)
- Use templates for common patterns
Response Pattern
User: "Create [diagram type]"
Claude: [Builds complete artifact immediately]
[View Mermaid Diagram]
[Only if needed: brief customization offer]
🎯 SUCCESS METRICS
This skill is working when:
- ✅ Every diagram has black background
- ✅ All nodes are transparent with white borders
- ✅ Text is always readable (white on black)
- ✅ Legends NEVER overlap nodes
- ✅ Spacing looks professional (100/80 minimum)
- ✅ CURV accents used appropriately
- ✅ Complete HTML artifacts every time
- ✅ Zero styling questions needed
Deployment Path: /mnt/skills/user/curv-mermaid-diagrams/SKILL.md
Restart Required: Yes (restart Claude Desktop after deployment)
Token Impact: 80% reduction in diagram creation/revision cycles
Quality Impact: Professional, on-brand diagrams every time, zero overlap issues