Agent skill

Drawio Skill

by ninehills in ninehills/skills

A skill your agent uses when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures…

MITAuto-check passedDevelopment

Install Drawio Skill

skills CLI
$ npx skills add ninehills/skills --skill drawio-skill -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ninehills/skills drawio-skill --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ninehills/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/drawio-skill .claude/skills/drawio-skill && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
drawio-skill
GitHub stars
280
Token cost
~9.1k tokens
SKILL.md length
3,880 words
Files
27 (incl. scripts, references)
Skills in repo
38
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures…

  • Works in 3 steps: Self-Check → Review Loop → Final Export
  • The user requests diagrams
  • SKILL.md covers Overview, When to use / when NOT to use, Bundled resources and Prerequisites, plus 6 more sections
  • Runs Python scripts from its folder; calls python3, brew and git; reaches github.com and viewer.diagrams.net

What it does

Drawio Skill is an agent skill from ninehills/skills. Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports…

Its SKILL.md is about 9.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 29 other files, including scripts and reference files (for example `data/SHAPE-INDEX-NOTICE.md`, `data/lobe-icons.json` and `references/autolayout.md`). Compatibility notes: Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped…

It sits in Development, covering Diagrams. It works with draw.io. The licence is MIT.

When your agent uses it

  • The user requests diagrams
  • Architecture diagrams
  • UML / sequence / class diagrams
  • Network topology

Example prompts

  • “/drawio-skill”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable. Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot).

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Self-Check
  2. Review Loop
  3. Final Export

What it can do on your machine

Read from SKILL.md and the folder at commit f3e82a7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 8 files in scripts/ (Python, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • brew
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com
    • viewer.diagrams.net

    Also links to:

    • hub.docker.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable. Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot).

    From compatibility in the SKILL.md frontmatter.

Context cost

Drawio Skill loads about 9.1k tokens when it runs, and up to ~23k if it reads all its reference files. Until then it costs about 143 tokens; SKILL.md has 3,880 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~143
When it runs · the whole SKILL.md, loaded when a task matches
~9.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~23k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from ninehills/skills at commit f3e82a7, republished under its MIT licence (© ninehills). 3,880 words, ~9,105 tokens.

Download SKILL.mdSave it as .claude/skills/drawio-skill/SKILL.md (or your agent's skills folder). This skill also uses 26 other files; get the full folder from GitHub.
name
drawio-skill
description
Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports locally via the native draw.io desktop CLI.
compatibility
Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable. Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot).
version
1.14.0
license
MIT
homepage
https://github.com/Agents365-ai/drawio-skill
platforms
macos, linux, windows
metadata.author
Agents365-ai
metadata.version
1.14.0

Draw.io Diagrams

Overview

Generate .drawio XML files and export to PNG/SVG/PDF/JPG locally using the native draw.io desktop app CLI.

Supported formats: PNG, SVG, PDF, JPG — no browser automation needed.

PNG, SVG, and PDF exports support --embed-diagram (-e) — the exported file contains the full diagram XML, so opening it in draw.io recovers the editable diagram. Use double extensions (name.drawio.png) to signal embedded XML.

When to use / when NOT to use

Use this skill for: polished, precise diagrams (architecture, network, strict UML, ERD), anything needing solid opaque fills, 10,000+ stock/branded shapes, swimlanes, or custom geometry, exported as editable PNG/SVG/PDF.

Do NOT use it — route elsewhere — for:

  • A casual hand-drawn / whiteboard look → excalidraw or tldraw.
  • Diagrams-as-code that live in git / render in Markdown → mermaid (general) or plantuml (UML).
  • Freeform infinite-canvas sketching or freehand strokes → tldraw.

Bundled resources

When the workflow references one of these, read it on demand — none of them need to be in context up front.

FileRead it when
references/diagram-types.mdThe user names a specific diagram type (ERD, UML class, sequence, architecture, ML/DL, flowchart)
references/shapes.md + scripts/shapesearch.pyThe diagram needs a specific shape — a cloud icon (AWS/Azure/GCP), Cisco/Kubernetes/network symbol, UML/BPMN/ER/electrical/P&ID element — or any time you'd otherwise guess a style= string. shapesearch.py "<keywords>" returns the exact official style for 10k+ shapes
scripts/aiicons.pyThe diagram involves an AI/LLM brand (OpenAI, Claude, Gemini, Mistral, Llama, HuggingFace, Ollama, LangChain, …) — aiicons.py "<brand>" returns a draw.io image style for the brand logo (lobe-icons via CDN; --embed to inline). draw.io has no built-in AI logos. See references/shapes.md → "AI / LLM brand logos"
references/style-presets.mdThe user asks to learn / save / list / set-default / delete a style preset, or you've resolved an active preset and need the application rules
references/style-extraction.mdYou're inside the Learn flow and need the extraction procedure (called from style-presets.md)
references/troubleshooting.mdAn export fails, vision rejects a PNG, or a rendering looks wrong
scripts/repair_png.pyAfter every -e PNG export — fixes draw.io's truncated IEND chunk (issue #8)
scripts/encode_drawio_url.pyThe CLI is unavailable and you need a browser-fallback diagrams.net URL (--edit for an editable editor URL)
references/autolayout.mdThe diagram is large or layout-heavy (dependency/call graph, code structure, >~15 nodes) and you want Graphviz to place nodes + route edges instead of hand-placing coordinates
scripts/pyimports.py · jsimports.py · goimports.py · rustimports.pyThe user wants to visualize a Python, JS/TS, Go, or Rust project structure — extracts the import graph (transitive-reduced, optional --group containers, nested by sub-package) for autolayout
scripts/pyclasses.pyThe user wants a Python class hierarchy / class diagram — extracts classes + inheritance edges (boxed by module with --group) for autolayout
scripts/validate.pyYou generated a .drawio (especially via autolayout or for a large hand-placed diagram) and want a fast deterministic structural lint (dangling edges, dup/reserved ids, broken parents, overlaps) before the vision self-check

