Home
cd ../playbooks
Creative & DesignIntermediate

Excalidraw Diagram Generator

Generate Excalidraw diagrams directly from text in three formats — Obsidian-ready .md, standalone .excalidraw for excalidraw.com, and an animated .excalidraw with per-element playback order — with the exact JSON element schema (including the undocumented fields that break excalidraw.com if included), a font-size floor, and a full color palette with contrast rules.

5 minutes
By breferrari (obsidian-mind)Source
#excalidraw#obsidian#diagrams#flowcharts#note-taking

An Excalidraw JSON file with a stray frameId, versionNonce, or rawText field, or boundElements set to [] instead of null, can silently fail to load correctly on excalidraw.com — the format has real gotchas that aren't obvious from just looking at an exported file, and getting them wrong is the difference between a diagram that opens and one that doesn't.

Who it's for: Obsidian users who want hand-drawn-style diagrams generated directly into their vault, developers or writers needing a quick flowchart, mind map, or comparison diagram without opening a drawing tool manually, anyone building an animated diagram for a presentation or video via excalidraw-animate, teams standardizing diagram colors and typography across a set of Excalidraw exports

Example

"Turn this process description into an Excalidraw flowchart" → The output mode detected from context (Obsidian .md by default), the content analyzed into steps and connections, a flowchart generated with the correct color-coded shapes (light blue for inputs, light green for completed steps) and the exact JSON schema needed for it to open correctly, saved directly into the current working directory with usage instructions

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Excalidraw Diagram Generator

Generate Excalidraw diagrams from text content in three output modes: Obsidian (`.md`, opens directly in the Obsidian Excalidraw plugin), Standard (`.excalidraw`, opens/edits/shares on excalidraw.com), and Animated (`.excalidraw` with a per-element animation order, for use with excalidraw-animate).

## Choosing the Output Mode

| Trigger words | Mode | File format | Use case |
|---|---|---|---|
| "Excalidraw," "diagram," "flowchart," "mind map" | Obsidian (default) | `.md` | Open directly in Obsidian |
| "standard excalidraw" | Standard | `.excalidraw` | Open/edit/share on excalidraw.com |
| "animate," "animated excalidraw" | Animated | `.excalidraw` | Drag into excalidraw-animate to generate an animation |

## Workflow

1. Detect the output mode from the trigger words above.
2. Analyze the content — identify concepts, relationships, and hierarchy.
3. Choose the diagram type (see below).
4. Generate the Excalidraw JSON (add an animation order if Animated mode).
5. Output in the correct format for the detected mode.
6. Save automatically to the current working directory.
7. Tell the user the file path and how to use it.

## Output Formats

### Mode 1: Obsidian Format (Default)

Output exactly this structure, with no modifications:

```markdown
---
excalidraw-plugin: parsed
tags: [excalidraw]
---
==⚠  Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠== You can decompress Drawing data with the command palette: 'Decompress current Excalidraw file'. For more info check in plugin settings under 'Saving'

# Excalidraw Data

## Text Elements
%%
## Drawing
```json
{complete JSON data}
```
%%
```

Key points: frontmatter must include `tags: [excalidraw]`; the warning message must be included in full; the JSON is wrapped in `%%` markers; no `excalidraw-*` plugin settings other than `excalidraw-plugin: parsed`. File extension: `.md`. The `## Text Elements` section stays empty (only `%%` delimiters) — the Obsidian plugin auto-populates it from the JSON, so don't manually list text content.

### Mode 2: Standard Excalidraw Format

Pure JSON, openable on excalidraw.com:

```json
{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [...],
  "appState": { "gridSize": null, "viewBackgroundColor": "#ffffff" },
  "files": {}
}
```

`source` uses `https://excalidraw.com` (not the Obsidian plugin URL). Pure JSON, no Markdown wrapping. File extension: `.excalidraw`.

### Mode 3: Animated Excalidraw Format

Same as Standard, but each element adds a `customData.animate` field controlling animation order:

```json
{
  "id": "element-1",
  "type": "rectangle",
  "customData": {
    "animate": { "order": 1, "duration": 500 }
  }
}
```

Animation order rules: `order` is playback order (1, 2, 3...) — lower appears first; `duration` is the element's drawing duration in milliseconds, default 500; elements sharing the same `order` appear simultaneously; recommended order is title → main framework → connection lines → detail text. Usage: generate the `.excalidraw` file, drag it into excalidraw-animate, click Animate to preview, then export as SVG or WebM. File extension: `.excalidraw`.

## Diagram Types and Selection Guide

| Type | Use case | Approach |
|---|---|---|
| Flowchart | Step-by-step processes, workflows, task sequences | Connect steps with arrows, clearly show flow |
| Mind Map | Concept expansion, topic categorization, brainstorming | Radiate outward from a central core |
| Hierarchy | Org charts, content levels, system decomposition | Build level nodes top-down or left-to-right |
| Relationship | Dependencies, influences, interactions between elements | Lines between shapes with arrows and labels |
| Comparison | Side-by-side analysis of two or more approaches | Two columns or table format, comparison dimensions labeled |
| Timeline | Event progression, project milestones, evolution | Time as axis, mark key dates/events |
| Matrix | Two-dimensional categorization, priority grids, positioning | Establish X/Y dimensions, place items on the plane |
| Freeform | Scattered content, brainstorming, initial gathering | No structural constraints, freely place blocks and arrows |

