Write
Diagrams
Draw editable draw.io diagrams that follow the theme.
Diagrams are native draw.io files, drawn with the drawio-design skill. Anyone can open and edit them later. One file serves the light and the dark theme.
Before you start
- Install the agent skills. The driftless plugin installs drawio-design with it. Refer to Agent skills.
- Install the draw.io desktop app.
npm run diagramsuses it to export. SetDRAWIOto its path ifdrawiois not on PATH.
Draw a new diagram
Ask for it
In Claude Code, ask for the diagram and name the page it is for, for example “draw how a request moves through the API, for the API overview page”. The
docs-diagramskill picks the type, states its plan, and builds the file from a script indocs/diagrams/src/<name>.py.Check it
The skill runs drawio-design’s
check_drawio.pyand renders a preview. It fixes every defect the check names, such as text that does not fit or lines that cross a box.Export it
Run
npm run diagrams -- <name>. This writesdocs/diagrams/<name>.svg, with theme tokens in place of colours.Place it
Add the diagram to the page. The alt text says what the diagram shows, not how it looks.
<Diagram name="request-flow" alt="A request goes from the browser to the API, then to the database." caption="How a request moves" />
Change a diagram
Open docs/diagrams/<name>.drawio in draw.io or diagrams.net, or ask Claude Code to edit the XML in place. Do not run the script in docs/diagrams/src again: it would overwrite manual edits. Then run check_drawio.py and npm run diagrams -- <name>.
How the theme works
- You draw with colours from the palette in
driftless.config.ts. The default palette matches drawio-design’s default skin. npm run diagramsexports each.drawiofile to SVG.- The export changes each palette colour to a
--d-*token fromsrc/styles/tokens.css. Each token has a light and a dark value.
A colour outside the palette stays as drawn, and the export lists it. Set diagrams.strict: true to stop the export instead.
Rules
| Rule | Why |
|---|---|
| Canvas 560px wide | Text draws at about its real size in the page column |
| Light skin only | The site maps colours to theme tokens for dark mode |
| Plain-text labels, in sentence case | HTML labels export as images |
| Accent on one or two items | The accent marks what the diagram is about |
| About 9 boxes at most | Over that, split it into an overview and a detail |
| Dashed outline for a boundary that someone else owns | It shows who runs what |