Make Claude Code or Cursor draw architecture diagrams with excalidraw-cli
You can ask Claude Code or Cursor to look at a repo and leave you an Excalidraw diagram you can still edit. This is the walkthrough. The product page has the short version.
The package is @swiftlysingh/excalidraw-cli. It is not the official Excalidraw CLI.
What you get, and how this differs from the official tools
You get an editable .excalidraw file in the repo, and an optional PNG or SVG if you
export one. Open the .excalidraw file at
excalidraw.com or in Obsidian's Excalidraw plugin, then move
boxes around.
The official tools do a different job.
-
@excalidraw/cli, theexcalidrawcommand, renders an existing drawing to PNG or SVG, and can turn Mermaid into an Excalidraw scene. It needs Node.js 22 or newer. Workspace commands need an Excalidraw+ login. - The official Excalidraw MCP connects Claude, Cursor, or another MCP client to an Excalidraw+ workspace, so the agent can work with scenes and collections there. It needs a workspace, plus OAuth or an API key.
This package stays on your machine. The agent writes a short DSL, JSON, or Graphviz DOT file, then
runs excalidraw-cli create to generate a new .excalidraw file. No
Excalidraw+ account. Node.js 20.19 or newer is enough. There is no MCP server in this package
today.
If you already have Mermaid, or you want to render a drawing that already exists, use the official CLI. If you want an agent to build a diagram from a repo or a prompt and drop an editable file next to your code, use this skill.
Install the skill
npx skills add swiftlysingh/excalidraw-cli
That works in Claude Code, Cursor, and Codex. You can also copy
skills/excalidraw-cli from the repo into
~/.claude/skills, ~/.cursor/skills, or ~/.codex/skills.
Gemini CLI
gemini extensions install https://github.com/swiftlysingh/excalidraw-cliClaude Code plugin, from the prompt
/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.
The skill expects Node.js 20.19 or newer, and the CLI itself. If you have not installed the CLI,
the agent can run it with npx --yes @swiftlysingh/excalidraw-cli. Homebrew is
brew install swiftlysingh/tap/excalidraw-cli.
The docs home has the short install paths if you just want to start.
The prompt
Once the skill is installed, a prompt like this is enough.
Draw the architecture of this repo as an Excalidraw diagram.
Write a .excalidraw file I can edit, and export a PNG preview.
You can point it at a service or a folder instead of the whole repo. "Draw the request path
through the API as an Excalidraw diagram" also works. The skill tells the agent to pull nodes and
edges out of the request, prefer a small DSL file, run create, then
convert if you asked for a preview.
The commands
create only writes Excalidraw JSON. It rejects -o file.png. Export the
image in a second step.
excalidraw-cli create architecture.dsl -o architecture.excalidraw
excalidraw-cli convert architecture.excalidraw --format pngNo install
npx --yes @swiftlysingh/excalidraw-cli create --inline "(Start) -> [Process] -> {Decision?}" -o flow.excalidraw
npx --yes @swiftlysingh/excalidraw-cli convert flow.excalidraw --format pngGraphviz DOT
DOT works too, if you already have Graphviz input.
excalidraw-cli create --format dot --inline 'digraph { A [label="Start"]; B [label="Process"]; A -> B; }' -o flow.excalidrawA worked example
The clip below is a recorded terminal session, not a live agent run. I walked the CLI through this
repo's own src/ tree, wrote a short left-to-right DSL, ran create, and
held the exported PNG.
Watch the recording (12-second GIF)

A recorded terminal session, not a live agent run. The CLI turns this repo's src/ into an architecture diagram.
The DSL from that recording is:
@direction LR
(CLI) -> [DSL parser] -> [ELK layout]
(API) -> [JSON parser] -> [ELK layout]
(CLI) -> [DOT parser] -> [ELK layout]
(API) -> [DSL parser]
[ELK layout] -> [Arrow router]
[ELK layout] -> [Generator] -> [Factory] -> [[.excalidraw]] -> [PNG]
[Generator] -> [[Types]]
[[.excalidraw]] -> [SVG]The commands in the recording are:
excalidraw-cli create architecture.dsl -o out.excalidraw
excalidraw-cli convert out.excalidraw --format png
The result is the architecture diagram at the end of the clip. CLI and API feed the parsers, then
ELK layout, then the generator and a .excalidraw file, with PNG and SVG exports.
Here is a fresh CLI rendering of that source, generated when this site was built:
Download: .excalidrawPNGSVGDSL
The examples gallery has a few more diagrams, including this iOS app architecture.
An agent following the skill would write a DSL like the one in the recording after looking at your
code, then run the same two commands. The file you keep is the
.excalidraw one.
Edit the result in Excalidraw
Open the .excalidraw file at excalidraw.com with
File > Open. You can also import it into Obsidian's Excalidraw plugin. The layout is already
done, so you are adjusting labels, spacing, and style, not building the graph from scratch.
If a label is wrong, it is usually faster to fix the DSL and run create again than to
fight a one-off drag in the editor. For a one-time polish pass, the editor is fine.
Regenerating from DSL creates a fresh layout and does not preserve manual canvas changes. Save your edited scene separately if you want to keep both versions.
Troubleshooting
The skill does not show up
Confirm npx skills add swiftlysingh/excalidraw-cli finished, or that
skills/excalidraw-cli is in ~/.claude/skills,
~/.cursor/skills, or ~/.codex/skills. Restart the agent session so it
reloads skills. In Claude Code you can also install the plugin with the
/plugin commands above.
create fails, or the command is not found
You need Node.js 20.19 or newer. Node 18 is not supported. If the binary is not on your PATH,
use npx --yes @swiftlysingh/excalidraw-cli or install with Homebrew.
You installed the official CLI by mistake
@excalidraw/cli provides the excalidraw command, with
excalidraw render and excalidraw mermaid. This package is
@swiftlysingh/excalidraw-cli, and the binary is excalidraw-cli. There
is also an unrelated unscoped npm package named excalidraw-cli. Use the scoped
name.
create rejected -o diagram.png
That is expected. create only writes .excalidraw. Run
excalidraw-cli convert diagram.excalidraw --format png after it.
A labeled arrow was rejected
Edge labels have to be the full form, [A] -> "label" -> [B]. Mixed forms such
as [A] --> "x" -> [B] are rejected because they are ambiguous.
The official MCP is not this skill
This package has no MCP server. If your client is asking for an Excalidraw+ API key or an OAuth sign-in, you are talking to the official MCP, not this skill.
Back to excalidraw-cli, or browse the examples.