## Design Rules

### Text and Format

- All text elements use `fontFamily: 5` (the Excalifont handwriting font).
- Replace `"` with `『』` and `()` with `「」` in element text.
- Font size hard minimums (below these, text is unreadable at normal zoom): title 20–28px (min 20); subtitle 18–20px; body/labels 16–18px (min 16); minor annotations 14px only, used sparingly. Never go below 14px.
- Line height: all text uses `lineHeight: 1.25`.
- Text centering: standalone text elements don't auto-center — calculate manually: `estimatedWidth = text.length * fontSize * 0.5`, then `x = centerX - estimatedWidth / 2`. Example: "Hello" (5 chars, fontSize 20) centered at x=300 → estimatedWidth = 50 → x = 275.

### Layout and Design

- Keep all elements within a 0–1200 x 0–800 canvas area.
- Minimum shape size for rectangles/ellipses with text: 120×60px.
- Minimum element spacing: 20–30px, to prevent overlap.
- Use different colors and shapes to distinguish information levels.
- Use rectangles, circles, and arrows to organize information — no emoji in diagram text; use simple shapes or color coding instead.

### Color Palette

**Text colors (`strokeColor` for text):**

| Purpose | Hex | Description |
|---|---|---|
| Title | `#1e40af` | Deep blue |
| Subtitle/connectors | `#3b82f6` | Bright blue |
| Body text | `#374151` | Dark gray (minimum `#757575` on white background) |
| Emphasis/highlight | `#f59e0b` | Gold |

**Shape fill colors (`backgroundColor`, `fillStyle: "solid"`):**

| Hex | Semantic | Use case |
|---|---|---|
| `#a5d8ff` | Light blue | Input, data source, primary nodes |
| `#b2f2bb` | Light green | Success, output, completed |
| `#ffd8a8` | Light orange | Warning, pending, external dependency |
| `#d0bfff` | Light purple | Processing, middleware, special items |
| `#ffc9c9` | Light red | Error, critical, alert |
| `#fff3bf` | Light yellow | Notes, decisions, planning |
| `#c3fae8` | Light teal | Storage, data, cache |
| `#eebefa` | Light pink | Analysis, metrics, statistics |

**Region background colors** (large rectangle + `opacity: 30`, for layered diagrams): `#dbe4ff` frontend/UI layer; `#e5dbff` logic/processing layer; `#d3f9d8` data/tools layer.

**Contrast rules:** text on a white background must be no lighter than `#757575`; on a light fill, use the dark color variant (e.g. `#15803d` on light green, not `#22c55e`); avoid light-gray text (`#b0b0b0`, `#999`) on white backgrounds.

## JSON Element Structure

**Every element requires these fields.** Do not add extra fields like `frameId`, `index`, `versionNonce`, or `rawText` — they can cause issues on excalidraw.com. `boundElements` must be `null`, not `[]`. `updated` must be `1`, not a real timestamp.

```json
{
  "id": "unique-id",
  "type": "rectangle",
  "x": 100, "y": 100,
  "width": 200, "height": 50,
  "angle": 0,
  "strokeColor": "#1e1e1e",
  "backgroundColor": "transparent",
  "fillStyle": "solid",
  "strokeWidth": 2,
  "strokeStyle": "solid",
  "roughness": 1,
  "opacity": 100,
  "groupIds": [],
  "roundness": {"type": 3},
  "seed": 123456789,
  "version": 1,
  "isDeleted": false,
  "boundElements": null,
  "updated": 1,
  "link": null,
  "locked": false
}
```

`strokeStyle` values: `"solid"` (default), `"dashed"` (optional paths, async flows, weak associations), `"dotted"`.

Text elements add these fields on top of the base template (do not include `rawText`):

```json
{
  "text": "Display text",
  "fontSize": 20,
  "fontFamily": 5,
  "textAlign": "center",
  "verticalAlign": "middle",
  "containerId": null,
  "originalText": "Display text",
  "autoResize": true,
  "lineHeight": 1.25
}
```

## Coordinates

Origin (0,0) is top-left. Keep all elements within the recommended 0–1200 x 0–800 pixel range. Every element needs a unique `id` (a plain string like `"title"` or `"box1"` is fine).

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

A text-to-diagram generator for Excalidraw covering three distinct output modes selected by trigger words: an Obsidian-ready Markdown file (the default, wrapped in the exact frontmatter and delimiter structure the Obsidian Excalidraw plugin expects — including leaving the Text Elements section deliberately empty since the plugin auto-populates it from the JSON), a pure .excalidraw JSON file for excalidraw.com, and an animated variant that adds a customData.animate field with playback order and duration to each element for use with excalidraw-animate. It picks the right diagram shape for the content — flowchart, mind map, hierarchy, comparison matrix, timeline, or freeform — based on what the text actually describes, rather than defaulting to one layout regardless of content.

