/diagrams:drawiofrom diagrams
Read, convert, and export draw.io / diagrams.net files. Use when the user has legacy .drawio or .drawio.png/.drawio.svg files to inspect, extract content from, convert to Mermaid or another format, or export headlessly to PNG/SVG from the command line - or asks about drawio, diagrams.net, or mxGraph XML. Covers the compressed and uncompressed XML formats, a Python decompression recipe, and the desktop app's CLI export flags.
Ships in diagrams. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
draw.io (diagrams.net) files turn up in archives as unconverted .drawio sources. This skill covers reading them without the GUI, migrating their content to maintainable formats (usually Mermaid), and headless PNG/SVG export.
Scope: this skill owns the draw.io format and export mechanics. Which tool a new diagram should use → the selection guide in the diagrams skill; new repo-doc diagrams are usually Mermaid, not draw.io.
A .drawio file is XML: an <mxfile> root with one <diagram> element per page. Two variants:
<diagram> contains a readable <mxGraphModel> with <mxCell> nodes. Newer draw.io versions default to this.<diagram> body is a base64 string of a raw-deflate, URL-encoded payload. Most archived files are this kind.Also common: .drawio.png / .drawio.svg — normal images with the diagram XML embedded (PNG tEXt chunk / SVG content attribute), re-editable by draw.io.
import base64, zlib, urllib.parse, xml.etree.ElementTree as ET
def drawio_pages(path):
"""Yield (page_name, mxGraphModel_xml) per page, handling both variants."""
for diagram in ET.parse(path).getroot().iter("diagram"):
inner = list(diagram)
if inner: # uncompressed: child element present
xml_text = ET.tostring(inner[0], encoding="unicode")
else: # compressed: text is b64(raw-deflate(urlencoded))
raw = base64.b64decode(diagram.text.strip())
xml_text = urllib.parse.unquote(
zlib.decompress(raw, wbits=-15).decode("utf-8")
)
yield diagram.get("name", "Page"), xml_text
wbits=-15 (raw deflate, no zlib header) is the detail everyone gets wrong.
Inside <mxGraphModel><root>:
<mxCell vertex="1"> = node; label in value (may be HTML), position/size in child <mxGeometry>; style holds shape=...;fillColor=....<mxCell edge="1"> = connection; source/target reference vertex ids.parent pointing at a group/container cell are nested inside it.To extract structure: collect vertices (id → stripped label), then edges (source label → target label). That node/edge list is exactly the input a Mermaid flowchart needs.
Preferred target is Mermaid (see the mermaid skill — house rule: strip parentheses/special characters from labels during conversion, legacy labels are full of them). Workflow:
flowchart TD with sanitized labels; map containers to subgraph.Keep the original .drawio beside the conversion until the new source is reviewed; archive rather than delete.
The draw.io desktop app ships the exporter. macOS binary lives inside the app bundle; alias it once:
alias drawio="/Applications/draw.io.app/Contents/MacOS/draw.io"
drawio --export --format png --scale 2 --output out.png legacy.drawio
drawio --export --format svg --output out.svg legacy.drawio
drawio --export --format png --all-pages --output pages.png legacy.drawio # pages-1.png, pages-2.png…
drawio --export --format png --page-index 1 --output page2.png legacy.drawio
Useful flags: --scale 2 (crisp PNG for decks), --border 10 (padding), --transparent (PNG only — mind the dark-mode caveat in the diagrams skill), --crop (trim to content).
brew install --cask drawio (macOS). Linux CI: the AppImage/deb works headlessly under xvfb-run.diagrams skill (numbered files in the artifact's diagrams/ folder).| Symptom | Cause | Fix |
|---|---|---|
zlib.error: invalid header | Used default wbits | zlib.decompress(raw, wbits=-15) |
Garbled %3CmxGraphModel... text | Skipped URL-decode step | urllib.parse.unquote after decompress |
| Empty export | Multi-page file, wrong page | --all-pages or --page-index N |
Labels full of <br>/<b> | draw.io labels are HTML | Strip tags when extracting text |
| Export hangs in CI | No display server | Wrap in xvfb-run on Linux |
| Blurry PNG in a deck | Default 1x scale | --scale 2 or higher |
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/diagramsCreate technical architecture diagrams using Python's diagrams library (mingrammer/diagrams) or raw Graphviz dot. Use when users need to create cloud architecture diagrams with provider icons (Azure, GCP, AWS, Kubernetes, on-prem), system design diagrams, infrastructure visualizations, data flow diagrams, dependency graphs, org or process trees, or any structural diagram showing relationships between components. Also the hub for choosing the right diagram tool (Python diagrams vs Mermaid vs draw.io vs Excalidraw) and for the SVG plus PNG output pipeline that feeds GitHub markdown, PowerPoint decks and exec briefings, and standalone architecture docs. Includes iterative review loop and custom Graphviz attributes for professional formatting. Self-improving - accumulates learnings in memory file to avoid repeating mistakes. Structural diagrams only - data charts and plots belong to the dataviz skill, deck theming to presentations./excalidrawCreate sketch-style, hand-drawn-look architecture diagrams as Excalidraw files. Use when the user asks for an excalidraw diagram, a whiteboard-style or sketchy diagram, or wants a .excalidraw file created or edited. Works with or without the Excalidraw MCP tools - when the MCP tools are unavailable, author the .excalidraw JSON scene directly. Covers the scene JSON schema, element and arrow-binding essentials, an offline headless render-and-lint loop that screenshots a scene and names its defects, and export to SVG/PNG.Other plugins' skills for the same job
npx claudepluginhub hsb3/dotfiles-agents --plugin diagrams