drawio-skill
Skill1 starsChanged 5 months agoMITView on GitHub
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.
- Installs packages
22 other projects use a version of this, 13 of them edited.
Adopted by
Most recently taken up by
- NiKhilForCybersec/LLD-Agentedited, first seen Nov 22, 2026
- jangrui/skillstheir own version, first seen Nov 22, 2026
- bingwu-devkit/skillstheir own version, first seen Nov 22, 2026
- unravel11/research-paper-skillsedited, first seen Nov 16, 2026
- jgeofil/agent-skillstheir own version, first seen Nov 8, 2026
- cadecode/agent-skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use ip-as-logo, archify and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
KartikLabhshetwarSkillip-as-logo
Generate extremely simple, cute, personified square character images with rounded heavy forms, two purposeful character colors, one solid background color, and a dominant lower-corner composition. Use when creating an animal, creature, robot, ghost, plant, object, or other character image, including when the agent should infer three product-relevant directions and propose six independent candidates for approval.
Also in 3 projects that use this
HK-hubSkillarchify
Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, semantic navigation, optional trace motion, an optional 1200×630 Share Card PNG, and PNG/JPEG/WebP/SVG/WebM export. Accept plain-language requirements or pasted Mermaid flowchart, sequenceDiagram, and stateDiagram input; inspect repository evidence when the diagram must reflect real code. Use when the user asks to visualize system architecture, infrastructure, cloud/security/network topology, technical workflows, approval or CI/CD flows, API call sequences, request lifecycles, data pipelines, ETL/ELT, data lineage, state machines, or to convert/beautify Mermaid. Prefer typed JSON IR renderers and deterministic validation; deliver static output by default, enable motion only when requested, and use optional post-commit opening only for an interactive local handoff.
Also in 4 projects that use this
VercelSkillfind-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Also in 3 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
Other versions22 projects use a version of this.
Word for word · 0
None found.
Edited · 13
- ninehills/skills★ 28072% same
- jorgeasaurus/agent-skills★ 1490% same
- HK-hub/AgentSkills★ 627% same
- tuoxie2046/claude-code-research-skills★ 572% same
- betterlmy/agent-skills★ 313% same
- airclear/skills★ 262% same
- bushuhui/skills★ 262% same
- xtiqny/SKILLS★ 227% same
- manastalukdar/ai-devstudio★ 131% same
- zhouycheng/skills★ 127% same
3 more not listed
Wrote their own version · 9
- Agents365-ai/drawio-skill★ 11ksame name
- tam159/next-role★ 67same name
- bingwu-devkit/skills★ 4same name
- BINGWU2003/skills★ 4same name
- DaeSeokSong/oh-my-ouroboros★ 2same name
- Big-LAORE/Biblioth-que-de-skills★ 1same name
- cadecode/agent-skills★ 1same name
- jangrui/skills★ 1same name
- jgeofil/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository146 other files it gives its agents.
- AGENTS.mdAGENTS.md
- humanizer/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- academy-guideSkill
- agent-browserSkill
- agent-evalSkill
- agent-introspection-debuggingSkill
- agent-reachSkill
- algorithmic-artSkill
- api-and-interface-designSkill
- ask-mattSkill
- audit-context-buildingSkill
- autoresearchSkill
- backend-patternsSkill
- brainstormingSkill
- brand-guidelinesSkill
- brandkitSkill
- browser-testing-with-devtoolsSkill
- industrial-brutalist-uiSkill
- canvas-designSkill
- capability-evolverSkill
- ci-cd-and-automationSkill
- cinematic-filmSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- context-budgetSkill
- context-engineeringSkill
- continuous-learningSkill
- coross-platform-vim-nvim-deploySkill
- councilSkill
- cpp-testingSkill
- csharp-testingSkill
- debugging-and-error-recoverySkill
- deep-researchSkill
- deployment-patternsSkill
- deprecation-and-migrationSkill
- diagram-designSkill
- dispatching-parallel-agentsSkill
- distillySkill
- django-securitySkill
- django-tddSkill
- dmux-workflowsSkill
- doc-coauthoringSkill
- documentation-and-adrsSkill
- docxSkill
- domain-modelingSkill
- doubt-driven-developmentSkill
- ecc-harnessSkill
- entry-point-analyzerSkill
- executing-plansSkill
- figgenie-paper-diagramSkill
- finishing-a-development-branchSkill
- frontend-designSkill
- frontend-ui-engineeringSkill
- fsharp-testingSkill
- git-workflow-and-versioningSkill
- golang-testingSkill
- gpt-tasteSkill
- graphifySkill
- hallmarkSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
33 rules. 0 are common, 17 are distinctive, and 16 are very specific to this project.
0
Common
Most of the 21 edited versions we read keep these.
17
Distinctive
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
When the workflow references one of these, read it on demand — none of them need to be in context up front.
- Distinctive: line 63
Before starting the workflow, assess whether the user's request is specific enough.
- Very specific: line 79
When a preset loads successfully, mention it in the first line of the reply: *"Using preset <name> (confidence: <level>)."* See the …
- Distinctive: line 90
Do not keep retrying CLI invocations inside the sandbox.
- Very specific: line 92
If the user needs PNG/SVG/PDF outputs, ask them to run the export commands in a non-sandboxed host environment (outside sandbox isolation) …
- Distinctive: line 95
If the binary exists on PATH (or known app path exists) but execution fails with abnormal exit, empty output, Electron startup failure, …
- Distinctive: line 96
If the binary is missing entirely, do not escalate just to search more aggressively.
- Distinctive: line 100
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 …
- Distinctive: line 118
After self-check, show the exported image and ask the user for feedback.
- Distinctive: line 137
After applying edits, re-export and show the updated image
- Very specific: line 139
Safety valve: after 5 iteration rounds, suggest the user open the .drawio file in draw.io desktop for fine-grained adjustments
- Very specific: line 153
Lookup order: when SKILL.md's step 0.5 resolves a preset name:
- Distinctive: line 157
Always lowercase the user-provided name before any file operation — the schema enforces lowercase.
- Very specific: line 183
All shapes have parent="1" (unless inside a container — then use container's id)
- Very specific: line 184
All text uses html=1 in style for proper rendering
- Very specific: line 187
Multi-line text in labels: use 
 for line breaks inside value attributes (not literal \n).
- Very specific: line 231
Add pointerEvents=0; to container styles that should not capture connections between children
- Very specific: line 250
CRITICAL: Every edge mxCell must contain a <mxGeometry relative="1" as="geometry" /> child element.
- Very specific: line 274
Animated connectors: add flowAnimation=1; to any edge style to show a moving dot animation along the arrow.
- Very specific: line 277
Add <Array as="points"> waypoints when an edge must detour around an intermediate shape
- Distinctive: line 282
When multiple edges connect to the same shape, assign different entry/exit points to prevent stacking:
- Distinctive: line 293
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)
- Very specific: line 326
Use swimlane cells for logical grouping with visible borders
- Distinctive: line 327
Place heavily-connected "hub" nodes centrally so edges radiate outward instead of crossing
- Distinctive: line 330
Always center-align a child node under its parent (same center x) to avoid diagonal routing
- Very specific: line 331
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 …
- Distinctive: line 335
Before finalizing coordinates, trace each edge path mentally — if it must cross an unrelated shape, either move the shape or add waypoints
- Distinctive: line 338
When an edge must span multiple rows/columns, route it along the outer corridor, not through the middle of the diagram
- Very specific: line 383
Run this immediately after every -e PNG export:
- Distinctive: line 403
When the draw.io desktop CLI is unavailable, generate a client-side viewer URL:
- Distinctive: line 413
When tools are unavailable, degrade gracefully:
- Very specific: line 439
When something looks wrong (export fails, vision rejects a PNG, layout broken, edges misroute), see references/troubleshooting.md for a …
- Very specific: line 443
When the user requests a specific diagram type, read references/diagram-types.md for the matching preset (shapes, edges, layout direction).
“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.
Bundled resources
When the workflow references one of these, read it on demand — none of them need to be in context up front.
| File | Read it when |
references/diagram-types.md | The user names a specific diagram type (ERD, UML class, sequence, architecture, ML/DL, flowchart) |
references/style-presets.md | The 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.md | You're inside the Learn flow and need the extraction procedure (called from style-presets.md) |
references/troubleshooting.md | An export fails, vision rejects a PNG, or a rendering looks wrong |
scripts/repair_png.py | After every -e PNG export — fixes draw.io's truncated IEND chunk (issue #8) |
scripts/encode_drawio_url.py | The CLI is unavailable and you need a browser-fallback diagrams.net URL |
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 draw.io --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.
# 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
draw.io --versionInstall draw.io desktop if missing:
- macOS:
brew install --cask drawioor download from https://github.com/jgraph/drawio-desktop/releases - Windows: download installer from https://github.com/jgraph/drawio-desktop/releases
- Linux: download
.deb/.rpmfrom https://github.com/jgraph/drawio-desktop/releases — do not use snap (AppArmor sandbox denies secrets/keyring on servers, causes crash)
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 barewith <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.
- Check deps — verify
draw.io --versionsucceeds; note platform for correct CLI path - Plan — identify shapes, relationships, layout (LR or TB), group by tier/layer
- Generate — write
.drawioXML file to disk. 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 -pthe target dir first. Apply the same dir choice to PNG/SVG/PDF exports in steps 4 and 7. - Export draft — run CLI to produce a preview PNG. Do NOT pass
-eat this step — the embeddedzTXt mxGraphModelchunk it adds causes vision APIs (Claude included) to return 400 "Could not process image" in step 5. Save the clean preview as<name>.png(single extension). Embedding is for the final export only (step 7). - 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
-eby mistake — re-export without-eand retry once. If it still fails, skip self-check and continue to step 6. - Review loop — show image to user, collect feedback, apply targeted XML edits, re-export, repeat until approved
- Final export — re-export the approved version to all requested formats. Use
-ehere (PNG/SVG/PDF) so the deliverable stays editable in draw.io; save as<name>.drawio.pngto signal embedded XML. For PNG with-e, runpython3 <this-skill-dir>/scripts/repair_png.py <name>.drawio.pngimmediately after — draw.io's CLI truncates the IEND chunk in-ePNG output (8 bytes missing), producing a corrupt file that vision APIs and strict PNG decoders reject (issue #8). Report file paths.
If draw.io --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.drawioXML 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.
| Check | What to look for | Auto-fix action |
| Overlapping shapes | Two or more shapes stacked on top of each other | Shift shapes apart by ≥200px |
| Clipped labels | Text cut off at shape boundaries | Increase shape width/height to fit label |
| Missing connections | Arrows that don't visually connect to shapes | Verify source/target ids match existing cells |
| Off-canvas shapes | Shapes at negative coordinates or far from the main group | Move to positive coordinates near the cluster |
| Edge-shape overlap | An edge/arrow visually crosses through an unrelated shape | Add waypoints (<Array as="points">) to route around the shape, or increase spacing between shapes |
| Stacked edges | Multiple edges overlap each other on the same path | Distribute 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 request | XML edit action |
| Change color of X | Find mxCell by value matching X, update fillColor/strokeColor in style |
| Add a new node | Append a new mxCell vertex with next available id, position near related nodes |
| Remove a node | Delete the mxCell vertex and any edges with matching source/target |
| Move shape X | Update x/y in the mxGeometry of the matching mxCell |
| Resize shape X | Update width/height in the mxGeometry of the matching mxCell |
| Add arrow from A to B | Append a new mxCell edge with source/target matching A and B ids |
| Change label text | Update the value attribute of the matching mxCell |
| Change layout direction | Full 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 createv1,v2,v3files.-eis 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
.drawiofile 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
.drawiosource file and exported image(s) - Auto-launch: offer to open the
.drawiofile 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.5 resolves a preset name:
~/.drawio-skill/styles/<name>.json— user presets (survivegit pull)<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 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"andid="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=1in 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:
&,<,>," - Multi-line text in labels: use

