← ClaudeAtlas

drawiolisted

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.
hsb3/dotfiles-agents · ★ 0 · Data & Documents · score 70
Install: claude install-skill hsb3/dotfiles-agents
# draw.io Files 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. ## The file format A `.drawio` file is XML: an `<mxfile>` root with one `<diagram>` element per page. Two variants: 1. **Uncompressed** — the `<diagram>` contains a readable `<mxGraphModel>` with `<mxCell>` nodes. Newer draw.io versions default to this. 2. **Compressed (legacy)** — the `<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. ### Decompress a legacy diagram (Python, stdlib only) ```python 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: