excalidraw-diagrams
Installation
SKILL.md
Excalidraw diagrams from a source document
Generate .excalidraw scenes with a script, not by hand. The script sizes boxes from their text, binds arrows, and fails the build when the layout breaks. The diagram never holds a fact that its source document lacks.
Reference run: a 13-frame production platform diagram in an Obsidian vault, built from its design document.
Workflow
- Write the goals first. One file in the scratchpad: readers, the question each frame answers, checkable success criteria, non-goals, deliverables. Template in
references/design-rules.md. Get the user's go before building. - Fix the source of truth. Update the design doc first. Every value on the diagram must exist in it. A value that is not decided gets a tag: proposed, to assign, open, user-verify. Never invent an address, port, count, or version to fill space.
- Write the frames. Work in a scratch directory, never inside a repo. Copy
examples/example_frames.pytoframes_a.py. One function per frame:f0(doc),f1(doc), and so on. Use only the helpers inscripts/xl.py(its docstring lists them). - Build. From the scratch directory:
python3 <skill>/scripts/build.py frames_a,frames_b out.excalidraw. Fix every ERROR and rebuild. The build exits 1 on errors but still writes the file. - Look at every frame.
<skill>/scripts/preview.sh out.excalidraw prev, then Read each PNG inprev/png. Checks do not replace looking. Fix what is cramped, empty, or wrong. - Cross-check and validate.
python3 <skill>/scripts/crosscheck.py out.excalidraw source.mdlists facts the source lacks.python3 <skill>/scripts/validate.py out.excalidrawchecks structure. Each leftover is either added to the source or removed from the diagram. - Install. Write the file to its final path. Update the embed and the frame table in the doc so the frame names match exactly. Move the old diagram to the vault
.trash/with the reason in the filename (vault rule: neverrm). Tell the user the generator ran once and later edits happen by hand in Obsidian.