No layout
ELK layout, box render
Every diagram becomes a native .drawio file first, then whatever format you asked for.
The official draw.io skill, shipped byte-identical to Claude Code, Codex, Copilot, Cursor and Antigravity. Author as Mermaid or XML, repair it, lay it out with ELK, and export with the XML embedded so every PNG stays editable. I read the skill, ran both servers’ test suites and the shared modules. Every diagram becomes a native .drawio file first, then is delivered in the requested output format, whether you authored Mermaid or XML.
Agents in terminals (Claude Code, Codex, Copilot CLI) where diagrams cannot render inline.
A .drawio, an embedded-XML PNG/SVG/PDF, or an app.diagrams.net link.
The skill is one pipeline with two ways in.
Inline first. Inline viewer first. In chats that render diagrams, the MCP create_diagram tool wins.
Author. Mermaid when the desktop CLI exists; XML otherwise. If Mermaid was requested but no desktop CLI is available, author the same diagram as XML.
Repair. It changes nothing in a well-formed file, and needs only Node.js.
Lay out. The CLI's --layout step auto-positions XML-authored diagrams with the same ELK layouts as the editor's Arrange ▸ Layout menu and the draw.io MCP app server.
Deliver. Exports use double extensions so the name says the XML is inside.
Pick an authoring route, a layout or an output. Quotes are checked against SKILL.md at build time.
New in plugin 1.2.6. Both fixes stop the agent from guessing.
Icon lookup. never guess mxgraph.* names: look them all up in one call to scripts/find-shapes.js in this skill's folder (Node.js 18+, network), one query per icon, narrowed by library (aws4, azure2, cisco19). Why: a wrong stencil name renders as an empty box, and this works without the MCP server.
Output. prints title width×height style lines; use a style as is:
macOS CLI. this prints the first of drawio on PATH (Homebrew), /Applications, the per-user ~/Applications and Spotlight, or nothing if draw.io is absent:
Use the real binary. Call the binary inside the .app: a copy or symlink outside it dies with Unable to find helper app.
File naming. The File naming section no longer tells you to delete the .mmd or intermediate .drawio; the workflow steps above it still do.
node <skill-folder>/scripts/find-shapes.js "aws4 lambda" "github" "slack"
# macOS: which draw.io will the skill use?
{ command -v drawio; ls /Applications/draw.io.app/Contents/MacOS/draw.io ~/Applications/draw.io.app/Contents/MacOS/draw.io
mdfind "kMDItemCFBundleIdentifier == 'com.jgraph.drawio.desktop'" | sed 's|$|/Contents/MacOS/draw.io|'; } 2>/dev/null | head -1Read from upstream source at 639186a. Neither server was installed or test-run on this box.
PNG/SVG from the viewer. Copy the diagram XML; download it as a .drawio file, PNG or SVG and copy it as a PNG where the host allows it.
Rendering feedback. The XML doesn't tell the model how wide a label comes out. The viewer adds a layout check (and a PNG on hosts that take images) to model context.
One-click layout fix. the toolbar shows a chip, "Fix N issues" when the check found something and the host can take a follow-up.
Self-hosted editor. Set DRAWIO_BASE_URL to a self-hosted draw.io for Open in draw.io and the link given when the host has no inline viewer.
Link only. Set DRAWIO_BROWSER to off to get only the URL. Headless agents, CI and SSH skip launching a browser.
ELK layouts and Mermaid conversions rendered on this box, plus the repo’s own gallery. Click to enlarge.
ELK layout, box render
ELK layout, box render
ELK layout, box render
ELK layout, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Mermaid → .drawio → PNG, box render
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
Repo gallery (docs/images/gallery)
The skill’s inline repair step is a small version of repair-xml.js. I imported each module and ran it on test input.
All runs used a copy of the repo in /tmp, with nice and timeout, at commit 05c1747.
| Run | Result | Note |
|---|---|---|
| mcp-tool-server npm test | 125/125 pass | About 1 s. |
| mcp-app-server npm test | 76 pass, 2 skipped | Skipped tests need a live Worker (EDGE_COMPARE_URL). |
| SKILL.md repair one-liner | fixed | Prose, fence, unescaped label and self-parented layer. |
| SKILL.md URL one-liner | round-trips | 247-character link for a tiny diagram. |
| Shared modules | work | repair, normalize, mermaid-elk and shape search all behaved as documented. |
| 5 SKILL.md ports | byte-identical | A CI workflow enforces it. |
| draw.io Desktop CLI | not on the box | Mermaid conversion, layout and export need it. |
| app-server 1.7.0, tool-server 1.11.0 | upstream source only | Not installed or test-run here. PNG/SVG download and copy, layout-fix chip, rendering layout check, DRAWIO_BASE_URL, DRAWIO_BROWSER=off. |
Without it the skill can only write XML and a URL. The skill says so and falls back cleanly.
SKILL.md tells the agent to fetch xml-essentials.md and mermaid-reference.md from raw.githubusercontent.com/…/main, so a skill pinned at one commit reads rules from another.
The inline one-liner and repair-xml.js do overlapping work; only the module reports what it changed or handles leaked tool-call tags.
“cisco router” returns a stencil titled “10700” above “ATM Router”.
-e embeds the XML, and the double extension tells people it is there.
One workflow fails the build if any port’s SKILL.md drifts from the Claude Code copy.
One native artifact, many deliveries. Write the source format first; derive the rest.
Prefer a layout engine to model coordinates. Ask for structure, not positions.
Measure the model’s mistakes, then fix them in code. repair-xml.js says its three fixes covered all 15 broken diagrams out of 473.
Detect the environment exhaustively. The Windows chain checks PATH, install paths, registry and other drives before giving up.
Keep ports identical by CI.
Each quote on this page is compared with its source file at build time; the build fails on any mismatch.