excalidraw-figures
Hand-drawn article figures from one bilingual spec. Write the figure once in Python, get an editable .excalidraw, an SVG preview and a real-browser PNG for every language, plus a layout check that catches text overlaps before your readers do.

From the article "Agents Only Build What You Measure". The same spec also produced the Traditional Chinese version; both are in the gallery below.
Why
Editorial diagram systems are precise and cold. For a personal blog, a talk, or a README written in the first person, the Excalidraw look reads as someone drew this to explain something to you, and the author can still open the file and move a box. The problem with drawing by hand is drift: five figures in two languages is ten files that fall out of sync the moment a label changes. So the figure lives in a spec; the files are outputs.
- One spec, N languages. Every label is
{"en": ..., "zh": ...}. Add a language by adding a key.
- Editable output. Real
.excalidraw JSON (schema v2, Excalidraw's own palette and font). Open it in excalidraw.com or the Obsidian Excalidraw plugin and keep drawing.
- What the reader sees. PNG rendered by headless Chrome from the preview SVG, so you check the actual pixels, not a thumbnail.
- A check that fails.
--check reports text outside the canvas, text wider than its box, text over text, and free text straddling a box edge. Exit code 1 means fix it.
- Small budget on purpose. Three fills plus white, ≤ 10 boxes, labels never on lines. The discipline is in
skills/excalidraw-figures/references/style.md.
How it works
One spec function becomes three files per language, gated by a layout check before anything reaches an article. This figure is itself built with the tool (examples/readme-workflow/spec.py):

- Write the spec. A Python function per figure, calling
d.box(...), d.arrow(...), d.path(...). Every label is bilingual: {"en": "...", "zh": "..."}.
- Build.
excalidraw_lib.py calls each function once per language and writes three files per figure: an editable .excalidraw, an approximate .svg preview, and — via a headless-Chrome screenshot of that SVG — a .png showing what a reader actually sees.
- Gate on
--check. The self-check estimates every label's width against its box and flags text outside the canvas, text wider than its box, text over text, and free text straddling a box edge. Any issue exits 1 — fix the spec and rebuild, you never hand-patch the generated files.
- Look at the PNG. The check is an estimate, not a render; open every PNG before you trust it. Move labels with
mid=(x, y), route arrows around text with path([...]).
- Ship it. Reference the PNG in the article, keep the
.excalidraw next to it for later hand edits, and commit the spec so the figure regenerates whenever the text changes.
The Traditional Chinese version of this exact figure is in the gallery below, from the same spec.
Install
Claude Code (as a skill):
/plugin marketplace add InjayTseng/excalidraw-figures
/plugin install excalidraw-figures@excalidraw-figures
Then ask: "draw the three-gate flow for this section as an excalidraw figure, EN and ZH". The skill loads SKILL.md, writes a spec, builds, checks, and looks at the PNGs.
Editable install (any agent, or by hand):
git clone https://github.com/InjayTseng/excalidraw-figures ~/code/excalidraw-figures
ln -s ~/code/excalidraw-figures/skills/excalidraw-figures ~/.claude/skills/excalidraw-figures
Requirements: Python 3.9+, no packages. PNG export needs Google Chrome or Chromium (CHROME_BIN to override the path); without it you still get .excalidraw and .svg.
Quickstart
cp skills/excalidraw-figures/templates/spec-template.py my-figures.py
# edit the labels and boxes
python3 skills/excalidraw-figures/scripts/excalidraw_lib.py my-figures.py --out figures/ --png --check
open figures/F1-before-after-EN.png
A spec is a list of functions, one per figure:
from excalidraw_lib import Diagram, GATE, AGENT, FAIL, FIX, NOTE, GRAY
def gate_flow(lang):
d = Diagram("F1-gate-flow", 1000, 520, lang)
d.title({"en": "State the claim, not the topic", "zh": "標題寫論點,不寫主題"})
d.box(30, 110, 150, 60, {"en": "idea", "zh": "想法"})
d.arrow(180, 140, 230, 140)
d.box(230, 100, 170, 80, {"en": "worth it?", "zh": "值得嗎?"}, GATE, "diamond")
d.arrow(400, 140, 450, 140, {"en": "yes", "zh": "是"})
d.box(450, 110, 150, 60, {"en": "build", "zh": "開發"})
d.path([(525, 170), (525, 215), (105, 215), (105, 170)], {"en": "next round", "zh": "下一輪"}, mid=(315, 215))
return d
DIAGRAMS = [gate_flow]