Excalidraw Diagram Creation
This skill enables you to create beautiful, hand-drawn style diagrams in the Excalidraw JSON format.
File Format Overview
Excalidraw files (.excalidraw) are JSON with this structure:
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [],
"appState": {
"viewBackgroundColor": "#ffffff",
"gridSize": null
},
"files": {}
}
Quick Start - Creating Elements
Every element needs at minimum: type, id, x, y, and styling properties.
Minimal Rectangle
{
"type": "rectangle",
"id": "rect-1",
"x": 100,
"y": 100,
"width": 200,
"height": 100,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"seed": 1234,
"version": 1,
"versionNonce": 1234,
"isDeleted": false,
"groupIds": [],
"boundElements": null,
"link": null,
"locked": false,
"roundness": { "type": 3 }
}
Text Element
{
"type": "text",
"id": "text-1",
"x": 120,
"y": 130,
"width": 160,
"height": 25,
"text": "Hello World",
"fontSize": 20,
"fontFamily": 1,
"textAlign": "center",
"verticalAlign": "middle",
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"seed": 5678,
"version": 1,
"versionNonce": 5678,
"isDeleted": false,
"groupIds": [],
"boundElements": null,
"link": null,
"locked": false,
"containerId": null,
"originalText": "Hello World",
"autoResize": true,
"lineHeight": 1.25
}
Arrow Element
{
"type": "arrow",
"id": "arrow-1",
"x": 300,
"y": 150,
"width": 100,
"height": 0,
"points": [[0, 0], [100, 0]],
"startArrowhead": null,
"endArrowhead": "arrow",
"startBinding": null,
"endBinding": null,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"seed": 9012,
"version": 1,
"versionNonce": 9012,
"isDeleted": false,
"groupIds": [],
"boundElements": null,
"link": null,
"locked": false
}
Element Types
| Type |
Use For |
rectangle |
Boxes, containers, cards |
ellipse |
Circles, ovals, nodes |
diamond |
Decision points, conditions |
text |
Labels, descriptions |
arrow |
Connections, flow direction |
line |
Connectors without arrowheads |
freedraw |
Hand-drawn paths |
image |
Embedded images |
frame |
Grouping/framing elements |
Color Palette (Recommended)
Backgrounds
#a5d8ff - Light blue
#b2f2bb - Light green
#ffec99 - Light yellow
#ffc9c9 - Light red/pink
#e9ecef - Light gray
#d0bfff - Light purple
#99e9f2 - Light cyan
Strokes
#1e1e1e - Default black
#1971c2 - Blue
#2f9e44 - Green
#f08c00 - Orange
#e03131 - Red
#9c36b5 - Purple
Styling Properties
| Property |
Values |
Description |
fillStyle |
"solid", "hachure", "cross-hatch" |
Fill pattern |
strokeWidth |
1, 2, 4 |
Line thickness |
strokeStyle |
"solid", "dashed", "dotted" |
Line style |
roughness |
0, 1, 2 |
Hand-drawn feel (0=smooth, 2=rough) |
opacity |
0-100 |
Transparency |
roundness |
{ "type": 3 } |
Rounded corners |
Connecting Elements with Arrows
To connect shapes with arrows, use bindings:
{
"type": "arrow",
"id": "arrow-1",
"startBinding": {
"elementId": "rect-1",
"focus": 0,
"gap": 5
},
"endBinding": {
"elementId": "rect-2",
"focus": 0,
"gap": 5
},
"points": [[0, 0], [200, 0]]
}
Also add boundElements to the connected shapes:
{
"type": "rectangle",
"id": "rect-1",
"boundElements": [{ "id": "arrow-1", "type": "arrow" }]
}
Font Families
| Value |
Font |
1 |
Hand-drawn (Virgil) |
2 |
Normal (Helvetica) |
3 |
Code (Cascadia) |
Best Practices
- Generate unique IDs - Use descriptive prefixes like
rect-1, arrow-2, text-header
- Use random seeds - Each element needs a unique
seed for consistent rendering
- Space elements well - Leave 50-100px between elements
- Align elements - Use consistent x/y coordinates for visual alignment
- Group related items - Use matching
groupIds arrays
- Use the color palette - Stick to Excalidraw's built-in colors for consistency
Diagram Types You Can Create
| Type |
Description |
| Flowcharts |
Process flows, algorithms, decision trees |
| Sequence Diagrams |
API calls, user interactions, message flows |
| Architecture Diagrams |
System design, microservices, infrastructure |
| Mind Maps |
Brainstorming, concept mapping, idea organization |
| Data Flow Diagrams |
Data movement, system analysis |
| ERD |
Database schemas, entity relationships |
| Wireframes |
UI mockups, layout sketches |
Reference Documentation
- diagram-patterns.md - Professional patterns for each diagram type (flowcharts, sequence diagrams, mind maps, architecture, etc.)
- examples.md - Complete working JSON examples you can use as templates
- element-reference.md - Full property reference for all element types
- best-practices.md - Design tips, color theory, typography guidelines
Quick Tips for Beautiful Diagrams
- Use
roughness: 0 for formal/technical diagrams, roughness: 1 for friendly sketches
- Use
fontFamily: 2 (Helvetica) for professional look, fontFamily: 1 (Virgil) only when casual look is requested
- Consistent spacing - 100px between major elements, 50px for related items
- Color semantics - Blue for info/input, Green for success/data, Yellow for decisions, Red for errors
- Arrow conventions - Solid for actions, Dashed for responses/async
1---2name: excalidraw3description: Create and edit Excalidraw diagrams programmatically. Use when the user asks to create diagrams, flowcharts, architecture diagrams, wireframes, or any visual drawings in Excalidraw format (.excalidraw files).4---56# Excalidraw Diagram Creation78This skill enables you to create beautiful, hand-drawn style diagrams in the Excalidraw JSON format.910## File Format Overview1112Excalidraw files (`.excalidraw`) are JSON with this structure:1314```json15{16 "type": "excalidraw",17 "version": 2,18 "source": "https://excalidraw.com",19 "elements": [],20 "appState": {21 "viewBackgroundColor": "#ffffff",22 "gridSize": null23 },24 "files": {}25}26```2728## Quick Start - Creating Elements2930Every element needs at minimum: `type`, `id`, `x`, `y`, and styling properties.3132### Minimal Rectangle33```json34{35 "type": "rectangle",36 "id": "rect-1",37 "x": 100,38 "y": 100,39 "width": 200,40 "height": 100,41 "angle": 0,42 "strokeColor": "#1e1e1e",43 "backgroundColor": "transparent",44 "fillStyle": "solid",45 "strokeWidth": 2,46 "strokeStyle": "solid",47 "roughness": 1,48 "opacity": 100,49 "seed": 1234,50 "version": 1,51 "versionNonce": 1234,52 "isDeleted": false,53 "groupIds": [],54 "boundElements": null,55 "link": null,56 "locked": false,57 "roundness": { "type": 3 }58}59```6061### Text Element62```json63{64 "type": "text",65 "id": "text-1",66 "x": 120,67 "y": 130,68 "width": 160,69 "height": 25,70 "text": "Hello World",71 "fontSize": 20,72 "fontFamily": 1,73 "textAlign": "center",74 "verticalAlign": "middle",75 "angle": 0,76 "strokeColor": "#1e1e1e",77 "backgroundColor": "transparent",78 "fillStyle": "solid",79 "strokeWidth": 2,80 "strokeStyle": "solid",81 "roughness": 1,82 "opacity": 100,83 "seed": 5678,84 "version": 1,85 "versionNonce": 5678,86 "isDeleted": false,87 "groupIds": [],88 "boundElements": null,89 "link": null,90 "locked": false,91 "containerId": null,92 "originalText": "Hello World",93 "autoResize": true,94 "lineHeight": 1.2595}96```9798### Arrow Element99```json100{101 "type": "arrow",102 "id": "arrow-1",103 "x": 300,104 "y": 150,105 "width": 100,106 "height": 0,107 "points": [[0, 0], [100, 0]],108 "startArrowhead": null,109 "endArrowhead": "arrow",110 "startBinding": null,111 "endBinding": null,112 "angle": 0,113 "strokeColor": "#1e1e1e",114 "backgroundColor": "transparent",115 "fillStyle": "solid",116 "strokeWidth": 2,117 "strokeStyle": "solid",118 "roughness": 1,119 "opacity": 100,120 "seed": 9012,121 "version": 1,122 "versionNonce": 9012,123 "isDeleted": false,124 "groupIds": [],125 "boundElements": null,126 "link": null,127 "locked": false128}129```130131## Element Types132133| Type | Use For |134|------|---------|135| `rectangle` | Boxes, containers, cards |136| `ellipse` | Circles, ovals, nodes |137| `diamond` | Decision points, conditions |138| `text` | Labels, descriptions |139| `arrow` | Connections, flow direction |140| `line` | Connectors without arrowheads |141| `freedraw` | Hand-drawn paths |142| `image` | Embedded images |143| `frame` | Grouping/framing elements |144145## Color Palette (Recommended)146147### Backgrounds148- `#a5d8ff` - Light blue149- `#b2f2bb` - Light green150- `#ffec99` - Light yellow151- `#ffc9c9` - Light red/pink152- `#e9ecef` - Light gray153- `#d0bfff` - Light purple154- `#99e9f2` - Light cyan155156### Strokes157- `#1e1e1e` - Default black158- `#1971c2` - Blue159- `#2f9e44` - Green160- `#f08c00` - Orange161- `#e03131` - Red162- `#9c36b5` - Purple163164## Styling Properties165166| Property | Values | Description |167|----------|--------|-------------|168| `fillStyle` | `"solid"`, `"hachure"`, `"cross-hatch"` | Fill pattern |169| `strokeWidth` | `1`, `2`, `4` | Line thickness |170| `strokeStyle` | `"solid"`, `"dashed"`, `"dotted"` | Line style |171| `roughness` | `0`, `1`, `2` | Hand-drawn feel (0=smooth, 2=rough) |172| `opacity` | `0-100` | Transparency |173| `roundness` | `{ "type": 3 }` | Rounded corners |174175## Connecting Elements with Arrows176177To connect shapes with arrows, use bindings:178179```json180{181 "type": "arrow",182 "id": "arrow-1",183 "startBinding": {184 "elementId": "rect-1",185 "focus": 0,186 "gap": 5187 },188 "endBinding": {189 "elementId": "rect-2",190 "focus": 0,191 "gap": 5192 },193 "points": [[0, 0], [200, 0]]194}195```196197Also add `boundElements` to the connected shapes:198```json199{200 "type": "rectangle",201 "id": "rect-1",202 "boundElements": [{ "id": "arrow-1", "type": "arrow" }]203}204```205206## Font Families207208| Value | Font |209|-------|------|210| `1` | Hand-drawn (Virgil) |211| `2` | Normal (Helvetica) |212| `3` | Code (Cascadia) |213214## Best Practices2152161. **Generate unique IDs** - Use descriptive prefixes like `rect-1`, `arrow-2`, `text-header`2172. **Use random seeds** - Each element needs a unique `seed` for consistent rendering2183. **Space elements well** - Leave 50-100px between elements2194. **Align elements** - Use consistent x/y coordinates for visual alignment2205. **Group related items** - Use matching `groupIds` arrays2216. **Use the color palette** - Stick to Excalidraw's built-in colors for consistency222223## Diagram Types You Can Create224225| Type | Description |226|------|-------------|227| **Flowcharts** | Process flows, algorithms, decision trees |228| **Sequence Diagrams** | API calls, user interactions, message flows |229| **Architecture Diagrams** | System design, microservices, infrastructure |230| **Mind Maps** | Brainstorming, concept mapping, idea organization |231| **Data Flow Diagrams** | Data movement, system analysis |232| **ERD** | Database schemas, entity relationships |233| **Wireframes** | UI mockups, layout sketches |234235## Reference Documentation236237- **[diagram-patterns.md](diagram-patterns.md)** - Professional patterns for each diagram type (flowcharts, sequence diagrams, mind maps, architecture, etc.)238- **[examples.md](examples.md)** - Complete working JSON examples you can use as templates239- **[element-reference.md](element-reference.md)** - Full property reference for all element types240- **[best-practices.md](best-practices.md)** - Design tips, color theory, typography guidelines241242## Quick Tips for Beautiful Diagrams2432441. **Use `roughness: 0`** for formal/technical diagrams, `roughness: 1` for friendly sketches2452. **Use `fontFamily: 2`** (Helvetica) for professional look, `fontFamily: 1` (Virgil) only when casual look is requested2463. **Consistent spacing** - 100px between major elements, 50px for related items2474. **Color semantics** - Blue for info/input, Green for success/data, Yellow for decisions, Red for errors2485. **Arrow conventions** - Solid for actions, Dashed for responses/async