Tutorial

Connect Claude Code to Excalidraw

Generate architecture diagrams, flowcharts, and wireframes from natural language — right from your terminal.

Excalidraw is an open-source virtual whiteboard with a distinctive hand-drawn aesthetic. Claude Code is Anthropic's AI coding agent that lives in your terminal. Together, they let you describe a diagram in plain English and get an editable .excalidraw file in seconds.

This tutorial walks through three integration methods — from the simplest skill-based approach to the full MCP server setup — so you can pick the one that fits your workflow.

What you'll build

Prerequisites

1

Method A: Excalidraw Skill (simplest)

Claude Code skills are markdown files in your .claude/skills/ directory that teach Claude new capabilities. The Excalidraw skill lets Claude generate .excalidraw files programmatically.

Install the skill

Create the skill file in your project:

bash mkdir -p .claude/skills curl -o .claude/skills/excalidraw.md \ https://raw.githubusercontent.com/bmadcode/BMAD-METHOD/main/skills/excalidraw-diagram-creator.md

Use it

Launch Claude Code in your project directory and ask for a diagram:

prompt # In Claude Code, just type: Create an Excalidraw architecture diagram showing the request flow through our API gateway, auth service, and database layer.

Claude reads the skill, generates the JSON structure for boxes, arrows, and labels, and writes a .excalidraw file to your project. Open it in Excalidraw to edit further.

Tip: Add the skill to your repo's .claude/ directory so every team member gets diagram generation automatically.
2

Method B: Excalidraw MCP Server

The Model Context Protocol (MCP) approach gives Claude a live connection to Excalidraw's rendering engine. Diagrams can be rendered to PNG/SVG and displayed in real time.

Install the MCP server

bash npm install -g @anthropic-ai/excalidraw-mcp

Configure Claude Code

Add the server to your Claude Code MCP configuration:

json // .claude/mcp_servers.json { "excalidraw": { "command": "npx", "args": ["@anthropic-ai/excalidraw-mcp"] } }

Generate diagrams

prompt # Claude Code now has access to Excalidraw tools: Using the Excalidraw MCP, create a system diagram showing our microservices architecture with service boundaries.

The MCP server handles rendering, so Claude can create, modify, and export diagrams without you leaving the terminal.

3

Method C: Code generation

If you prefer full control, Claude Code can write a Node.js script that programmatically builds Excalidraw files using the @excalidraw/excalidraw package:

prompt Write a Node script that generates an Excalidraw diagram of the database schema in ./prisma/schema.prisma. Output it as diagram.excalidraw in the project root.

This approach is ideal for CI/CD pipelines where you want diagrams auto-generated from source files on every commit.

Real-world use cases

Tips for better diagrams

  1. Be specific about layout — mention "left-to-right flow" or "top-down hierarchy" in your prompt
  2. Name your components — "API Gateway, Auth Service, User DB" gives better results than "the services"
  3. Iterate — ask Claude to adjust colors, spacing, or add labels after the first generation
  4. Combine with code reading — point Claude at actual source files for accurate diagrams
What's next? Once you have a diagram workflow, consider combining it with Remotion for animated video walkthroughs of your architecture.

Need help integrating AI tools?

Rivok Labs helps teams adopt AI workflows that actually stick — strategy, implementation, and training.

Start a conversation