Prerequisites

The draw.io desktop app must be installed and the CLI accessible:

macOS sandbox / sandbox isolation note (e.g., codex.app): In some sandboxed macOS environments, invoking the draw.io desktop CLI (even drawio --version) can crash the draw.io process or produce no output. If that happens, treat the CLI as unavailable in this sandbox isolation — do not keep retrying inside the sandbox. Prefer a non-sandboxed host environment (outside sandbox isolation) for any CLI export work, or use the browser fallback / XML-only outputs.

bash
# macOS (Homebrew — recommended; CLI binary is `drawio`, not `draw.io`)
brew install --cask drawio
drawio --version

# macOS (full path if not in PATH)
/Applications/draw.io.app/Contents/MacOS/draw.io --version

# Windows
"C:\Program Files\draw.io\draw.io.exe" --version

# Linux
drawio --version

Install draw.io desktop if missing:

Workflow

Before starting the workflow, assess whether the user's request is specific enough. If key details are missing, ask 1-3 focused questions:

  • Diagram type — which preset? (ERD, UML, Sequence, Architecture, ML/DL, Flowchart, or general)
  • Output format — PNG (default), SVG, PDF, or JPG?
  • Output location — default is the user's working dir; honor any explicit path the user gives (e.g. "put it in ./artifacts/"). Don't ask if they didn't mention one.
  • Scope/fidelity — how many components? Any specific technologies or labels?

Skip clarification if the request already specifies these details or is clearly simple (e.g., "draw a flowchart of X").

Step 0 — Resolve active preset. Determine which (if any) user-defined style preset applies to this generation.

  • Scan the user's message for a phrase that clearly names a style preset: "use my <name> style", "with my <name> style", "in <name> mode", "in the style of <name>". A bare with <name> does not count — "draw a diagram with redis" names a component, not a style. If a clear match is found → active preset = <name>.
  • Else, check ~/.drawio-skill/styles/ for any file with "default": true. If found → active preset = that one.
  • Else → no preset active; fall through to the built-in color/shape/edge conventions for the rest of the workflow.

Load the preset JSON from ~/.drawio-skill/styles/<name>.json, falling back to <this-skill-dir>/styles/built-in/<name>.json. If the named preset exists in neither location, tell the user the name is unknown, list the available presets (user dir + built-in), and stop — do not silently fall back to defaults.

