Draw Io 标志

Draw Io

社区
Sunwood-ai-labs
draw-io

创建、编辑、导出和审查 draw.io 图表。适用于生成原生 .drawio XML、导出 PNG/SVG/PDF、检测 SVG 重叠、边框重叠、标签侵入、标签矩形、短终端、文本对比度、文本强调和文本溢出问题,以及调整布局和使用 AWS 图标。

Add to TypingMind

概览

发布者Sunwood-ai-labs
代码仓库draw-io-skill
技能名称draw-io
星标数
51
复刻数
2
附带文件
91
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 91 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 Sunwood-ai-labs 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Draw Io AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/Sunwood-ai-labs/draw-io-skill/tree/main
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Sunwood-ai-labs/draw-io-skill.git \
  .claude/skills/draw-io
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Draw Io,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Draw Io。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Draw Io 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

draw.io Diagram Skill

1. Purpose

Use this skill when an agent needs to:

  • create a new draw.io diagram as native .drawio XML
  • edit or refactor an existing .drawio file
  • export diagrams to png, svg, pdf, or jpg
  • check routed edges, box- or frame-border overlap, supported non-rect shape border overlap, box penetration, short arrowhead tails, label collisions, weak text contrast, flat dark-card text treatment, or text overflow
  • build architecture diagrams with AWS icons

This skill intentionally combines:

  • the native draw.io assistant workflow used by Claude Code style tools
  • practical XML editing and layout rules from repository use
  • repository-ready SVG linting that catches issues draw.io does not flag

1.1 Repository structure

The repository layout and bundled workflow pieces are summarized in the diagram below.

draw-io-skill structure

The repository also ships:

  • an English structure source and exports under assets/draw-io-skill-structure.drawio*
  • an icon block showcase under assets/draw-io-skill-structure-icons.drawio* plus a Japanese-localized companion under assets/draw-io-skill-structure-icons.ja.drawio*
  • a shape-focused lint review sample under assets/draw-io-skill-structure-shapes.drawio with exports at assets/draw-io-skill-structure-shapes.drawio.png and assets/draw-io-skill-structure-shapes.drawio.svg
  • a Japanese-localized companion source and exports under assets/draw-io-skill-structure.ja.drawio*
  • default visual templates and style tokens under references/aesthetic-templates.md
  • an editable polished visual template sample under assets/aesthetic-template-sample.drawio
  • three professional-grade sample templates under assets/aesthetic-sample-executive-dashboard.drawio, assets/aesthetic-sample-ai-pipeline.drawio, and assets/aesthetic-sample-security-incident.drawio
  • three purpose-driven templates with distinct existence reasons under assets/purpose-board-brief-template.drawio, assets/purpose-dependency-orbit-template.drawio, and assets/purpose-incident-timeline-template.drawio
  • three additional purpose-driven templates under assets/purpose-hypothesis-helix-template.drawio, assets/purpose-feature-value-matrix-template.drawio, and assets/purpose-value-conversion-sheet-template.drawio
  • public showcase pages under docs/guide/showcase.md and docs/ja/guide/showcase.md
  • fixture-based lint coverage under fixtures/basic, fixtures/border-overlap, fixtures/large-frame-border-overlap, fixtures/shape-border-overlap, fixtures/label-rect-overlap, fixtures/text-cell-overflow, fixtures/text-contrast, fixtures/text-emphasis, and fixtures/shape-text-overflow

1.2 Repository-local commands

When working inside this repository, these are the main maintenance commands:

sh
npm install
npm run check
npm run verify
npm ci
npm run docs:build
npm run docs:dev
uv run python -m py_compile scripts/find_aws_icon.py

Use them this way:

  • npm run check: script syntax plus fixture-based lint verification
  • npm run verify: full repository signoff, including docs build
  • npm run docs:build: one-shot docs build
  • npm run docs:dev: interactive docs preview

If you need to attach the repo as a skill in a local assistant environment, the repository docs use these conventions:

  • Codex on Windows: junction C:\Users\YOUR_NAME\.codex\skills\draw-io -> D:\Prj\draw-io-skill
  • Claude Code: clone under ~/.claude/skills/drawio

1.3 Repository QA model

The repository uses three QA layers:

  1. syntax checks for the JavaScript tools
  2. fixture-based lint verification
  3. documentation build validation for the public-facing docs

That keeps the technical tooling and the user-facing docs aligned in CI.

2. Default Workflow

