d2-diagram
Draw a software architecture, system, data-model or call-flow diagram as D2 text laid out by TALA (D2's whiteboard-style engine, open source since D2 0.9), look at it in the terminal before anyone opens an image, and check that the picture says what it claims — d2 --layout=tala x.d2 x.txt renders the layout as Unicode box drawing, --ascii-mode standard as plain ASCII for a README, and assets/d2-facts.mjs reads the drawn boxes and arrows back out of the render and holds them to a fact sheet. Loop: write .d2 → d2 fmt --check / validate → facts → terminal render → PNG → fix the text. Use when asked for a D2 diagram, an architecture diagram kept as editable text in the repo, a TALA layout, a diagram that shows in a terminal or a code block, or when the repo already has .d2 files. Not for animations or figures with a moving walk (explanatory-animation, explain-with-anim).
Pinned to revision 4d7f92a090c2, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/d2-diagram/SKILL.md
- skills/d2-diagram/assets/d2-facts.mjs
- skills/d2-diagram/assets/vlmkit-workspace.d2
- skills/d2-diagram/assets/vlmkit-workspace.facts.json
- skills/d2-diagram/assets/vlmkit-workspace.svg
- skills/d2-diagram/assets/vlmkit-workspace.txt
Every link opens the file at its source, pinned to the revision this page describes.