When a preset loads successfully, mention it in the first line of the reply: "Using preset <name> (confidence: <level>)." See the Applying a preset subsection below for how the preset changes color/shape/edge/font decisions.

  1. Check deps — resolve which name the binary has on this system and use that name verbatim in every subsequent command in this workflow. Try in order: (a) drawio --version (the canonical name for Homebrew cask, jgraph .deb/.rpm, Arch AUR), (b) draw.io --version (older builds, some custom symlinks, some distro packages), (c) macOS .app direct: /Applications/draw.io.app/Contents/MacOS/draw.io --version, (d) Windows: "C:\Program Files\draw.io\draw.io.exe" --version. The first one that prints a version is your binary; remember the exact path/name and substitute it for drawio in every export command below. Do not copy the example commands verbatim if your binary is named differently — the examples use drawio only because it's the most common. On macOS-Homebrew, drawio is just a thin wrapper script that execs /Applications/draw.io.app/Contents/MacOS/draw.io — they run the same engine, so candidate (c) is only needed when the drawio wrapper is absent (e.g. the app was installed by drag-and-drop without the cask).
  2. Plan — identify shapes, relationships, layout (LR or TB), group by tier/layer
  3. Generate — write .drawio XML file to disk. Hand-place coordinates for small/styled diagrams. For large or layout-heavy diagrams (dependency/call graphs, code structure, >~15 nodes), don't hand-place — describe the graph as JSON and run python3 <this-skill-dir>/scripts/autolayout.py graph.json -o <name>.drawio to compute node positions + orthogonal edge routing via Graphviz (see references/autolayout.md). For a Python / JS-TS / Go / Rust project, the matching importer (scripts/pyimports.py, jsimports.py, goimports.py, or rustimports.py) extracts the import graph (transitive-reduced; add --group to box modules by sub-package, nested for deep trees) ready for autolayout; for a Python class hierarchy, scripts/pyclasses.py extracts classes + inheritance instead. After generating any .drawio, run python3 <this-skill-dir>/scripts/validate.py <name>.drawio for a fast structural lint (dangling edges, dup ids, overlaps) before exporting. Default output dir is the user's working dir; if the user specified an output path or directory (e.g. ./artifacts/, docs/images/), use that instead — mkdir -p the target dir first. Apply the same dir choice to PNG/SVG/PDF exports in steps 4 and 7.
  4. Export draft — run CLI to produce a preview PNG. Do NOT pass -e at this step — the embedded zTXt mxGraphModel chunk it adds causes vision APIs (Claude included) to return 400 "Could not process image" in step 5. Cap the preview width with --width 2000 (not -s 2) — Claude's vision API rejects images larger than 2576×2576px with "Unable to resize image — dimensions exceed the 2576x2576px limit", and -s 2 on a medium-or-larger diagram easily overshoots that ceiling. Save the clean preview as <name>.png (single extension). Embedding and full-resolution scale are for the final export only (step 7).
  5. Self-check — use the agent's built-in vision capability to read the exported PNG, catch obvious issues, auto-fix before showing user (requires a vision-enabled model such as Claude Sonnet/Opus). If reading the PNG returns a 400 / "Could not process image" error, you almost certainly exported with -e by mistake — re-export without -e and retry once. If it still fails, skip self-check and continue to step 6.
  6. Review loop — show image to user, collect feedback, apply targeted XML edits, re-export, repeat until approved
  7. Final export — re-export the approved version to all requested formats. Use -e here (PNG/SVG/PDF) so the deliverable stays editable in draw.io; save as <name>.drawio.png to signal embedded XML. For PNG with -e, run python3 <this-skill-dir>/scripts/repair_png.py <name>.drawio.png immediately after — draw.io's CLI truncates the IEND chunk in -e PNG output (8 bytes missing), producing a corrupt file that vision APIs and strict PNG decoders reject (issue #8). Report file paths.

If drawio --version crashes or prints nothing (common in restricted macOS sandbox isolation like codex.app):

  • Do not keep retrying CLI invocations inside the sandbox.
  • Skip steps 4, 5, 6, and 7 (CLI export + PNG-based review) and use Browser fallback (scripts/encode_drawio_url.py) or deliver the .drawio XML only.
  • If the user needs PNG/SVG/PDF outputs, ask them to run the export commands in a non-sandboxed host environment (outside sandbox isolation) and share the resulting files.

Escalation rule:

  • If the binary exists on PATH (or known app path exists) but execution fails with abnormal exit, empty output, Electron startup failure, display/session error, or likely sandbox restriction, prefer one escalated retry before falling back.
  • If the binary is missing entirely, do not escalate just to search more aggressively; go to install guidance or fallback.
Step 5: Self-Check

After exporting the draft PNG, use the agent's vision capability (e.g., Claude's image input) to read the image and check for these issues before showing the user. If the agent does not support vision, skip self-check and show the PNG directly.

Important: the draft PNG read here must have been exported without -e. Draw.io's -e flag emits a PNG with a truncated IEND chunk (8 bytes of type+CRC missing) that the Anthropic vision API rejects with 400 "Could not process image" (issue #8). The simplest fix for the preview step is to skip -e entirely; the final export in step 7 keeps -e and runs the repair snippet. If you see the 400 error here, re-export without -e and retry once; if it still fails (any other reason), skip self-check and proceed to step 6.

CheckWhat to look forAuto-fix action
Overlapping shapesTwo or more shapes stacked on top of each otherShift shapes apart by ≥200px
Clipped labelsText cut off at shape boundariesIncrease shape width/height to fit label
Missing connectionsArrows that don't visually connect to shapesVerify source/target ids match existing cells
Off-canvas shapesShapes at negative coordinates or far from the main groupMove to positive coordinates near the cluster
Edge-shape overlapAn edge/arrow visually crosses through an unrelated shapeAdd waypoints (<Array as="points">) to route around the shape, or increase spacing between shapes
Stacked edgesMultiple edges overlap each other on the same pathDistribute entry/exit points across the shape perimeter (use different exitX/entryX values)
  • Max 2 self-check rounds — if issues remain after 2 fixes, show the user anyway
  • Re-export after each fix and re-read the new PNG
Step 6: Review Loop

After self-check, show the exported image and ask the user for feedback.

Targeted edit rules — for each type of feedback, apply the minimal XML change:

