excalidraw-cli

Generate editable Excalidraw diagrams from DSL, JSON, or Graphviz DOT, with auto-layout and PNG or SVG export. Install it as a skill and Claude Code or Cursor can draw architecture diagrams for you.

This is @swiftlysingh/excalidraw-cli, an independent package by Pushpinder Singh. It is not the official Excalidraw CLI.

Install the agent skill

Add the skill to Claude Code, Cursor, or Codex:

npx skills add swiftlysingh/excalidraw-cli

Then ask for a diagram:

Draw the architecture of this repo as an Excalidraw diagram.
Write a .excalidraw file I can edit, and export a PNG preview.

The agent writes a short DSL file, runs excalidraw-cli create, and leaves an editable .excalidraw file in your repo. If you asked for a preview, it runs convert to write a PNG or SVG. The guide covers Gemini CLI, the Claude Code plugin, and troubleshooting.

Use the CLI directly

Run it once with npx:

npx --yes @swiftlysingh/excalidraw-cli create --inline "(Start) -> [Process] -> {Decision?}" -o flow.excalidraw

Or install it with Homebrew, then use excalidraw-cli create:

brew install swiftlysingh/tap/excalidraw-cli

create only writes the .excalidraw file. Export an image in a second step:

npx --yes @swiftlysingh/excalidraw-cli convert flow.excalidraw --format png

Open the file in Excalidraw to edit it. Node.js 20.19 or newer.

Example

This repo's own architecture, written as 9 lines of DSL:

@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]
CLI and API feed DSL, JSON, and DOT parsers, then ELK layout, the generator, and an editable .excalidraw file with PNG and SVG exports.

Download: .excalidrawPNGSVGDSL

The site build runs excalidraw-cli create on that source, so the diagram is real output. See more in the examples.

DSL syntax

Syntax Draws
[Label] Rectangle, for a step or component
{Label} Diamond, for a decision
(Label) Ellipse, for a start or end
[[Label]] Database
[A] -> [B] Arrow. <-> points both ways, --> is dashed
[A] -> "label" -> [B] Labeled arrow

The README has the full syntax, including images, inline styles, and the JSON format.

How this differs from the official tools

Tool What it does Account Needs
@swiftlysingh/excalidraw-cli (this package) Generates a new .excalidraw file on your machine from DSL, JSON, or DOT. There is no MCP server in this package today. None. Everything runs on your machine. Node.js 20.19 or newer
@excalidraw/cli The excalidraw command. Renders an existing drawing to PNG or SVG, and can turn Mermaid into an Excalidraw scene. Workspace commands need an Excalidraw+ login. Node.js 22 or newer
Excalidraw MCP Connects Claude, Cursor, or another MCP client to an Excalidraw+ workspace. An Excalidraw+ workspace, plus OAuth or an API key. An MCP client

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.

FAQ

Is this the official Excalidraw CLI?

No. The official @excalidraw/cli renders existing drawings and converts Mermaid. This package, @swiftlysingh/excalidraw-cli, generates a new .excalidraw file from DSL, JSON, or DOT.

Do I need an Excalidraw+ account?

No. Everything runs on your machine.

What does the agent actually run?

excalidraw-cli create to write the .excalidraw file, then excalidraw-cli convert if you asked for a PNG or SVG. create will reject -o file.png. That export is a second step.

Is there an MCP server?

Not in this package. If your client asks for an Excalidraw+ login or an API key, that is the official MCP, not this skill.

Can I edit the result?

Yes. Open the .excalidraw file at excalidraw.com with File > Open, or import it into Obsidian's Excalidraw plugin.