Follow this order unless the user asks for something narrower:

  1. Create or update the native .drawio file first.
  2. When creating a diagram from scratch and the user did not specify a visual style, start from references/aesthetic-templates.md; default to the polished technical light template instead of draw.io's plain box defaults.
  3. Keep .drawio as the editable source of truth for repository work.
  4. If the user asked for an exported artifact, export to .drawio.png, .drawio.svg, .drawio.pdf, or .drawio.jpg.
  5. Before showing, attaching, or claiming a diagram is ready, export an SVG and run the lint script.
  6. If the draw.io CLI is unavailable, do not silently skip linting. Create or locate the expected companion *.drawio.svg if possible, run the lint script, and explicitly report any reduced coverage such as parsed 0 edges; then run a manual or scripted geometry sanity check for arrows, labels, and box intrusions before surfacing the image.
  7. Open or surface the final artifact requested by the user only after linting and visual verification.
  8. Even when lint passes, visually verify the result.
  9. If the lint output reports reduced coverage such as parsed 0 edges, inspect the exported PNG/SVG image itself before finalizing. Do not claim the diagram is clean while visible rendered text, line labels, arrows, or routes overlap; fix the rendered artifact and rerun the lint plus visual inspection.

If the user only asks for a diagram and does not request a format, stop at the .drawio file.

3. Basic Rules

  • Edit only .drawio files directly.
  • Do not manually edit generated .drawio.png, .drawio.svg, or .drawio.pdf files.
  • Prefer native mxGraphModel XML over Mermaid or CSV conversions.
  • Keep source diagrams unless the user explicitly wants embedded-only cleanup after export.
  • Use descriptive lowercase filenames with hyphens.

Examples:

  • login-flow.drawio
  • login-flow.drawio.png
  • er-diagram.drawio.svg
  • architecture-overview.drawio.pdf

4. Output Formats

FormatEmbedded XMLRecommended use
.drawion/aEditable source diagram
pngYesDocs, slides, chat attachments
svgYesDocs, scalable output, lint input
pdfYesReview and print
jpgNoLast-resort lossy export

For repository workflows, prefer:

  • .drawio while editing
  • .drawio.svg when running lint
  • .drawio.png or .drawio.svg for documentation embeds

5. Export Commands

5.1 Preferred export helper

Use the bundled helper first:

sh
node scripts/export-drawio.mjs architecture.drawio --format png --open
node scripts/export-drawio.mjs architecture.drawio --format svg
node scripts/export-drawio.mjs architecture.drawio --output architecture.drawio.pdf

What it does:

  • locates the draw.io CLI on Windows, macOS, or Linux
  • uses embedded XML for png, svg, and pdf
  • defaults to transparent 2x PNG export
  • supports explicit --drawio <path> when automatic CLI discovery fails
  • supports optional --delete-source when the user explicitly wants only the embedded export

If draw.io CLI discovery fails, rerun with an explicit executable path:

sh
node scripts/export-drawio.mjs architecture.drawio --drawio "C:\\Program Files\\draw.io\\draw.io.exe" --format svg

On macOS or Linux, point --drawio at the installed executable for that environment.

5.2 Manual draw.io CLI export

If needed, call draw.io directly:

sh
drawio -x -f png -e -s 2 -t -b 10 -o architecture.drawio.png architecture.drawio
drawio -x -f svg -e -b 10 -o architecture.drawio.svg architecture.drawio
drawio -x -f pdf -e -b 10 -o architecture.drawio.pdf architecture.drawio
drawio -x -f jpg -b 10 -o architecture.drawio.jpg architecture.drawio

Key flags:

  • -x: export mode
  • -f: output format
  • -e: embed diagram XML in png/svg/pdf
  • -o: output file path
  • -b: border width
  • -t: transparent background for PNG
  • -s: scale factor
  • -a: all pages for PDF
  • -p: page index (1-based)

5.3 Legacy PNG helper

For existing shell workflows, the original helper remains available:

sh
bash scripts/convert-drawio-to-png.sh architecture.drawio

6. SVG Linting

Linting is a required preflight before presenting a diagram to the user or embedding it in docs/articles. Do not wait for the user to ask whether lint was run.

After exporting SVG, run the bundled lint:

sh
node scripts/check-drawio-svg-overlaps.mjs architecture.drawio.svg
node scripts/check-drawio-svg-overlaps.mjs fixtures/border-overlap/border-overlap.drawio.svg
node scripts/check-drawio-svg-overlaps.mjs fixtures/large-frame-border-overlap/large-frame-border-overlap.drawio.svg
node scripts/check-drawio-svg-overlaps.mjs fixtures/shape-border-overlap/shape-border-overlap.drawio.svg
node scripts/check-drawio-svg-overlaps.mjs fixtures/label-rect-overlap/label-rect-overlap.drawio
node scripts/check-drawio-svg-overlaps.mjs fixtures/text-cell-overflow/text-cell-overflow.drawio
node scripts/check-drawio-svg-overlaps.mjs fixtures/text-contrast/text-contrast.drawio
node scripts/check-drawio-svg-overlaps.mjs fixtures/text-emphasis/text-emphasis.drawio

