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. Prefer Mermaid for the standard types above. Use XML for precise control, or when nothing can convert Mermaid. PNG, SVG and PDF need the desktop CLI either way.
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.
MCP icon=name (not the plugin). Plugin 1.3.1. On the MCP servers at a7d1ead, a vertex style can name an icon instead of guessing an mxgraph.* stencil: icon=aws lambda (~1,750 AWS/Azure/GCP/K8s). Shipped in tool-server 1.13.0 and app-server 1.10.0; create_diagram and open_drawio_xml expand it. The plain CLI does not. Upstream source, not runtime-tested here; see Servers.
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 a7d1ead. Plugin 1.3.1. Neither server was installed or test-run on this box.
PNG/SVG from the viewer (app-server 1.9.0). Copy the diagram XML; download it as a .drawio file, PNG or SVG and copy it as a PNG or SVG where the host allows it. Copy as SVG writes what draw.io's does.
Icons by name (tool-server 1.13.0, app-server 1.10.0). icon=aws lambda in a vertex style stands for the official icon of that service (~1,750 AWS, Azure, GCP and Kubernetes icons). Write icon=aws lambda, icon=azure functions, icon=gcp pub sub, or icon=kubernetes pod; the resolver fills in the official style. Expanded in MCP create_diagram and open_drawio_xml; the plain CLI does not expand them. Upstream source only — not runtime-tested here.
Table-row and role XML (app-server 1.10.0). rows="PK id|FK author_id|title" expands into stacked table cells. role=step, decision, start, end, error, data, plus external and container, pick the calm-theme shape and color. Expanded in MCP create_diagram (and the viewer on the tool input); the tool server, the skill and the plain CLI do not. Upstream source only — not runtime-tested here.
Connector layout check. one line per connector with everything found on it. This pass moves such a waypoint onto the connection point's line when it sits less than 3 px off a fixed port, so the router adds no jog at the shape.
Self-hosted / link only. Set DRAWIO_BASE_URL to a self-hosted draw.io. Set DRAWIO_BROWSER to off to get only the URL. The layout-fix chip remains: the toolbar shows a chip, "Fix N issues".
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.10.0, tool-server 1.13.1 | upstream source only | Not installed or test-run here. Icons by name (icon=aws lambda, ~1,750 AWS/Azure/GCP/K8s) shipped in tool-server 1.13.0 and app-server 1.10.0; rows=/role= XML shorthands in app-server 1.10.0. Icons expand in create_diagram and open_drawio_xml; rows=/role= in create_diagram. The plain CLI expands neither. Copy as SVG is app-server 1.9.0. Plugin 1.3.1. Draw.io Desktop 32.7.4 (17 Nov 2026): PDF --width/--height and %pagecount% fixed; data sources removed from Desktop (web-only); Style Rules still work in Desktop. Not CLI-tested on this box. |
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.