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"]
7w4.net小葱技能。
mxCell starting from 0\n inside a value attribute — use separate rows/cells insteadBefore 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 |
Use the detailed rules/templates in these files based on the detected type.
ERD.mdCLASS.mdSEQUENCE.mdFLOWCHART.mdLAYOUT.mdDetermine TYPE 1–5 from the user's message before writing any XML.
List every entity/class/participant and all relationships before coding.
mkdir -p ./diagrams
Save to ./diagrams/<diagram-name>.drawio
Mandatory pre-save checklist:
- [ ] All mxCell elements have unique sequential numeric IDs
- [ ] ERD tables use shape=table with shape=tableRow rows (never generic shapes)
- [ ] Class diagrams use swimlane with attribute block, divider line, and method block
- [ ] Sequence diagrams have lifelines, activation boxes, and correct arrow styles
- [ ] ERD relationship arrows connect to row cell IDs, not table container IDs
- [ ] Heights calculated correctly: 30 + (columns x 30) for ERD tables
- [ ] No literal \n in value attributes (use 
 for multiline text cells only)
- [ ] XML is well-formed and all tags are closed
# macOS
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png --scale 2 -o ./diagrams/<name>.png ./diagrams/<name>.drawio
# Linux / headless
xvfb-run -a drawio -x -f png --scale 2 -o ./diagrams/<name>.png ./diagrams/<name>.drawio
ls -lh ./diagrams/<name>.png
Always respond with the PNG image first (embed/attach it in the response).
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
Then based on the response: - 1 → send the PNG file - 2 → send the .drawio file - 3 → export SVG and send it - 4 → export PDF and send it - 5 → send all formats - Multiple numbers (e.g. "1 2") → send all requested formats
# SVG (scalable vector)
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f svg -o ./diagrams/<name>.svg ./diagrams/<name>.drawio
# PDF
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f pdf -o ./diagrams/<name>.pdf ./diagrams/<name>.drawio
# High-res PNG (scale 3)
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png --scale 3 -o ./diagrams/<name>_hd.png ./diagrams/<name>.drawio
# Transparent background
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -t --scale 2 -o ./diagrams/<name>_transparent.png ./diagrams/<name>.drawio
这个技能质量较好,能生成专业的数据库表图、类图、时序图、流程图等多种图表,模板详细、颜色规范,导出格式丰富(PNG/SVG/PDF)。优点是步骤清晰、有强制规则避免常见错误;不足是文档语言混杂(英文和西班牙文混用),部分功能介绍不够通俗,小白理解起来有门槛。整体上这是一个实用性强、覆盖面广的图表生成工具。