drawio
Installation
SKILL.md
drawio Diagram Generator
Quick Start: Create <mxfile> with <diagram> → Define <mxGraphModel> with grid settings → Add <root> with cells → Use <mxCell> for shapes and edges → Set geometry with <mxGeometry> → Wrap in ```drawio fence.
Critical Rules
Structure Rules
- S1: Check Stencil Names 🚨 NEVER guess stencil names. Check stencils/README.md for EXACT names. Wrong:
mxgraph.cisco.router→ Correct:mxgraph.cisco.routers.router - S2: Stencils Require fillColor Many stencils have no default color. Always add
fillColor/strokeColor. Exception: edge/link stencils are connectors, not devices. - S3: Root Cells Required Must include
<mxCell id="0"/>and<mxCell id="1" parent="0"/>or diagram won't render. - S4: Labels Below Stencils Use
verticalLabelPosition=bottom;verticalAlign=top;labelPosition=center;align=center;for device labels. - S5: mxCell Must Be Siblings ALL mxCell elements must be siblings under
<root>— NEVER nest mxCell inside another mxCell. - S6: Container Transparency For container shapes, use
fillColor=none;to make background transparent and prevent covering child elements.
Preset Color Palette: Blue(#dae8fc,#6c8ebf) Green(#d5e8d4,#82b366) Orange(#ffe6cc,#d79b00) Red(#f8cecc,#b85450) Purple(#e1d5e7,#9673a6) Yellow(#fff2cc,#d6b656) Gray(#f5f5f5,#666666)
Layout Rules
- L1: Starting Margin Begin positioning from x=40, y=40.
- L2: Element Spacing Keep 40-60px gaps between connected shapes; 150-200px for routing channels.
- L3: Compact Layouts Use vertical stacking or grid layouts. Avoid spreading elements too far apart.