Generate .excalidraw files — from quick flowcharts to comprehensive technical diagrams.
Every diagram MUST be rendered to PNG and visually inspected before delivery. Look at the actual image — check that text fits inside boxes, no elements overlap, arrows connect correctly, and spacing is balanced. Fix the JSON and re-render until it looks professional. See the Render & Validate section. No exceptions.
NeedApproachTimeSimple flowchart, decision tree, linear processQuick Path — CLI DSL1 minArchitecture, multi-zoom technical, evidence artifactsFull Path — hand-crafted JSON10 min
For straightforward flows, use @swiftlysingh/excalidraw-cli (installed locally by setup.sh):
bash
excalidraw-cli create --inline "DSL" -o output.excalidraw
Note: If
excalidraw-cliis not in your PATH after setup, use:"$SKILL_DIR/.npm/node_modules/.bin/excalidraw-cli"or re-runsetup.sh.
SyntaxShapeUse For[Label]RectangleProcess steps{Label?}DiamondDecisions(Label)EllipseStart/End[[Label]]DatabaseData storage->ArrowConnection-> "text" ->Labeled arrowConditional-->Dashed arrowOptional path
Directives: @direction LR|TB|RL|BT, @spacing 60
bash
excalidraw-cli create --inline "$(cat <<'EOF'
@direction TB
(Start) -> [Receive Request] -> {Authenticated?}
{Authenticated?} -> "yes" -> [Process Request] -> (Success)
{Authenticated?} -> "no" -> [Return 401] -> (End)
EOF
)" -o auth-flow.excalidraw
CLI options: -d LR (direction), -s 80 (spacing), --format dot (DOT/Graphviz input).
After generation, always render and validate (see Render section below). Fix overlaps or clipping in the JSON if needed.
For comprehensive, professional diagrams. Read these references as needed:
references/color-palette.md — All colors (read FIRST, every time)references/element-templates.md — Copy-paste JSON for each element typereferences/json-schema.md — Full property referencereferences/layout-rules.md — Anti-overlap spacing and text-sizing rules ⚠️ READ THISjson
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [...],
"appState": { "viewBackgroundColor": "#ffffff", "gridSize": 20 },
"files": {}
}
fontFamily: 3, roughness: 0, opacity: 100 on all elementstext property = ONLY readable words (no markup)references/layout-rules.mdreferences/layout-rules.mdConcept BehaviorPatternOne source → many outputsFan-out (radial arrows from center)Many inputs → one outputConvergence (arrows merging)Hierarchy/nestingTree (lines + free-floating text)Sequence of stepsTimeline (line + dots + labels)Feedback loopSpiral/Cycle (arrow returning to start)Abstract stateCloud (overlapping ellipses)TransformationAssembly line (before → process → after)ComparisonSide-by-side (parallel structures)Phase changesGap/Break (visual whitespace)
ConceptShapeLabels, descriptionsFree-floating text (no container)Timeline markersSmall ellipse (12px)Start/triggerEllipseEnd/outputEllipseDecisionDiamondProcess/actionRectangle
ArtifactRenderingCode snippetsDark rect ( #1e293b) + syntax-colored textJSON/dataDark rect ( #1e293b) + green text ( #22c55e)Event sequencesTimeline (line + dots + labels)UI mockupsNested rectangles
Build JSON one section at a time (Claude has ~32k token output limit):
"trigger_rect", "auth_arrow")Every diagram must be rendered and visually inspected before delivery. This catches overlap, text clipping, and spacing issues that are invisible in JSON.
bash
cd ~/.openclaw/skills/excalidraw-diagram && uv run python render_excalidraw.py <path-to-file.excalidraw>
Outputs a PNG next to the .excalidraw file. Use the Read tool to view it.
bash
cd ~/.openclaw/skills/excalidraw-diagram
bash setup.sh # builds local Excalidraw bundle (requires node/npm)
uv sync && uv run playwright install chromium
Do not skip this loop. JSON coordinates are approximate — you will almost always find issues on the first render. The visual check IS the quality gate.
The render script outputs high-res PNG (2x scale by default):
bash
cd ~/.openclaw/skills/excalidraw-diagram && uv run python render_excalidraw.py diagram.excalidraw --output diagram.png --scale 3
Options: --scale 3 (3x for print), --width 2560 (wider viewport).
Convert PNG to PDF:
bash
# ImageMagick (most common)
convert diagram.png -density 150 diagram.pdf
# Or with a white background and margins
convert diagram.png -gravity center -background white -extent 110%x110% -density 150 diagram.pdf
For multi-page or A4/Letter sizing:
bash
convert diagram.png -resize 1800x -gravity center -background white \
-extent 2100x2970 -units PixelsPerInch -density 254 diagram-a4.pdf
roughness: 0, opacity: 100, fontFamily: 3 everywherereferences/color-palette.md