Loading...
Loading...
Draw diagrams, flowcharts, and visualizations on an Excalidraw canvas. Use when the user asks to draw, visualize, create diagrams, or sketch ideas.
npx skill4agent add whq25/agent-canvas agent-canvaswhich agent-canvas && agent-canvas --versionbun add -g @agent-canvas/cli@0.9.3
# or
npm install -g @agent-canvas/cli@0.9.3.bunbun add -g @agent-canvas/cli@0.9.3npm install -g @agent-canvas/cli@0.9.3agent-canvas --versionagent-canvas startagent-canvas start # Start server and open browseragent-canvas load file.excalidraw # Load .excalidraw file into current canvasagent-canvas save <original-file>agent-canvas list # List all canvases (* marks active)
agent-canvas new -n "Name" [--use] # Create new canvas, optionally switch to it
agent-canvas use "Name" # Switch to canvas by name
agent-canvas rename "New Name" # Rename current canvasagent-canvas add-text -t "<text>" --ax <x> --ay <y> [options]--font-size <size>--text-align <left|center|right>-a/--anchor <anchor>--stroke-color <hex>-n/--note <text>-abottomLeft| Anchor | Common Text Types |
|---|---|
| Badge, Tag, Icon label |
| Subtitle, Description below shape |
| Timestamp, Version, Status |
| Side annotation (right of shape) |
| Centered title, Main label |
| Side annotation (left of shape) |
| Footnote, Note |
| Title, Header above shape |
| Footnote, Signature |
Text created (id: <id>, x: <x>, y: <y>, <width>x<height>)--stroke-color <hex>--stroke-width <1-4>--stroke-style <solid|dashed|dotted>--background-color <hex>--fill-style <solid|hachure|cross-hatch>-n/--note <text>| Color | Stroke (dark) | Background (light) |
|---|---|---|
| Red | #e03131 | #ffc9c9 |
| Blue | #1971c2 | #a5d8ff |
| Green | #2f9e44 | #b2f2bb |
| Yellow | #f08c00 | #ffec99 |
| Cyan | #0c8599 | #99e9f2 |
| Violet | #6741d9 | #b197fc |
| Gray | #495057 | #dee2e6 |
agent-canvas add-shape -t <type> -x <x> -y <y> [-w <width>] [-h <height>] [-l <label>]rectangleellipsediamond-l/--label--label-font-size <n>--stroke-color--label-stroke-color <hex>Shape created (id: <id> x=<x> y=<y> w=<width> h=<height>)Step 1: Calculate text dimensions (fontSize=16 by default)
textWidth = charCount × fontSize × 0.6 (English/numbers)
textWidth = charCount × fontSize (CJK characters)
textHeight = lineCount × fontSize × 1.35
Step 2: Calculate minimum shape size (use these values, not smaller!)
rectangle: width = textWidth + 50, height = textHeight + 50
ellipse: width = textWidth × 1.42 + 55, height = textHeight × 1.42 + 55
diamond: width = textWidth × 2 + 60, height = textHeight × 2 + 60textWidth = 13 × 16 × 0.6 = 124.8
textHeight = 1 × 16 × 1.35 = 21.6
ellipse width = 124.8 × 1.42 + 55 = 232
ellipse height = 21.6 × 1.42 + 55 = 86
→ Use: -w 232 -h 86 (or round up to -w 240 -h 90)\nagent-canvas add-line -x <x1> -y <y1> --end-x <x2> --end-y <y2>
agent-canvas add-arrow -x <x1> -y <y1> --end-x <x2> --end-y <y2>--start-arrowhead--end-arrowhead--arrow-type| Type | Description | Use Case |
|---|---|---|
| Straight line (default) | Direct connections |
| Curved line with control point | Organic flows, avoiding overlaps |
| Right-angle turns (90°) | Flowcharts, circuit diagrams |
--via--via"x1,y1;x2,y2;..."# Round arrow: one control point determines curve direction
# Vertical arrow curving left (control point at x=50, left of the line)
agent-canvas add-arrow -x 100 -y 100 --end-x 100 --end-y 300 --arrow-type round --via "50,200"
# Elbow arrow: multiple points for 90° turns
# Loop back pattern: down → left → up (for flowchart iterations)
agent-canvas add-arrow -x 175 -y 520 --end-x 175 --end-y 280 --arrow-type elbow --via "120,520;120,280"roundelbowagent-canvas add-polygon -p '[{"x":0,"y":0},{"x":100,"y":0},{"x":50,"y":100}]'agent-canvas add-image -f <path> -x <x> -y <y> [-w <width>] [-h <height>] [-n <note>]Image added (id: <id>, x: <x>, y: <y>, <width>x<height>)agent-canvas delete-elements -i <id1>,<id2>,...
agent-canvas rotate-elements -i <id1>,<id2>,... -a <degrees>
agent-canvas move-elements -i <id1>,<id2>,... --delta-x <dx> --delta-y <dy>
agent-canvas resize-elements -i <id1>,<id2>,... [--top <n>] [--bottom <n>] [--left <n>] [--right <n>]
agent-canvas group-elements -i <id1>,<id2>,...
agent-canvas ungroup-element -i <id>resize-elements# Expand bottom edge by 50px (increase height)
agent-canvas resize-elements -i abc123 --bottom 50
# Expand both right and bottom (like dragging bottom-right corner)
agent-canvas resize-elements -i abc123 --right 50 --bottom 30
# Contract left edge by 20px (decrease width)
agent-canvas resize-elements -i abc123 --left -20
# Expand all sides uniformly
agent-canvas resize-elements -i abc123 --top 25 --bottom 25 --left 25 --right 25agent-canvas read # TOON format (compact, ~7% of JSON size)
agent-canvas read --with-style # Include stroke/bg colors
agent-canvas read --json # Raw Excalidraw scene JSONshapes[N]{id,type,x,y,w,h,angle,labelId,note} # rectangle, ellipse, diamond, polygon
lines[N]{id,type,x,y,endX,endY,via,angle,note} # line, arrow
labels[N]{id,containerId,content,x,y,w,h} # text bound to shapes (via labelId)
texts[N]{id,content,x,y,w,h,angle,note} # standalone text elements
groups[N]{id,elementIds} # element groupingslabelIdidvia--via"x1,y1;x2,y2"null--with-stylestrokebg--jsonjqagent-canvas save file.excalidraw
agent-canvas export -o out.png [--scale 2] [--dark] [--no-background]
agent-canvas clear # Clear all elements from the canvasclearexport#FF5733transparentagent-canvas readreadexportmove-elementsmove-elementsmove-elementsdelete-elementsdelete-elementsdelete-elementsresize-elementsreadread --with-styleexport -o canvas.pngread --json | jq '.elements[] | select(.id=="<id>")'&&agent-canvas add-shape -t rectangle -x 100 -y 100 -l "A" && \
agent-canvas add-shape -t rectangle -x 300 -y 100 -l "B" && \
agent-canvas add-arrow -x 220 -y 130 --end-x 300 --end-y 130