for line breaks insidevalueattributes (not literal\n). Example:value="Line 1
Line 2"
Shape types (vertex)
| Style keyword | Use for |
rounded=0 | plain rectangle (default) |
rounded=1 | rounded 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 |
Required properties
<!-- 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.
| Type | Style | When 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 container | Add container=1;pointerEvents=0; to any shape | Any 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
<!-- 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.
<!-- 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/entryYon 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:
| Position | exitX/entryX | exitY/entryY | Use when |
| Top center | 0.5 | 0 | connecting to node above |
| Top-left | 0.25 | 0 | 2nd connection from top |
| Top-right | 0.75 | 0 | 3rd connection from top |
| Right center | 1 | 0.5 | connecting to node on right |
| Bottom center | 0.5 | 1 | connecting to node below |
| Left center | 0 | 0.5 | connecting 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 name | fillColor | strokeColor | Use for |
| Blue | #dae8fc | #6c8ebf | services, clients |
| Green | #d5e8d4 | #82b366 | success, databases |
| Yellow | #fff2cc | #d6b656 | queues, decisions |
| Orange | #ffe6cc | #d79b00 | gateways, APIs |
| Red/Pink | #f8cecc | #b85450 | errors, alerts |
| Grey | #f5f5f5 | #666666 | external/neutral |
| Purple | #e1d5e7 | #9673a6 | security, auth |
Layout tips
Spacing — scale with complexity:
| Diagram complexity | Nodes | Horizontal gap | Vertical gap |
| Simple | ≤5 | 200px | 150px |
| Medium | 6–10 | 280px | 200px |
| Complex | >10 | 350px | 250px |
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
swimlanecells 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=1left side,exitX=0right side), eliminating all line crossings - Horizontal connections (
exitX=1orexitX=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. Outputdiagram.png. Required for vision self-check; using-ehere triggers a 400 "Could not process image" error from the vision API (issue #8). - Final / deliverable (step 7) — pass
-e. Outputdiagram.drawio.png. The embedded XML keeps the file editable in draw.io.
# Preview PNG (use this in step 4, before self-check) — NO -e
draw.io -x -f png -s 2 -o diagram.png input.drawio
# Final PNG (step 7, after user approval) — WITH -e, double extension
draw.io -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 -s 2 -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" \
draw.io -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)
draw.io -x -f svg -e -o diagram.svg input.drawio
# PDF export (final)
draw.io -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 && draw.io -x -f png -e -s 2 -o ./artifacts/diagram.drawio.png input.drawioPost-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:
python3 <this-skill-dir>/scripts/repair_png.py diagram.drawio.pngThe 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 —-ePNGs have a truncated IEND chunk that vision APIs reject (issue #8). For final PNG export, keep-eand runscripts/repair_png.py(see Post-export PNG repair). SVG/PDF unaffected.-s— scale:1,2,3(2 recommended for PNG)-o— output file path; accepts any directory (e.g../artifacts/diagram.drawio.png) —mkdir -pthe target dir first. Use.drawio.pngdouble 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 viewer URL:
python3 <this-skill-dir>/scripts/encode_drawio_url.py input.drawioPrints a https://viewer.diagrams.net/... URL with the diagram XML deflate-compressed and base64-encoded into the URL fragment. The fragment (after #) is never sent to the server, so nothing is uploaded — the diagram opens client-side for viewing and editing. Useful when the user cannot install the desktop app.
Fallback chain
When tools are unavailable, degrade gracefully:
| Scenario | Behavior |
| draw.io CLI missing, Python available | Use browser fallback (diagrams.net URL) |
| draw.io CLI missing, Python missing | Generate .drawio XML only; instruct user to open in draw.io desktop or diagrams.net manually |
| draw.io CLI crashes / no output in macOS sandbox isolation | Treat 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-check | Skip 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 draw.io is in PATH
# Try short command first
if command -v draw.io &>/dev/null; then
DRAWIO="draw.io"
elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then
DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"
else
echo "draw.io not found — install from https://github.com/jgraph/drawio-desktop/releases"
fiCommon 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 says | Section 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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

