drawio-generator

将自然语言或文档(docx/pdf/txt)转换为 draw.io 可编辑 XML 图表(.drawio 文件)。当用户说"画个流程图"、"生成图表"、"画架构图/时序图/网络拓扑图"、"帮我画xxx流程"、"生成draw.io"等时自动触发。使用流程:接收描述→生成JSON→用户确认→调用gen.py生成.drawio→告知用户用draw.io打开。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "drawio-generator" with this command: npx skills add wuliwenjing/drawio-ai-maker

drawio-generator

如何使用(标准流程)

Step 1:接收用户的流程描述(文字或文件上传)

Step 2:根据描述生成结构化 JSON(nodes + edges),将 JSON 展示给用户确认

Step 3:用户确认后,调用生成脚本:

python3 skills/drawio-generator/scripts/gen.py "图表标题" '{"title":"...","nodes":[...],"edges":[...]}' [类型]

Step 4:交付 .drawio 文件到输出目录,并告知用户:

用 draw.io 打开此文件(网页版 https://app.diagrams.net 或桌面版 App),如需微调请手动调整节点位置后保存。

⚠️ 生成结果非完美,可能存在线条重叠或间距不理想,需要在 draw.io 中手动微调。

输出目录

  • 默认:/Users/owen/Desktop/drawio-generator/
  • 可通过环境变量 DRAWIO_OUTPUT_DIR 或命令行 --output-dir 自定义

JSON 结构

{
  "title": "流程名称",
  "type": "flowchart",
  "nodes": [
    {"id": "0", "type": "start", "label": "开始"},
    {"id": "1", "type": "process", "label": "处理步骤"},
    {"id": "2", "type": "decision", "label": "判断条件?"},
    {"id": "3", "type": "end", "label": "结束"}
  ],
  "edges": [
    {"source": "0", "target": "1"},
    {"source": "1", "target": "2"},
    {"source": "2", "target": "3", "label": "是"},
    {"source": "2", "target": "1", "label": "否"}
  ]
}

节点 type 值

type形状
start椭圆
end椭圆
process圆角矩形
decision菱形
document文档形状
data平行四边形

edges.label 值

label含义
/ Y条件为真
/ N条件为假
普通顺序流

支持的图表类型

flowchart | sequence | network | architecture | hierarchy | function | deployment


文件说明

文件说明
scripts/gen.py标准生成脚本(必须使用,禁止直接调用 generator.py)
scripts/generator.py底层 XML 生成器(gen.py 内部调用)
scripts/parser.py输入解析(txt 直接读取,docx/pdf 需额外安装库)
references/drawio-xml-spec.mddraw.io XML 格式规范

依赖说明

  • 解析 .docx 需要:pip install python-docx
  • 解析 .pdf 需要:pip install pdfplumber

布局参数

参数默认值说明
CANVAS_WIDTH850画布宽度
_LAYER_GAP_Y120层间垂直间距
MAIN_X425主轴 X 坐标

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Architecture Diagram

AI architecture diagram generator supporting Mermaid charts. Generate system architecture, cloud architecture, neural network, graph theory, flowchart, ER di...

Registry SourceRecently Updated
2250Profile unavailable
Automation

Excalidraw Render

Create professional Excalidraw diagrams — flowcharts, architecture diagrams, workflows, systems, processes, or concepts. Use when user asks to "create a diag...

Registry SourceRecently Updated
812Profile unavailable
Coding

Diagram Drawing

Generate high-quality SVG and PNG technical diagrams from natural language, including architecture, flowchart, sequence, UML, mind maps, and AI agent systems.

Registry SourceRecently Updated
1470Profile unavailable
General

Arch Video Cut

自动合并建筑视频,生成字幕和背景音乐,输出横屏与竖屏双版本,支持自学习优化剪辑偏好。

Registry SourceRecently Updated
3330Profile unavailable