Loading...
Loading...
Control a live Excalidraw canvas via the excalidraw CLI. Use when drawing diagrams, creating or editing elements, exporting scenes, controlling viewport, or converting Mermaid diagrams. Load excalidraw-design-guide when creating or styling any diagram. Load excalidraw-workflow when building or reviewing a multi-element diagram.
npx skill4agent add opencoredev/excalidraw-cli excalidrawexcalidraw-design-guideexcalidraw-workflowexcalidraw status{"status":"healthy","elements_count":N}excalidraw serve --port 3000http://localhost:3000bun add -g github:opencoredev/excalidraw-cliexport EXCALIDRAW_URL=http://localhost:3000EXCALIDRAW_URL--url <url># Each element is its own call — user sees it appear immediately
excalidraw create --type rectangle --id svc-a --x 100 --y 100 --width 160 --height 60 --text "Service A"
excalidraw viewport --fit
excalidraw create --type rectangle --id svc-b --x 100 --y 240 --width 160 --height 60 --text "Service B"
excalidraw viewport --fit
excalidraw create --type arrow --x 0 --y 0 --start svc-a --end svc-b
excalidraw viewport --fitexcalidraw batchcreateexcalidraw createwidth = max(160, charCount * 11 + 40)excalidraw update <id> --width <wider>max(160, charCount * 11 + 40)+40max(160, longestWord * 11 + 80)--start <id> --end <id>--start--endexcalidraw describe # spot-check element list and IDs
excalidraw viewport --fitexcalidraw guideexcalidraw clearexcalidraw batch diagram.jsonexcalidraw viewport --fitdiagram.json{
"elements": [
{
"id": "svc-a",
"type": "rectangle",
"x": 100, "y": 100,
"width": 160, "height": 60,
"label": {"text": "Service A"},
"strokeColor": "#1971c2",
"backgroundColor": "#a5d8ff"
},
{
"id": "svc-b",
"type": "rectangle",
"x": 100, "y": 240,
"width": 160, "height": 60,
"label": {"text": "Service B"},
"strokeColor": "#2f9e44",
"backgroundColor": "#b2f2bb"
},
{
"type": "arrow",
"x": 0, "y": 0,
"start": {"id": "svc-a"},
"end": {"id": "svc-b"},
"label": {"text": "HTTP"}
}
]
}excalidraw batch diagram.json"start": {"id": "..."}"end": {"id": "..."}"label": {"text": "..."}"text": "...""type": "text""text": "..."excalidraw status # Health check
excalidraw serve --port 3000 # Start canvas server (blocks)
excalidraw serve --port 3000 --host 0.0.0.0 # Bind to all interfacesexcalidraw create --type rectangle --x 100 --y 100 --width 160 --height 60 --text "Box"
excalidraw create --type arrow --x 0 --y 0 --start <id> --end <id>
excalidraw create --type text --x 50 --y 50 --text "Title" --font-size 24
excalidraw update <id> --text "New Label" --stroke-color "#e03131"
excalidraw update <id> --x 200 --y 300 --width 200 --height 80
excalidraw delete <id>
excalidraw get <id> # Get single element
excalidraw query # Get all elements
excalidraw query --type rectangle # Filter by typeexcalidraw batch diagram.json # From file
cat diagram.json | excalidraw batch # From stdin
excalidraw clear # Remove all elementsexcalidraw export # Print .excalidraw JSON to stdout
excalidraw export --out scene.excalidraw # Write to file
excalidraw import scene.excalidraw # Import (replaces canvas)
excalidraw import scene.excalidraw --mode merge # Merge with existing
excalidraw snapshot v1 # Save named snapshot
excalidraw restore v1 # Restore snapshotexcalidraw viewport --fit # Zoom to fit all elements
excalidraw viewport --element <id> # Center on element
excalidraw viewport --zoom 1.5 # Set zoom level
excalidraw describe # List all elements (text summary)
excalidraw screenshot # Capture canvas (requires browser)
excalidraw screenshot --format svg --out diagram.svgexcalidraw align id1 id2 id3 --alignment left # Align left edges
excalidraw align id1 id2 id3 --alignment top # Align top edges
excalidraw align id1 id2 id3 --alignment center # Center horizontally
excalidraw align id1 id2 id3 --alignment middle # Center vertically
excalidraw distribute id1 id2 id3 --direction horizontal
excalidraw distribute id1 id2 id3 --direction vertical
excalidraw group id1 id2 id3 # Group elements
excalidraw ungroup <groupId> # Ungroup
excalidraw duplicate id1 id2 --dx 20 --dy 20
excalidraw lock id1 id2 # Lock (prevent UI edits)
excalidraw unlock id1 id2excalidraw url # Export as encrypted excalidraw.com URL
excalidraw mermaid diagram.mmd # Convert Mermaid to Excalidraw
echo "graph TD; A-->B" | excalidraw mermaidexcalidraw guide # Print color palette, sizing, layout rules| Type | Required | Notes |
|---|---|---|
| rectangle | x, y, width, height | Use |
| ellipse | x, y, width, height | Use |
| diamond | x, y, width, height | Use |
| text | x, y, text | Standalone text; use |
| arrow | x, y | Bind with |
| line | x, y, points | Manual points array [[x,y],[x,y]] |
| freedraw | x, y, points | Freehand path |
{
"elements": [
{"id":"zone","type":"rectangle","x":40,"y":40,"width":500,"height":400,
"backgroundColor":"#e9ecef","strokeColor":"#868e96","opacity":50,
"label":{"text":"Backend"}},
{"id":"api","type":"rectangle","x":80,"y":100,"width":160,"height":60,
"strokeColor":"#1971c2","backgroundColor":"#a5d8ff","label":{"text":"API Gateway"}},
{"id":"db","type":"rectangle","x":80,"y":260,"width":160,"height":60,
"strokeColor":"#0c8599","backgroundColor":"#99e9f2","label":{"text":"Database"}},
{"type":"arrow","x":0,"y":0,"start":{"id":"api"},"end":{"id":"db"},
"label":{"text":"SQL"}}
]
}{
"elements": [
{"id":"start","type":"ellipse","x":160,"y":40,"width":120,"height":60,
"strokeColor":"#2f9e44","backgroundColor":"#b2f2bb","label":{"text":"Start"}},
{"id":"step1","type":"rectangle","x":140,"y":160,"width":160,"height":60,
"strokeColor":"#1971c2","backgroundColor":"#a5d8ff","label":{"text":"Process Data"}},
{"id":"decide","type":"diamond","x":140,"y":280,"width":160,"height":80,
"strokeColor":"#e8590c","backgroundColor":"#ffd8a8","label":{"text":"Valid?"}},
{"type":"arrow","x":0,"y":0,"start":{"id":"start"},"end":{"id":"step1"}},
{"type":"arrow","x":0,"y":0,"start":{"id":"step1"},"end":{"id":"decide"}}
]
}excalidraw batch diagram.json
→ excalidraw describe (verify elements exist with correct IDs)
→ excalidraw viewport --fit (auto-fit view)
→ excalidraw screenshot --out /tmp/check.png (visual check)
→ [if issues] excalidraw update <id> --width 200 --height 80
→ excalidraw screenshot --out /tmp/check2.png (re-verify)
→ [all good] doneexcalidraw statusexcalidraw serve --port 3000http://localhost:3000"start": {"id": "..."}"label": {"text": "..."}"text": "..."excalidraw export --out backup.excalidraw