hand-drawn-diagrams is an AI skill that converts natural language prompts into hand-drawn Excalidraw diagrams. It produces a hosted edit URL, animated SVG, and PNG — from a single prompt, no app required.
This repository contains the skill definition, rendering scripts, and installer for Claude Code and compatible agents.
hand-drawn-diagrams/
├── SKILL.md # Skill entry point (name + description)
├── workflow.md # Master workflow — read this first
├── steps/
│ ├── step-01-route.md # Pick diagram type from routing table
│ ├── step-02-draw.md # Generate .excalidraw + .animationinfo.json
│ └── step-03-validate.md # Validate, get hosted URL, offer animation
├── references/
│ ├── activation-routing.xml # Route selection rules
│ ├── fundamental-shapes.md # Core shape language
│ ├── json-schema.md # .excalidraw JSON schema
│ ├── element-templates.md # Grid layout + element templates
│ ├── animation-spec.md # Animation story patterns
│ ├── quality-checklist.md # Diagram quality rules
│ ├── patterns.md # Reusable layout patterns
│ └── *-diagrams.md # Per-route guides (teachers, ux, funnel…)
├── scripts/ # Python rendering tools (managed with uv)
│ ├── validate_excalidraw.py # Pre-flight validation — run before URL gen
│ ├── get_excalidraw_urls.py # Generates hosted Edit + Animate URLs
│ ├── edit_excalidraw.py # Opens diagram in hosted editor
│ ├── render_excalidraw.py # PNG export (Playwright fallback)
│ ├── render_animated_svg.py # Animated SVG export (Playwright fallback)
│ ├── animate_excalidraw.py # Animation helper
│ ├── hosted_scene_urls.py # URL encoding utilities
│ ├── local_excalidraw_server.py
│ ├── pyproject.toml # Python deps: playwright>=1.40, pytest
│ └── tests/ # pytest test suite
├── installscripts/
│ ├── install.py # Detects Claude Code / Agent CLI, installs skill
│ └── uninstall.py
├── install.sh / install.cmd # Shell wrappers → installscripts/install.py
├── uninstall.sh / uninstall.cmd
└── docs/ # Additional documentation
- Language: Python 3.11+
- Package manager:
uv(always useuv run python ...for scripts) - Rendering: Chrome DevTools MCP (preferred) or Playwright (fallback)
- Output format:
.excalidrawJSON,.animationinfo.json,.animated.svg,.png - Diagram host: Excalidraw hosted editor (gzip/base64 scene in URL hash)
The skill is activated via SKILL.md. When activated, it follows workflow.md:
- Route (
step-01-route.md) — pick one diagram type - Draw (
step-02-draw.md) — write.excalidraw+.animationinfo.json - Validate (
step-03-validate.md) — validate, generate hosted URL, deliver
.excalidraw+.animationinfo.json→/tmp/hand-drawn-diagrams/<slug>/(never litter workspace).animated.svg→ always the user's project/workspace directory- Write to workspace only if user specifies a path
cd scripts
uv run python validate_excalidraw.py "/absolute/path/to/file.excalidraw"
uv run python open_diagram.py "/absolute/path/to/file.excalidraw" # preferred: writes open.html + opens browser
uv run python get_excalidraw_urls.py "/absolute/path/to/file.excalidraw" # fallback: prints raw URLs
uv run python render_excalidraw.py "/absolute/path/to/file.excalidraw"
uv run python render_animated_svg.py "/tmp/.../diagram.excalidraw" --output "/project/name.animated.svg"- Chrome DevTools MCP — fast, uses real browser, no install required
- Playwright scripts — fallback only
- Hosted edit URL (always first, after validation passes)
- Offer animation ("Want a video version?")
- PNG only if explicitly requested
- Hand-drawn / sketch font
- Monochrome (no fills unless essential)
- Files go to
/tmp/— workspace stays clean
cd scripts
uv run pytest # all tests
uv run pytest -m "not slow" # skip Playwright/Chromium tests
uv run pytest tests/test_validate_excalidraw.pybash install.sh # macOS/Linux — detects Claude Code and Agent CLI
install.cmd # Windows
bash uninstall.sh # macOS/Linux
uninstall.cmd # Windows- Do not write
.excalidrawfiles to the user's workspace without being asked - Do not run
get_excalidraw_urls.pybeforevalidate_excalidraw.pyexits 0 - Do not render before the
.excalidrawfile is written and validated - Do not use
excalidraw.comdirectly — useedit_excalidraw.pyto get hosted URLs - Do not add multiple colors/fills for decoration — keep diagrams monochrome by default
- Do not write paragraphs inside shapes — diagrams use 1–5 word labels only