drawio
SKILL.md
Drawio Kernel Agent
Use the agent's built-in model for reasoning. Do not call OpenAI, Anthropic, Gemini, or any hosted model API.
Files in this Skill
scripts/validate_ir.mjs: Validate IR JSON and print validation result.scripts/compile_ir.mjs: Compile valid IR JSON to.drawioXML.scripts/_load_kernel.mjs: Resolve kernel module path with fallback logic.references/ir-template.json: Minimal IR starting template.vendor/drawio-kernel/kernel.mjs: Bundled deterministic compiler.vendor/drawio-kernel/schema.json: IR JSON schema.
Kernel resolution priority in scripts:
DRAWIO_KERNEL_FILEDRAWIO_KERNEL_ROOT/kernel.mjs- Bundled
vendor/drawio-kernel/kernel.mjs <cwd>/tools/drawio-kernel/kernel.mjs- Legacy relative
../../../tools/drawio-kernel/kernel.mjs
Execution Workflow
Phase 1 — Structure (topology only)
- Read the user request and infer diagram intent (entities, relationships, flow direction).
- Produce a topology-only IR JSON: nodes with
id,type,labeland edges withsource,target,label. Do not assign coordinates yet.
Phase 2 — Layout (assign coordinates)
- Review the topology and assign
x,y,width,heightto each node. Follow layout heuristics:- Align to grid (multiples of 10).
- Top-down flow: increment
ybyheight + gapper level. - Left-right branching: offset
xfor parallel paths. - Containers: ensure children fit inside parent bounds with padding.
- Edge-aware placement: position nodes to minimize edge crossings. Place heavily connected nodes closer together. Avoid layouts that force edges to cross through unrelated nodes.
- Validate the complete IR:
node skills/drawio/scripts/validate_ir.mjs --in /tmp/diagram.ir.json
- Compile IR to draw.io XML:
node skills/drawio/scripts/compile_ir.mjs --in /tmp/diagram.ir.json --out /tmp/diagram.drawio
Phase 3 — Visual Review & Refinement
- Export to PNG:
/Applications/draw.io.app/Contents/MacOS/draw.io --export --format png --scale 2 --output /tmp/diagram.png /tmp/diagram.drawio
-
Read the exported PNG with the
Readtool. Self-review with edge routing as top priority:Edge issues (check first):
- Crossing: edges crossing each other unnecessarily — reorder node positions or add waypoints to reroute
- Overlap with nodes: edges passing through unrelated nodes — add waypoints to route around them
- Ambiguous routing: unclear which node an edge connects to — use orthogonal routing (
"orthogonal": true) and explicit waypoints - Label collision: edge labels overlapping edges or nodes
Node issues:
- Overlap: nodes or labels covering each other
- Clipping: text truncated inside node bounds
- Alignment: uneven spacing or misaligned parallel branches
- Readability: font too small, labels unclear
-
If issues found: fix the IR (adjust coordinates, sizes, or styles), re-validate, re-compile, re-export, and re-review. Maximum 2 refinement rounds.
-
Return the
.drawiopath and.pngpreview path. Use inline XML only when user explicitly asks.
IR Requirements
- Keep node IDs unique and stable.
- Ensure each edge references existing
sourceandtargetnode IDs. - Use coordinates aligned to multiples of 10 whenever possible.
- Prefer supported node types:
processstart_enddecisiondata_storetextcontainer
Reasoning Boundaries
- Phase 1 (Structure): focus on what nodes/edges exist and how they connect. Do not think about positions.
- Phase 2 (Layout): focus on spatial arrangement. Do not change topology.
- Phase 3 (Review): focus on visual quality. Only adjust coordinates, sizes, and styles — do not add/remove nodes.
- Let deterministic code handle validation and XML assembly.
- If compile fails, repair IR once and retry automatically.
- If user intent is ambiguous, choose a conservative flowchart and state assumptions.
Prohibited Actions
- Do not send prompts to external model providers.
- Do not expose or depend on runtime
/api/generateendpoints. - Do not claim API-based generation.
Weekly Installs
1
Repository
fancive/claude-skillsFirst Seen
11 days ago
Security Audits
Installed on
codex1