The real value is in the JSON schema discipline: every element field is specified exactly, including several undocumented gotchas that can silently break a file on excalidraw.com if gotten wrong — boundElements must be null rather than an empty array, updated must be the literal value 1 rather than a real timestamp, and extra fields like frameId, versionNonce, or rawText should never be included. A full design system rounds it out: hard font-size minimums below which text becomes unreadable at normal zoom, a manual text-centering formula (since standalone text elements don't auto-center), and a complete semantic color palette — light blue for inputs, light green for completed states, light red for errors — with explicit contrast rules for text on both white and colored backgrounds.


Quick Start

Step 1: Create a Project Folder

mkdir excalidraw-diagrams && cd excalidraw-diagrams

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Generate a Diagram

claude

Describe what you want diagrammed — a process, a concept map, a comparison — and mention "standard excalidraw" or "animate" if you don't want the Obsidian-format default. Claude will pick the right diagram type, generate schema-correct JSON with the semantic color palette applied, and save it with usage instructions.


Tips & Best Practices

  • Stick to the exact undocumented-field rules (boundElements: null, updated: 1, no frameId/versionNonce/rawText) even when hand-editing a generated file afterward — these are the specific fields that cause silent load failures on excalidraw.com rather than obvious errors.
  • Respect the font-size floor (16px minimum for body text, 14px only for minor annotations used sparingly) — Excalidraw's hand-drawn font style already reads smaller than its point size suggests, so going below these minimums produces genuinely unreadable diagrams at normal zoom.
  • For a layered architecture diagram, use the region-background colors (frontend/logic/data layers) at opacity: 30 behind the regular element palette — it's the pattern that keeps a multi-layer diagram readable instead of visually flat.

Limitations

  • The Obsidian output format is tightly coupled to the Obsidian Excalidraw plugin's exact expected structure — a different Obsidian drawing plugin, or a non-Obsidian Markdown renderer, won't render it correctly.
  • Animation support depends on the separate excalidraw-animate tool for actually generating playback (SVG/WebM export); the skill produces the correctly-annotated .excalidraw file but doesn't render the animation itself.
  • Best suited to diagrams expressible as flowcharts, hierarchies, mind maps, or similar structured layouts — a highly custom or illustrative drawing still benefits more from Excalidraw's manual drawing tools than from JSON generation.

$Related Playbooks

Creative & Design

HTML Presentation Builder

Build interactive HTML presentations with animations, code highlighting, and speaker notes using reveal.js.

10 minutes
Advanced
Creative & Design

HTML to PowerPoint Converter

Convert HTML/Markdown to PowerPoint presentations using Marp

10 minutes
Advanced
Creative & Design

AI Image Generation Prompts

Create effective AI image generation prompts for DALL-E, Midjourney, and Stable Diffusion. Generate prompts for various styles and use cases.

10 minutes
Intermediate
Creative & Design

Infographic Layout Designer

Design infographic layouts and content structure. Plan visual storytelling with data, icons, and text hierarchy for impactful information design.

10 minutes
Intermediate
Creative & Design

AI Image Enhancer — Upscale & Sharpen Photos with Claude Code

Upscale low-resolution images, sharpen blurry photos, and remove compression artifacts using Claude Code. Batch-process screenshots, product photos, and graphics for professional quality.

5 minutes
Beginner
Creative & Design

Markdown to Slides Converter

Convert Markdown files into professional presentations exportable to PDF, PPTX, or HTML using Marp.

10 minutes
Beginner
Creative & Design

Structured Design Critique System

A persistent, multi-round design critique pipeline: scope which of 19 design areas your project actually needs, generate real HTML wireframe options for each, collect Keep/Cut feedback, and let locked decisions constrain everything downstream.

15 minutes
Advanced
Creative & Design

Narrative Slide Creator

Narrative-first slide deck creation — design a structured narrative (the ABCDEFG model) first, then generate the visuals, so the story drives the design rather than the other way around.

15 minutes
Intermediate
Creative & Design

Scientific Markdown Mermaid Writing

Comprehensive markdown and Mermaid diagram writing skill. Use when creating any scientific document, report, analysis, or visualization. Establishes text-based diagrams as the default documentation standard with full style guides (markdown + merma...

5 minutes
Beginner
Creative & Design

Scientific Markitdown

Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.

5 minutes
Beginner
Creative & Design

Scientific Paper 2 Web

This skill should be used when converting academic papers into promotional and presentation formats including interactive websites (Paper2Web), presentation videos (Paper2Video), and conference posters (Paper2Poster). Use this skill for tasks invo...

10 minutes
Intermediate
Creative & Design

Scientific Pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDF...

5 minutes
Beginner

Browse all Creative & Design playbooks →