Draw.io Professional Diagrams
by @romanmeclazcke
Generate professional draw.io diagrams (ERD/database tables, class diagrams, sequence diagrams, flowcharts, architecture diagrams) and export them as PNG. Us...
clawhub install drawioπ About This Skill
name: drawio description: Generate professional draw.io diagrams (ERD/database tables, class diagrams, sequence diagrams, flowcharts, architecture diagrams) and export them as PNG. Use when the user requests any kind of diagram, database model, class structure, flow, or system visualization. metadata: openclaw: requires: bins: ["drawio"]
Draw.io Diagram Generation Skill
When to use this skill
β οΈ MANDATORY RULES β READ BEFORE GENERATING ANYTHING
1. ALWAYS detect the diagram type first before writing any XML
2. NEVER mix styles between diagram types β each type has its own strict XML structure
3. ALWAYS assign unique sequential IDs to every mxCell starting from 0
4. NEVER use \n inside a value attribute β use separate rows/cells instead
5. ALWAYS calculate table/class heights correctly using the formulas provided
6. ALWAYS validate the XML structure before saving
7. ALWAYS export to PNG and include the PNG in the response before asking about other formats β this step is non-negotiable
8. NEVER use generic rounded rectangles for database tables or class entities
9. ALWAYS apply consistent spacing between diagram elements
- Horizontal spacing between elements: minimum 120px
- Vertical spacing between rows or steps: minimum 100px
- Tables/classes must not overlap
- Relationship lines must not cross through table headers
STEP 0 β Diagram Type Detection
Before generating any XML, identify the diagram type from the user's request:
| User says... | Diagram type | |---|---| | "database", "ERD", "tables", "entities", "foreign key" | β TYPE 1: ERD | | "class", "UML", "inheritance", "attributes", "methods" | β TYPE 2: Class Diagram | | "sequence", "interaction", "lifeline", "actor calls" | β TYPE 3: Sequence Diagram | | "flowchart", "flow", "process", "decision", "steps" | β TYPE 4: Flowchart | | "architecture", "system", "services", "components" | β TYPE 5: Architecture |
Diagram Type References
Use the detailed rules/templates in these files based on the detected type.ERD.mdCLASS.mdSEQUENCE.mdFLOWCHART.mdLAYOUT.mdGeneration Workflow β ALWAYS follow this exact order
Step 1 β Identify diagram type
Determine TYPE 1β5 from the user's message before writing any XML.Step 2 β Plan all elements
List every entity/class/participant and all relationships before coding.Step 3 β Create output folder
mkdir -p ./diagrams
Step 4 β Write and save the XML
Save to./diagrams/.drawio Mandatory pre-save checklist:
mxCell elements have unique sequential numeric IDsshape=table with shape=tableRow rows (never generic shapes)swimlane with attribute block, divider line, and method block30 + (columns x 30) for ERD tables\n in value attributes (use
for multiline text cells only)Step 5 β Export to PNG
# macOS
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png --scale 2 -o ./diagrams/.png ./diagrams/.drawioLinux / headless
xvfb-run -a drawio -x -f png --scale 2 -o ./diagrams/.png ./diagrams/.drawio
Step 6 β Verify output
ls -lh ./diagrams/.png
Step 7 β Show PNG first (MANDATORY)
Always respond with the PNG image first (embed/attach it in the response).
Step 8 β Ask the user for delivery format (MANDATORY)
After showing the PNG, ALWAYS ask the user which additional format they want:
The diagram is ready! Which format would you like?
1 - PNG image (ready to view) 2 - .drawio file (editable in draw.io) 3 - SVG (scalable vector) 4 - PDF 5 - All of the above
Reply with the number(s) of your choice.
Then based on the response:
Other export formats
# SVG (scalable vector)
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f svg -o ./diagrams/.svg ./diagrams/.drawioPDF
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f pdf -o ./diagrams/.pdf ./diagrams/.drawioHigh-res PNG (scale 3)
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png --scale 3 -o ./diagrams/_hd.png ./diagrams/.drawioTransparent background
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -t --scale 2 -o ./diagrams/_transparent.png ./diagrams/.drawio