User requestXML edit action
Change color of XFind mxCell by value matching X, update fillColor/strokeColor in style
Add a new nodeAppend a new mxCell vertex with next available id, position near related nodes
Remove a nodeDelete the mxCell vertex and any edges with matching source/target
Move shape XUpdate x/y in the mxGeometry of the matching mxCell
Resize shape XUpdate width/height in the mxGeometry of the matching mxCell
Add arrow from A to BAppend a new mxCell edge with source/target matching A and B ids
Change label textUpdate the value attribute of the matching mxCell
Change layout directionFull regeneration — rebuild XML with new orientation

Rules:

  • For single-element changes: edit existing XML in place — preserves layout tuning from prior iterations
  • For layout-wide changes (e.g., swap LR↔TB, "start over"): regenerate full XML
  • Overwrite the same {name}.png (no -e) each iteration — do not create v1, v2, v3 files. -e is reserved for the final export in step 7.
  • After applying edits, re-export and show the updated image
  • Loop continues until user says approved / done / LGTM
  • Safety valve: after 5 iteration rounds, suggest the user open the .drawio file in draw.io desktop for fine-grained adjustments
Step 7: Final Export

Once the user approves:

  • Export to all requested formats (PNG, SVG, PDF, JPG) — default to PNG if not specified
  • Report file paths for both the .drawio source file and exported image(s)
  • Auto-launch: offer to open the .drawio file in draw.io desktop for fine-tuning — open diagram.drawio (macOS), xdg-open (Linux), start (Windows)
  • Confirm files are saved and ready to use

Style Presets

A style preset is a named JSON file capturing a user's visual preferences (palette, shapes, font, edges). When active, it fully replaces the built-in color/shape conventions in this skill.

Lookup order when SKILL.md's Step 0 resolves a preset name:

  1. ~/.drawio-skill/styles/<name>.json — user presets (survive git pull)
  2. <this-skill-dir>/styles/built-in/<name>.json — shipped built-ins (default, corporate, handdrawn)

Always lowercase the user-provided name before any file operation — the schema enforces lowercase.

For everything else — Learn flow (extracting a preset from a file), management ops (list/default/delete/rename), application rules (color lookup, shape keywords, edges, fonts, extras, interaction with diagram-type presets), and validation — read references/style-presets.md. It's only needed when the user invokes those flows or when an active preset must be applied to the current generation.

Draw.io XML Structure

File skeleton
xml
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="drawio" version="26.0.0">
  <diagram name="Page-1">
    <mxGraphModel>
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <!-- user shapes start at id="2" -->
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

