跳到正文
Skillpedia
界面(UI/UX)40k · #7184

drawio

它能做什么

这个工具可以根据描述创建流程图、组织结构图等图表,并将图表保存为 `.drawio` 文件,或导出为图片(PNG、SVG、PDF)。

适用场景

  • ✓为某个流程创建流程图。
  • ✓为公司绘制组织结构图。
  • ✓将系统架构可视化。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/drawio/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/drawio/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“创建一个简单的流程图,展示制作咖啡的步骤,并保存为 PNG 格式。”

每周 5 个新技能,1 分钟读完。

工作原理

你描述想要的图表,工具会将其转换为 draw.io 程序能够识别的特殊代码(XML)。然后它把这些代码保存到文件中,并可以将其转换为图片。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Draw.io Diagram Skill

Generate draw.io diagrams as native .drawio files and export them to PNG images that can be embedded in Word documents.

How to Create a Diagram

  1. Generate draw.io XML in mxGraphModel format for the requested diagram
  2. Write the XML to a .drawio file using the create/edit file tool
  3. Export to PNG using the bundled export script

Bundled Export Script

This skill includes drawio-to-png.mjs, a Node.js export script with two rendering backends:

  1. draw.io CLI (pixel-perfect, fastest) — used automatically if draw.io desktop is installed
  2. Official draw.io viewer in headless browser (pixel-perfect, needs Chromium/Edge) — fallback when CLI is unavailable

Usage

# Install dependencies (one-time, from the scripts folder)
cd skills/drawio/scripts && npm install

# Export a single diagram
node skills/drawio/scripts/drawio-to-png.mjs <input.drawio> [output.png]

# Export all .drawio files in a directory
node skills/drawio/scripts/drawio-to-png.mjs --dir <directory>

# Force a specific renderer
node skills/drawio/scripts/drawio-to-png.mjs --renderer=cli|viewer|auto <input.drawio>

Skill Folder Contents

File Purpose
SKILL.md This instruction file
scripts/drawio-to-png.mjs Node.js export script (CLI + browser fallback)
scripts/package.json Dependencies (puppeteer-core)

Supported Export Formats

Format Embed XML Notes
png Yes Viewable everywhere, editable in draw.io
svg Yes Scalable, editable in draw.io
pdf Yes Printable, editable in draw.io

Draw.io XML Style Conventions

Use these styles for consistent, professional diagrams:

<!-- Primary service (highlighted) -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;strokeWidth=2;arcSize=12;shadow=1;" />

<!-- External system -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;" />

<!-- Success/processing stage -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" />

<!-- Warning/quality gate -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />

<!-- Error/failure path -->
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;" />

<!-- Data store (cylinder) -->
<mxCell style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" />

<!-- Arrow -->
<mxCell style="edgeStyle=orthogonalEdgeStyle;rounded=1;strokeColor=#6c8ebf;strokeWidth=2;" />

Locating the draw.io CLI

Try drawio first (works if on PATH), then fall back:

  • Windows: "C:\Program Files\draw.io\draw.io.exe"
  • macOS: /Applications/draw.io.app/Contents/MacOS/draw.io
  • Linux: drawio (via snap/apt/flatpak)

CLI Export Command

drawio -x -f png -e -b 10 -o <output.png> <input.drawio>

Flags: -x (export), -f (format), -e (embed diagram XML), -b (border), -o (output path).

常见问题

什么是 .drawio 文件?

它是一个包含图表全部信息的文件,之后你可以在 draw.io 程序中继续编辑。

导出为 PNG 后还能编辑图表吗?

可以。如果 PNG 是嵌入了 XML 的(这是默认设置),你可以在 draw.io 中打开它进行编辑。

AI 怎么知道该如何画这个图表?

你需要向 AI 描述图表,告诉它要包含哪些元素(方框、箭头、文字)以及它们之间如何连接。

详情

作者的原始描述

Generate draw.io diagrams as .drawio files and export to PNG/SVG/PDF with embedded XML

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7184
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能