excalidraw-cli
Generate editable Excalidraw diagrams from DSL, JSON, or Graphviz DOT. Built for agents and scripts.
An independent package, not the official Excalidraw CLI.
Website | Claude Code and Cursor guide | Examples
Recorded terminal session, not an agent run.
Features
- Text-based DSL for quick flowchart creation
- JSON API for programmatic use
- Auto-layout using ELK.js (Eclipse Layout Kernel)
- Multiple flow directions: TB (top-bottom), BT, LR, RL
- Export to PNG & SVG with dark mode, custom backgrounds, scale, and padding
- Programmable API for integration into other tools
Installation
Requires Node >=20.19.0. Node 18 is no longer supported.
Styling and extended arrow syntax require version 1.4.0 or later.
See the releases for published versions.
Using npm
npm install -g @swiftlysingh/excalidraw-cli
Homebrew
Install from the tap:
brew install swiftlysingh/tap/excalidraw-cli
Homebrew installs Node.js automatically. See the tap README
for upgrades and switching from an existing npm installation.
From Source (Local Development)
git clone https://github.com/swiftlysingh/excalidraw-cli.git
cd excalidraw-cli
npm install
npm run build
npm link # Makes 'excalidraw-cli' available globally
Run without a global install
npx --yes @swiftlysingh/excalidraw-cli create --inline "[A] -> [B]" -o diagram.excalidraw
Use with AI agents
Install the Excalidraw skill for Claude Code, Codex, or Cursor:
npx skills add swiftlysingh/excalidraw-cli
Or copy skills/excalidraw-cli into ~/.claude/skills, ~/.cursor/skills, or ~/.codex/skills.
Gemini CLI:
gemini extensions install https://github.com/swiftlysingh/excalidraw-cli
Claude Code plugin:
/plugin marketplace add swiftlysingh/excalidraw-cli
/plugin install excalidraw-cli@excalidraw-cli
The same marketplace add works from a shell as claude plugin marketplace add swiftlysingh/excalidraw-cli.
Quick Start
Create from DSL
# Inline DSL
excalidraw-cli create --inline "(Start) -> [Process] -> {Decision?}" -o flow.excalidraw
# From file
excalidraw-cli create flowchart.dsl -o diagram.excalidraw
# From stdin
echo "[A] -> [B] -> [C]" | excalidraw-cli create --stdin -o diagram.excalidraw
Create from DOT
excalidraw-cli create --format dot --inline 'digraph { A [label="Start"]; B [label="Process"]; A -> B; }' -o flow.excalidraw
DOT subgraphs are flattened. See man excalidraw-cli for supported attributes
and shape mappings.
Export to Image
# Convert an existing .excalidraw file to PNG
excalidraw-cli convert diagram.excalidraw --format png
# Convert with options
excalidraw-cli convert diagram.excalidraw --format png --scale 2 --dark
# Convert to SVG without background
excalidraw-cli convert diagram.excalidraw --format svg --no-export-background
DSL Syntax
| Syntax | Element | Description |
|---|
[Label] | Rectangle | Process steps, actions |
{Label} | Diamond | Decisions, conditionals |
(Label) | Ellipse | Start/End points |
[[Label]] | Database | Data storage |
![path] | Image | Local image node, default size 100x100 |
 | Image | Image node with an explicit size |
[Label @fillStyle:hachure @backgroundColor:#a5d8ff] | Styled node | Add inline node style attributes |
[A] -> [B] | Arrow | Forward connection |
[A] <- [B] | Reverse arrow | Connection from B to A |
[A] <-> [B] | Bidirectional arrow | Arrowheads on both ends |
[A] --> [B] | Dashed arrow | Dashed connection |
[A] <-- [B] | Dashed reverse arrow | Dashed connection from B to A |
[A] <--> [B] | Dashed bidirectional arrow | Dashed connection with arrowheads on both ends |
[A] -> "text" -> [B] | Labeled arrow | Double-quoted edge label |
[A] -> 'text' -> [B] | Labeled arrow | Single-quoted edge label |
Example DSL