Rules:

  • id="0" and id="1" are required root cells — never omit them
  • User shapes start at id="2" and increment sequentially
  • All shapes have parent="1" (unless inside a container — then use container's id)
  • All text uses html=1 in style for proper rendering
  • Never use -- inside XML comments — it's illegal per XML spec and causes parse errors
  • Escape special characters in attribute values: &amp;, &lt;, &gt;, &quot;
  • Multi-line text in labels: use &#xa; for line breaks inside value attributes (not literal \n). Example: value="Line 1&#xa;Line 2"
Show full SKILL.md (1,575 more words)Show less
Shape types (vertex)
Style keywordUse for
rounded=0plain rectangle (default)
rounded=1rounded rectangle — services, modules
ellipse;circles/ovals — start/end, databases
rhombus;diamond — decision points
shape=mxgraph.aws4.resourceIcon;AWS icons
shape=cylinder3;cylinder — databases
swimlane;group/container with title bar

For vendor/branded icons (AWS/Azure/GCP/Cisco/Kubernetes) and any non-trivial shape, don't guess the shape=mxgraph.* name — a wrong name renders as a blank box. Run python3 <this-skill-dir>/scripts/shapesearch.py "<keywords>" to get the exact official style + size, or see references/shapes.md for the hand-writable cheatsheet. For AI/LLM brand logos (OpenAI, Claude, Gemini, …), which draw.io has none of, use python3 <this-skill-dir>/scripts/aiicons.py "<brand>".

Required properties
xml
<!-- Rectangle / rounded box -->
<mxCell id="2" value="Label" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
  <mxGeometry x="100" y="100" width="160" height="60" as="geometry" />
</mxCell>

<!-- Cylinder (database) -->
<mxCell id="3" value="DB" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" vertex="1" parent="1">
  <mxGeometry x="350" y="100" width="120" height="80" as="geometry" />
</mxCell>

<!-- Diamond (decision) -->
<mxCell id="4" value="Check?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
  <mxGeometry x="100" y="220" width="160" height="80" as="geometry" />
</mxCell>
Containers and groups

For architecture diagrams with nested elements, use draw.io's parent-child containment — do not just place shapes on top of larger shapes.

TypeStyleWhen to use
Group (invisible)group;pointerEvents=0;No visual border needed, container has no connections
Swimlane (titled)swimlane;startSize=30;Container needs a visible title bar, or container itself has connections
Custom containerAdd container=1;pointerEvents=0; to any shapeAny shape acting as a container without its own connections

Key rules:

  • Add pointerEvents=0; to container styles that should not capture connections between children
  • Children set parent="containerId" and use coordinates relative to the container
xml
<!-- Swimlane container -->
<mxCell id="svc1" value="User Service" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
  <mxGeometry x="100" y="100" width="300" height="200" as="geometry"/>
</mxCell>
<!-- Child inside container — coordinates relative to parent -->
<mxCell id="api1" value="REST API" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">
  <mxGeometry x="20" y="40" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="db1" value="Database" style="shape=cylinder3;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">
  <mxGeometry x="160" y="40" width="120" height="60" as="geometry"/>
</mxCell>
Connector (edge)

CRITICAL: Every edge mxCell must contain a <mxGeometry relative="1" as="geometry" /> child element. Self-closing edge cells (<mxCell ... edge="1" ... />) are invalid and will not render. Always use the expanded form.

xml
<!-- Directed arrow — always include rounded, orthogonalLoop, jettySize for clean routing -->
<mxCell id="10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="2" target="3">
  <mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- Arrow with label + explicit entry/exit points to control direction -->
<mxCell id="11" value="HTTP/REST" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="4">
  <mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- Arrow with waypoints — use when edge must route around other shapes -->
<mxCell id="12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3" target="5">
  <mxGeometry relative="1" as="geometry">
    <Array as="points">
      <mxPoint x="500" y="50" />
    </Array>
  </mxGeometry>
</mxCell>

Edge style rules:

  • Animated connectors: add flowAnimation=1; to any edge style to show a moving dot animation along the arrow. Works in SVG export and draw.io desktop — ideal for data-flow and pipeline diagrams. Example: style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;..."
  • Always include rounded=1;orthogonalLoop=1;jettySize=auto — these enable smart routing that avoids overlaps
  • Pin exitX/exitY/entryX/entryY on every edge when a node has 2+ connections — distributes lines across the shape perimeter
  • Add <Array as="points"> waypoints when an edge must detour around an intermediate shape
  • Leave room for arrowheads: the final straight segment between the last bend and the target shape must be ≥20px long. If too short, the arrowhead overlaps the bend and looks broken. Fix by increasing node spacing or adding explicit waypoints
Distributing connections on a shape

When multiple edges connect to the same shape, assign different entry/exit points to prevent stacking:

PositionexitX/entryXexitY/entryYUse when
Top center0.50connecting to node above
Top-left0.2502nd connection from top
Top-right0.7503rd connection from top
Right center10.5connecting to node on right
Bottom center0.51connecting to node below
Left center00.5connecting to node on left

Rule: if a shape has N connections on one side, space them evenly (e.g., 3 connections on bottom → exitX = 0.25, 0.5, 0.75)

Color palette (fillColor / strokeColor)

Used only when no preset is active (see "Applying a preset" above).

Color namefillColorstrokeColorUse for
Blue#dae8fc#6c8ebfservices, clients
Green#d5e8d4#82b366success, databases
Yellow#fff2cc#d6b656queues, decisions
Orange#ffe6cc#d79b00gateways, APIs
Red/Pink#f8cecc#b85450errors, alerts
Grey#f5f5f5#666666external/neutral
Purple#e1d5e7#9673a6security, auth
Layout tips

Spacing — scale with complexity:

Diagram complexityNodesHorizontal gapVertical gap
Simple≤5200px150px
Medium6–10280px200px
Complex>10350px250px

Routing corridors: between shape rows/columns, leave an extra ~80px empty corridor where edges can route without crossing shapes. Never place a shape in a gap that edges need to traverse.

Grid alignment: snap all x, y, width, height values to multiples of 10 — this ensures shapes align cleanly on draw.io's default grid and makes manual editing easier.

General rules:

  • Plan a grid before assigning x/y coordinates — sketch node positions on paper/mentally first
  • Group related nodes in the same horizontal or vertical band
  • Use swimlane cells for logical grouping with visible borders
  • Place heavily-connected "hub" nodes centrally so edges radiate outward instead of crossing
  • To force straight vertical connections, pin entry/exit points explicitly on edges: exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0
  • Always center-align a child node under its parent (same center x) to avoid diagonal routing
  • Event bus pattern: place Kafka/bus nodes in the center of the service row, not below — services on either side can reach it with short horizontal arrows (exitX=1 left side, exitX=0 right side), eliminating all line crossings
  • Horizontal connections (exitX=1 or exitX=0) never cross vertical nodes in the same row; use them for peer-to-peer and publish connections

Avoiding edge-shape overlap:

  • Before finalizing coordinates, trace each edge path mentally — if it must cross an unrelated shape, either move the shape or add waypoints
  • For tree/hierarchical layouts: assign nodes to layers (rows), connect only between adjacent layers to minimize crossings
  • For star/hub layouts: place the hub center, satellites around it — edges stay short and radial
  • When an edge must span multiple rows/columns, route it along the outer corridor, not through the middle of the diagram

Export

Commands

There are two export modes:

  • Preview / self-check (step 4 of the workflow) — no -e. Output diagram.png. Required for vision self-check; using -e here triggers a 400 "Could not process image" error from the vision API (issue #8).
  • Final / deliverable (step 7) — pass -e. Output diagram.drawio.png. The embedded XML keeps the file editable in draw.io.

All commands below write drawio as a placeholder for the binary you resolved in Step 1. If your binary is on PATH as draw.io (with dot — some older or distro-packaged installs), substitute draw.io throughout. If only the macOS .app or Windows .exe is available, use the full path variant shown a few lines down.

bash
# Preview PNG (use this in step 4, before self-check) — NO -e, width-capped to stay under vision's 2576px ceiling
drawio -x -f png --width 2000 -o diagram.png input.drawio

# Final PNG (step 7, after user approval) — WITH -e, double extension
drawio -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# macOS — full path (if not in PATH); preview / final variants
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png --width 2000 -o diagram.png input.drawio
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# Windows
"C:\Program Files\draw.io\draw.io.exe" -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# Linux (headless — requires xvfb-run; on servers add HOME and --disable-gpu)
export HOME=${HOME:-/tmp}
xvfb-run -a --server-args="-screen 0 1280x1024x24" \
  drawio -x -f png -e -s 2 -o diagram.drawio.png input.drawio --disable-gpu
# Running as root (CI / Docker)? Append --no-sandbox AT THE END (placing it earlier makes drawio treat it as the input filename)

# SVG export (final — -e is safe; SVG is text)
drawio -x -f svg -e -o diagram.svg input.drawio

# PDF export (final)
drawio -x -f pdf -e -o diagram.pdf input.drawio

# Custom output directory (e.g. CI artifacts dir) — create if missing, then export there
mkdir -p ./artifacts && drawio -x -f png -e -s 2 -o ./artifacts/diagram.drawio.png input.drawio
Post-export PNG repair (required after -e PNG export)

draw.io CLI truncates the IEND chunk when emitting -e PNGs — the file ends with the 4-byte IEND length field but the IEND type + CRC (8 bytes) are missing. Result: vision APIs return 400 "Could not process image" and strict PNG decoders error out. SVG/PDF are unaffected.

Run this immediately after every -e PNG export:

bash
python3 <this-skill-dir>/scripts/repair_png.py diagram.drawio.png

The script's endswith(IEND) guard makes it a no-op once draw.io fixes the bug upstream — safe to run unconditionally.

Key flags:

  • -x — export mode (required)
  • -f — format: png, svg, pdf, jpg
  • -e — embed diagram XML in output (PNG, SVG, PDF) — exported file remains editable in draw.io. Skip for the preview PNG used in step 5 self-check — -e PNGs have a truncated IEND chunk that vision APIs reject (issue #8). For final PNG export, keep -e and run scripts/repair_png.py (see Post-export PNG repair). SVG/PDF unaffected.
  • -s — scale: 1, 2, 3 (2 recommended for final PNG; do NOT use for the step-4 preview — see --width)
  • --width <px> — target width in pixels (no short form; -w does not exist and silently breaks the input-file parser). Use --width 2000 for the step-4 preview to keep the PNG under Claude's 2576×2576 vision ceiling. There's also a --height <px> flag for tall-narrow diagrams. Don't combine --width with -s.
  • -o — output file path; accepts any directory (e.g. ./artifacts/diagram.drawio.png) — mkdir -p the target dir first. Use .drawio.png double extension when embedding.
  • -b — border width around diagram (default: 0, recommend 10)
  • -t — transparent background (PNG only)
  • --page-index 0 — export specific page (default: all)
Browser fallback (no CLI needed)

When the draw.io desktop CLI is unavailable, generate a client-side URL:

bash
python3 <this-skill-dir>/scripts/encode_drawio_url.py input.drawio          # read-only viewer
python3 <this-skill-dir>/scripts/encode_drawio_url.py --edit input.drawio    # opens in the editor

Default prints a https://viewer.diagrams.net/...#R… viewer URL; --edit prints a https://app.diagrams.net/...#create=… URL that opens straight into the editable editor. Either way the diagram XML is encodeURIComponent-encoded, deflate-compressed, and base64'd into the URL fragment — the fragment (after #) is never sent to the server, so nothing is uploaded. The encodeURIComponent step is mandatory: without it, any diagram containing a literal % or non-ASCII (e.g. CJK) label makes the browser throw "URI malformed" and the diagram never opens.

Open the URL with open "$URL" (macOS) / xdg-open "$URL" (Linux). On WSL2 / Windows, cmd.exe drops the #fragment — write a .url shortcut file and open that instead (see references/troubleshooting.md → "WSL2 / Windows specifics").

Fallback chain

When tools are unavailable, degrade gracefully:

ScenarioBehavior
draw.io CLI missing, Python availableUse browser fallback (diagrams.net URL)
draw.io CLI missing, Python missingGenerate .drawio XML only; instruct user to open in draw.io desktop or diagrams.net manually
draw.io CLI crashes / no output in macOS sandbox isolationTreat CLI as unavailable in-sandbox; use browser fallback / XML-only; ask user to run CLI exports in a non-sandboxed host environment
Vision unavailable for self-checkSkip self-check (step 5); proceed directly to showing user the exported PNG
Export fails (Chromium/display issues)On Linux, retry with xvfb-run -a; if still failing, deliver .drawio XML and suggest manual export
Export fails on Linux server (headless)Try in order: (1) xvfb-run -a, (2) append --no-sandbox at the very end if root, (3) add --disable-gpu, (4) export HOME=/tmp, (5) install apt deps (libgtk-3-0 libnotify4 libnss3 libgbm1 libasound2t64 etc.), (6) fall back to tomkludy/drawio-renderer Docker (REST API for headless export)
Checking if drawio is in PATH
bash
# Prefer the Homebrew / Linux-package binary name (no dot)
if command -v drawio &>/dev/null; then
  DRAWIO="drawio"
# Fall back to the dot-named binary (older installs, manual symlinks)
elif command -v draw.io &>/dev/null; then
  DRAWIO="draw.io"
# macOS .app bundle (binary inside the bundle keeps the dot)
elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then
  DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"
# WSL2: the CLI is the Windows desktop exe, reached via /mnt/c (note the space)
elif grep -qi microsoft /proc/version 2>/dev/null && [ -f "/mnt/c/Program Files/draw.io/draw.io.exe" ]; then
  DRAWIO="/mnt/c/Program Files/draw.io/draw.io.exe"
else
  echo "drawio not found — install from https://github.com/jgraph/drawio-desktop/releases (Homebrew: brew install --cask drawio)"
fi

On WSL2 / native Windows, opening exported files and browser-fallback URLs needs path conversion + a .url-file workaround (cmd.exe drops URL #fragments) — see the "WSL2 / Windows specifics" section in references/troubleshooting.md.

Common Mistakes

When something looks wrong (export fails, vision rejects a PNG, layout broken, edges misroute), see references/troubleshooting.md for a row-by-row mistake → fix table.

Diagram Type Presets

When the user requests a specific diagram type, read references/diagram-types.md for the matching preset (shapes, edges, layout direction). Pick by user phrasing:

User saysSection in references/diagram-types.md
"ER diagram", "schema diagram", "data model"ERD
"UML class diagram", "class diagram"UML Class
"sequence diagram", "interaction diagram", "lifeline"Sequence
"architecture", "system diagram", "service diagram"Architecture
"neural network", "model architecture", "ML diagram", "deep learning"ML / Deep Learning Model
"flowchart", "decision tree", "process flow"Flowchart

The diagram-type preset sets structural style keywords. If a user style preset is also active (see ## Style Presets), keep the structural keywords and layer color/font/edge/extras on top — read references/style-presets.md → "Interaction with diagram-type presets" for the merge rules.

© ninehills, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 26 other files (scripts, references) in drawio-skill of ninehills/skills.

  • SKILL.md
  • data/SHAPE-INDEX-NOTICE.md
  • data/lobe-icons.json
  • data/shape-index.json.gz
  • references/autolayout.md
  • references/diagram-types.md
  • references/shapes.md
  • references/style-extraction.md
  • references/style-presets.md
  • references/troubleshooting.md
  • scripts/aiicons.py
  • scripts/autolayout.py
  • scripts/encode_drawio_url.py
  • scripts/goimports.py
  • scripts/jsimports.py
  • scripts/pyclasses.py
  • scripts/pyimports.py
  • scripts/repair_png.py
  • … and 9 more

Open the folder on GitHubat commit f3e82a7

Compare with similar skills

Drawio Skill next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Drawio Skill compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Drawio Skill this skillninehills/skills280—~9.1kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design48k1 repos~7.6kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT
Draw.io Diagram ReconstructionHKUSTDial/Supervisor-Skills8.8k—~5.4kAutomated safety check: PassMIT
Scibox Diagramjihe520/sci-box2491 repos~983Automated safety check: NotesNone
Drawio Diagram BuilderWill-hxw/drawio-diagram-builder413—~5.9kAutomated safety check: PassMIT

Similar skills

  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    48k GitHub starsUsed in 1 repo~7.6k tokens
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated 8 days ago
    DevelopmentAuto-check: notes
  • Draw.io Diagram Reconstruction

    HKUSTDial/Supervisor-Skills

    Rebuilds a reference diagram image as an editable, high-fidelity Draw.io file, mixing native elements, SVG icons and cropped PNGs, with a batch workflow for a folder of images.

    8.8k GitHub stars~5.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Scibox Diagram

    jihe520/sci-box

    制作与修改可编辑的 draw.io / diagrams.net 示意图(.drawio XML),产出 .drawio + PNG/PDF。三条路径:套用内置模板(五带技术路线图、三栏研究框架图、三栏阶段流程图、横版任务流水线图)、从零手写…

    249 GitHub starsUsed in 1 repo~983 tokens
    DevelopmentAuto-check: notes
  • Drawio Diagram Builder

    Will-hxw/drawio-diagram-builder

    Create, edit, replicate, and iteratively refine editable research and technical diagrams in diagrams.net/draw.io (.drawio XML) from prompts, papers, repositories, screenshots, or existing diagrams.

    413 GitHub stars~5.9k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Draw.io Diagram Generator

    github/awesome-copilot

    Official

    Generates, edits and validates draw.io files with correct mxGraph XML, covering flowcharts, architecture, sequence, ER and UML class diagrams.

    40k GitHub starsUsed in 1 repo~4.9k tokens
    DevelopmentAuto-check passed

More from ninehills/skills

All 38 skills in this repo
  • Alphaear Predictor

    ninehills/skills

    Market prediction skill using Kronos. An agent skill from ninehills/skills.

    280 GitHub starsUsed in 1 repo~531 tokens
    Auto-check passed
  • Alphaear Signal Tracker

    ninehills/skills

    Track finance investment signal evolution and update logic based on new finance market information.

    280 GitHub starsUsed in 1 repo~459 tokens
    Auto-check passed
  • Fireworks Tech Graph

    ninehills/skills

    A skill your agent uses when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent/memory, or concept map - and export as SVG+PNG.

    280 GitHub starsUsed in 2 repos~8k tokens
    Auto-check passed
  • Alphaear Sentiment

    ninehills/skills

    Analyze finance text sentiment using FinBERT or LLM. An agent skill from ninehills/skills.

    280 GitHub starsUsed in 1 repo~499 tokens
    Auto-check passed
  • Bggg Creator Image2ppt

    ninehills/skills

    把图片、截图、海报、PPT 页面截图、HTML 或 SVG 设计稿转换成可编辑 PPTX 的 Codex skill. An agent skill from ninehills/skills.

    280 GitHub starsUsed in 1 repo~1.2k tokens
    Auto-check passed
  • Bggg Creator Image2psd

    ninehills/skills

    把一张或多张图片整理成 PSD 图层文件的创作与转换 skill。当用户需要 image2psd、图片转 PSD、 多张图片拼成 PSD、海报/设计稿拆成多个图层、白底转透明、颜色聚类拆层、把 Codex/AI 生图结果拆成元素图再合成 PSD、 或希望输出 layered PSD、可在 Photoshop/Photopea 中编辑的分层栅格文件时,应该使用此 skill。

    280 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed

Works with

Categories

Questions about Drawio Skill

What does Drawio Skill do?

A skill your agent uses when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures…. Drawio Skill is an agent skill from ninehills/skills. Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization.

When should I use Drawio Skill?

Drawio Skill fits situations like: the user requests diagrams; architecture diagrams; UML / sequence / class diagrams; network topology.

How do I install Drawio Skill in Claude Code?

Run `npx skills add ninehills/skills --skill drawio-skill -a claude-code`. Or copy the skill folder (drawio-skill in ninehills/skills) into .claude/skills/drawio-skill in your project. Claude Code loads it when a task matches its description.

How do I install Drawio Skill in Codex?

Run `npx skills add ninehills/skills --skill drawio-skill -a codex`. Or copy the skill folder (drawio-skill in ninehills/skills) into .agents/skills/drawio-skill in your project. Codex loads it when a task matches its description.

Can I use Drawio Skill in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ninehills/skills --skill drawio-skill -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/drawio-skill, .gemini/skills/drawio-skill, .github/skills/drawio-skill and .opencode/skills/drawio-skill in your project.

What does Drawio Skill need to run?

Going by SKILL.md and its folder, Drawio Skill needs Python for the scripts in its folder and the command-line tools its instructions call (python3, brew and git). Our summary lists: Python 3. Compatibility (from SKILL.md): Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable. Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot)..

Does Drawio Skill access the network?

SKILL.md names 3 domains. In commands or code: github.com and viewer.diagrams.net; the agent is likely to contact these when it follows the instructions. As links in the text: hub.docker.com. This is read from the text; nothing was executed.

Is Drawio Skill safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Drawio Skill use?

Drawio Skill is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Drawio Skill use?

About 9.1k tokens (SKILL.md is roughly 36k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 14k tokens, read only when the agent opens those files.

What are the alternatives to Drawio Skill?

Skills that share tags, products or a category with Drawio Skill: Diagram Design (cathrynlavery/diagram-design, 48k stars), Draw.io Diagram Studio (Agents365-ai/drawio-skill, 10k stars), Draw.io Diagram Reconstruction (HKUSTDial/Supervisor-Skills, 8.8k stars) and Scibox Diagram (jihe520/sci-box, 249 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Drawio Skill?

ninehills (a GitHub user) maintains it in ninehills/skills, which has 280 GitHub stars. The repository holds 38 skills in this directory. The repository was last updated on June 22, 2026.

Source: ninehills/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.