The lint script currently checks:

  • edge-edge: edge crossings and collinear overlaps
  • edge-rect-border: lines that run along or visibly overlap a box or large frame border
  • edge-shape-border: lines that run along supported non-rect shape borders such as document, hexagon, parallelogram, and trapezoid
  • edge-rect: lines penetrating boxes
  • edge-terminal: final arrow runs that are too short after the last bend
  • edge-label: routed lines crossing label text boxes
  • label-rect: label text boxes colliding with another box or card
  • rect-shape-border: box or frame borders that run along those supported non-rect shape borders
  • text-contrast: text whose font color is too close to its fill color for the current font size
  • text-emphasis: compact dark cards whose title/body copy is still flattened into a single dense text block
  • text-overflow(width): text likely too wide for its box
  • text-overflow(height): text likely too tall for its box

Notes:

  • input may be either .drawio or .drawio.svg
  • when the input is .drawio, the checker also reads the companion draw.io geometry so label-rect and text-fit checks stay aligned with the editable source
  • when the input is .drawio, a companion same-name.drawio.svg is expected for routed-edge checks; if it is missing, export it first instead of treating the failure as non-actionable
  • if the checker reports parsed 0 edges, the SVG did not provide usable edge geometry; report that limitation and supplement with visual inspection or a small coordinate/geometry check for arrow-label overlap, arrow-box intrusion, and text overflow
  • never claim a diagram is final based only on visual review when the lint script was skipped or failed to inspect edges
  • text-contrast currently requires explicit hex fillColor and fontColor
  • text overflow detection is heuristic, not pixel-perfect
  • bundled fixtures cover simple box-border overlap, large frame-border overlap, supported non-rect shape border overlap, label-box collisions, text-cell overflow, low-contrast text, dense dark-card copy, and shape-aware text overflow
  • edge-terminal, edge-label, label-rect, and text-emphasis are heuristic checks intended to catch the common "tiny arrowhead tail", "line through label", "note card covering a label", and "dark card text visually blending together" draw.io failures seen in repository diagrams
  • lint passing does not replace visual verification

When investigating findings:

  • if edge-rect-border, edge-shape-border, or rect-shape-border is intentional, keep the routing obvious, visually review the output, and document the exception in the surrounding workflow
  • if edge-terminal fires, add a longer straight segment before the arrowhead or move the last bend farther away from the target
  • if edge-label fires, reroute the edge or move the label so the text keeps clean breathing room
  • if label-rect fires, move the note/card/box or shift the label so they no longer partially overlap
  • if text-contrast fires, increase foreground/background contrast instead of relying on opacity, texture, or stroke
  • if text-emphasis fires, split the title from the body with a chip, separate text cell, stronger hierarchy, or more breathing room
  • if text-overflow looks like a false positive, first try widening the box, shortening the label, adding an intentional line break, or setting explicit fonts

7. XML And Layout Rules

7.0 Visual template selection

For new diagrams, choose a visual template before writing the XML. If the user gives no style direction, use the polished technical light template from references/aesthetic-templates.md.

Minimum visual baseline:

  • explicit fontFamily=Noto Sans JP for Japanese or mixed Japanese/English diagrams
  • explicit fill, stroke, and font colors; avoid default gray draw.io styling
  • rounded cards with restrained borders and enough internal padding
  • clear title/body hierarchy instead of one dense text block
  • one or two accent colors only, with adequate contrast
  • orthogonal routed connectors with enough terminal room near arrowheads

If a diagram passes lint but still looks visually plain, revise hierarchy, spacing, and palette before presenting it.

7.1 Required XML structure

Every diagram must use native mxGraphModel XML:

xml
<mxGraphModel>
  <root>
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
  </root>
</mxGraphModel>

All normal diagram cells should live under parent="1" unless you intentionally use container parents.

7.2 Edge geometry is mandatory

Every edge cell must contain geometry:

xml
<mxCell id="e1" edge="1" parent="1" source="a" target="b" style="edgeStyle=orthogonalEdgeStyle;">
  <mxGeometry relative="1" as="geometry"/>
</mxCell>

Never use self-closing edge cells.

7.3 Font settings

For diagrams with Japanese text or slide usage, set the font family explicitly:

xml
<mxGraphModel defaultFontFamily="Noto Sans JP" ...>

Also set fontFamily in text styles:

xml
style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;"

7.4 Spacing and routing

  • space nodes generously; prefer about 200px horizontal and 120px vertical gaps for routed diagrams
  • leave at least 20px of straight segment near arrowheads
  • use edgeStyle=orthogonalEdgeStyle for most technical diagrams
  • add explicit waypoints when auto-routing produces overlap or awkward bends
  • when using large outer frames or swimlanes, keep routed segments off the frame stroke and use the gutter between the frame and child boxes instead
  • align to a coarse grid when possible

Example with waypoints:

xml
<mxCell id="e1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;jettySize=auto;" edge="1" parent="1" source="a" target="b">
  <mxGeometry relative="1" as="geometry">
    <Array as="points">
      <mxPoint x="300" y="150"/>
      <mxPoint x="300" y="250"/>
    </Array>
  </mxGeometry>
</mxCell>

7.5 Containers and groups

Do not fake containment by simply placing boxes on top of bigger boxes.

  • use parent="containerId" for child elements
  • use swimlane when the container needs a visible title bar
  • use group;pointerEvents=0; for invisible containers
  • add container=1;pointerEvents=0; when using a custom shape as a container

7.6 Japanese text width

Allow roughly 30 to 40px per Japanese character.

xml
<mxGeometry x="140" y="60" width="400" height="40" />

If text is mixed Japanese and English, err on the wider side.

7.7 Backgrounds, frames, and margins

  • prefer transparent backgrounds over hard-coded white backgrounds
  • inside rounded frames or swimlanes, keep at least 30px margin from the boundary
  • account for stroke width and rounded corners
  • verify that titles and labels do not sit too close to frame edges

7.8 Labels and line breaks

  • use one line for short service names when possible
  • use &lt;br&gt; for intentional two-line labels
  • shorten redundant wording instead of forcing cramped boxes

7.9 Metadata and progressive disclosure

When appropriate, include title, description, last updated, author, or version.

Split complex systems into multiple diagrams when one canvas becomes dense:

  • context diagram
  • system diagram
  • component diagram
  • deployment diagram
  • data flow diagram
  • sequence diagram

8. AWS Icon Workflow

When working on AWS diagrams:

  • use the latest official icon naming where possible
  • prefer current mxgraph.aws4.* icon references
  • remove decorative icons that do not add meaning

Search icons with:

sh
uv run python scripts/find_aws_icon.py ec2
uv run python scripts/find_aws_icon.py lambda

9. Checklist

  • diagram source is a valid .drawio file
  • a visual template was chosen for new diagrams, defaulting to references/aesthetic-templates.md when unspecified
  • export filenames use .drawio.<format> when exported
  • edge cells contain <mxGeometry relative="1" as="geometry"/>
  • fonts are explicit when Japanese text is involved
  • no hard-coded white page background unless the user asked for it
  • containers have enough internal margin
  • edge routing is visually clear and leaves room for arrowheads
  • SVG lint passes for routing-heavy diagrams
  • no edge-terminal findings remain unless a tiny terminal run is intentionally accepted
  • no edge-label or label-rect findings remain
  • no edge-rect-border findings remain unless a box or frame border overlap is intentionally accepted
  • no edge-shape-border or rect-shape-border findings remain unless a supported non-rect border contact is intentionally accepted
  • no text-contrast findings remain
  • no text-emphasis findings remain on compact dark cards unless the treatment is intentionally accepted after visual review
  • no text-overflow(width) or text-overflow(height) findings remain
  • final PNG/SVG/PDF was visually checked

10. Repository Docs

For repo-facing documentation and onboarding:

Docs-specific repo note:

  • if GitHub Pages styling breaks after a repo rename, verify the VitePress base still matches /draw-io-skill/

11. References And Credits

This local version is intentionally a blended skill:

  • editing and layout guidance inspired by softaworks/agent-toolkit
  • native assistant workflow and export conventions inspired by jgraph/drawio-mcp
  • SVG linting and repository-ready QA extensions added in this repository

Referenced repositories and sources:

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

还有 31 个文件。

常见问题

Draw Io AI 技能有什么作用?

创建、编辑、导出和审查 draw.io 图表。适用于生成原生 .drawio XML、导出 PNG/SVG/PDF、检测 SVG 重叠、边框重叠、标签侵入、标签矩形、短终端、文本对比度、文本强调和文本溢出问题,以及调整布局和使用 AWS 图标。

为什么在 TypingMind 中使用 Draw Io?

因为您只需安装一次,就能搭配任何模型使用。Draw Io 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Draw Io?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/Sunwood-ai-labs/draw-io-skill/tree/main。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Draw Io?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Draw Io 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Draw Io 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Draw Io AI 技能免费吗?

是的。Sunwood-ai-labs 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