Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

drawiodrawio 命令行

Agent Skill

drawio 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

753

周安装

32

GitHub Stars

773

下载量

264
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:drawio(drawio 命令行)
来源仓库:https://github.com/agents365-ai/drawio-skill
仓库路径:skills/drawio
安装命令:
npx skills add https://github.com/agents365-ai/drawio-skill --skill drawio
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/agents365-ai/drawio-skill --skill drawio

简介

drawio 用于生成 .drawio XML 文件并通过本地 draw.io 桌面应用导出为 PNG/SVG/PDF/JPG 格式。

  • 适合需要流程图、架构图或可视化表达多组件交互系统的场景。
  • 支持嵌入 XML 的导出格式(如 name.drawio.png),便于后续编辑恢复。
  • 使用时需确保已安装 draw.io 桌面应用 CLI,并注意不同格式的输出限制。
  • drawio 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Draw.io Diagrams

Overview

Generate .drawio XML files and export to PNG/SVG/PDF/JPG locally using the native draw.io desktop app CLI.

Supported formats: PNG, SVG, PDF, JPG — no browser automation needed.

PNG, SVG, and PDF exports support --embed-diagram (-e) — the exported file contains the full diagram XML, so opening it in draw.io recovers the editable diagram. Use double extensions (name.drawio.png) to signal embedded XML.

When to Use

Explicit triggers: user says "画图", "diagram", "visualize", "flowchart", "draw", "架构图", "流程图"

Proactive triggers:

  • Explaining a system with 3+ interacting components
  • Describing a multi-step process or decision tree
  • Comparing architectures or approaches side by side

Skip when: a simple list or table suffices, or user is in a quick Q&A flow

Prerequisites

The draw.io desktop app must be installed and the CLI accessible:

# macOS (Homebrew — recommended)
brew install --cask drawio
draw.io --version

# macOS (full path if not in PATH)
/Applications/draw.io.app/Contents/MacOS/draw.io --version

# Windows
"C:\Program Files\draw.io\draw.io.exe" --version

# Linux
draw.io --version

Install draw.io desktop if missing:

Workflow

  1. Check deps — verify draw.io --version succeeds; note platform for correct CLI path
  2. Plan — identify shapes, relationships, layout (LR or TB), group by tier/layer
  3. Generate — write .drawio XML file to disk (output dir same as user's working dir)
  4. Export draft — run CLI to produce PNG for preview
  5. Self-check — read the exported PNG, catch obvious issues, auto-fix before showing user
  6. Review loop — show image to user, collect feedback, apply targeted XML edits, re-export, repeat until approved
  7. Final export — export approved version to all requested formats, report file paths

Step 5: Self-Check

After exporting the draft PNG, read the image and check for these issues before showing the user:

CheckWhat to look forAuto-fix action
Overlapping shapesTwo or more shapes stacked on top of each otherShift shapes apart by ≥200px
Clipped labelsText cut off at shape boundariesIncrease shape width/height to fit label
Missing connectionsArrows that don't visually connect to shapesVerify source/target ids match existing cells
Off-canvas shapesShapes at negative coordinates or far from the main groupMove to positive coordinates near the cluster
Edge-shape overlapAn edge/arrow visually crosses through an unrelated shapeAdd waypoints (<Array as="points">) to route around the shape, or increase spacing between shapes
Stacked edgesMultiple edges overlap each other on the same pathDistribute entry/exit points across the shape perimeter (use different exitX/entryX values)
  • Max 2 self-check rounds — if issues remain after 2 fixes, show the user anyway
  • Re-export after each fix and re-read the new PNG

Step 6: Review Loop

After self-check, show the exported image and ask the user for feedback.

Targeted edit rules — for each type of feedback, apply the minimal XML change:

User requestXML edit action
Change color of XFind mxCell by value matching X, update fillColor/strokeColor in style
Add a new nodeAppend a new mxCell vertex with next available id, position near related nodes
Remove a nodeDelete the mxCell vertex and any edges with matching source/target
Move shape XUpdate x/y in the mxGeometry of the matching mxCell
Resize shape XUpdate width/height in the mxGeometry of the matching mxCell
Add arrow from A to BAppend a new mxCell edge with source/target matching A and B ids
Change label textUpdate the value attribute of the matching mxCell
Change layout directionFull regeneration — rebuild XML with new orientation

Rules:

  • For single-element changes: edit existing XML in place — preserves layout tuning from prior iterations
  • For layout-wide changes (e.g., swap LR↔TB, "start over"): regenerate full XML
  • Overwrite the same {name}.png each iteration — do not create v1, v2, v3 files
  • After applying edits, re-export and show the updated image
  • Loop continues until user says approved / done / LGTM / 完成
  • Safety valve: after 5 iteration rounds, suggest the user open the .drawio file in draw.io desktop for fine-grained adjustments

Step 7: Final Export

Once the user approves:

  • Export to all requested formats (PNG, SVG, PDF, JPG) — default to PNG if not specified
  • Report file paths for both the .drawio source file and exported image(s)
  • Confirm files are saved and ready to use

Draw.io XML Structure

File skeleton

<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="drawio" version="26.0.0">
  <diagram name="Page-1">
    <mxGraphModel>
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <!-- user shapes start at id="2" -->
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

Rules:

  • id="0" and id="1" are required root cells — never omit them
  • User shapes start at id="2" and increment sequentially
  • All shapes have parent="1" (unless inside a container — then use container's id)
  • All text uses html=1 in style for proper rendering
  • Never use -- inside XML comments — it's illegal per XML spec and causes parse errors
  • Escape special characters in attribute values: &, <, >, "

Shape types (vertex)

Style keywordUse for
rounded=0plain rectangle (default)
rounded=1rounded rectangle — services, modules
ellipse;circles/ovals — start/end, databases
rhombus;diamond — decision points
shape=mxgraph.aws4.resourceIcon;AWS icons
shape=cylinder3;cylinder — databases
swimlane;group/container with title bar

Required properties

<!-- Rectangle / rounded box -->
<mxCell id="2" value="Label" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
  <mxGeometry x="100" y="100" width="160" height="60" as="geometry" />
</mxCell>

<!-- Cylinder (database) -->
<mxCell id="3" value="DB" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" vertex="1" parent="1">
  <mxGeometry x="350" y="100" width="120" height="80" as="geometry" />
</mxCell>

<!-- Diamond (decision) -->
<mxCell id="4" value="Check?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">
  <mxGeometry x="100" y="220" width="160" height="80" as="geometry" />
</mxCell>

Containers and groups

For architecture diagrams with nested elements, use draw.io's parent-child containment — do not just place shapes on top of larger shapes.

TypeStyleWhen to use
Group (invisible)group;pointerEvents=0;No visual border needed, container has no connections
Swimlane (titled)swimlane;startSize=30;Container needs a visible title bar, or container itself has connections
Custom containerAdd container=1;pointerEvents=0; to any shapeAny shape acting as a container without its own connections

Key rules:

  • Add pointerEvents=0; to container styles that should not capture connections between children
  • Children set parent="containerId" and use coordinates relative to the container
<!-- Swimlane container -->
<mxCell id="svc1" value="User Service" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
  <mxGeometry x="100" y="100" width="300" height="200" as="geometry"/>
</mxCell>
<!-- Child inside container — coordinates relative to parent -->
<mxCell id="api1" value="REST API" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">
  <mxGeometry x="20" y="40" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="db1" value="Database" style="shape=cylinder3;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">
  <mxGeometry x="160" y="40" width="120" height="60" as="geometry"/>
</mxCell>

Connector (edge)

CRITICAL: Every edge mxCell must contain a <mxGeometry relative="1" as="geometry" /> child element. Self-closing edge cells (<mxCell... edge="1"... />) are invalid and will not render. Always use the expanded form.

<!-- Directed arrow — always include rounded, orthogonalLoop, jettySize for clean routing -->
<mxCell id="10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="2" target="3">
  <mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- Arrow with label + explicit entry/exit points to control direction -->
<mxCell id="11" value="HTTP/REST" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="4">
  <mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- Arrow with waypoints — use when edge must route around other shapes -->
<mxCell id="12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3" target="5">
  <mxGeometry relative="1" as="geometry">
    <Array as="points">
      <mxPoint x="500" y="50" />
    </Array>
  </mxGeometry>
</mxCell>

Edge style rules:

  • Always include rounded=1;orthogonalLoop=1;jettySize=auto — these enable smart routing that avoids overlaps
  • Pin exitX/exitY/entryX/entryY on every edge when a node has 2+ connections — distributes lines across the shape perimeter
  • Add <Array as="points"> waypoints when an edge must detour around an intermediate shape
  • Leave room for arrowheads: the final straight segment between the last bend and the target shape must be ≥20px long. If too short, the arrowhead overlaps the bend and looks broken. Fix by increasing node spacing or adding explicit waypoints

Distributing connections on a shape

When multiple edges connect to the same shape, assign different entry/exit points to prevent stacking:

PositionexitX/entryXexitY/entryYUse when
Top center0.50connecting to node above
Top-left0.2502nd connection from top
Top-right0.7503rd connection from top
Right center10.5connecting to node on right
Bottom center0.51connecting to node below
Left center00.5connecting to node on left

Rule: if a shape has N connections on one side, space them evenly (e.g., 3 connections on bottom → exitX = 0.25, 0.5, 0.75)

Color palette (fillColor / strokeColor)

Color namefillColorstrokeColorUse for
Blue#dae8fc#6c8ebfservices, clients
Green#d5e8d4#82b366success, databases
Yellow#fff2cc#d6b656queues, decisions
Orange#ffe6cc#d79b00gateways, APIs
Red/Pink#f8cecc#b85450errors, alerts
Grey#f5f5f5#666666external/neutral
Purple#e1d5e7#9673a6security, auth

Layout tips

Spacing — scale with complexity:

Diagram complexityNodesHorizontal gapVertical gap
Simple≤5200px150px
Medium6–10280px200px
Complex>10350px250px

Routing corridors: between shape rows/columns, leave an extra ~80px empty corridor where edges can route without crossing shapes. Never place a shape in a gap that edges need to traverse.

General rules:

  • Plan a grid before assigning x/y coordinates — sketch node positions on paper/mentally first
  • Group related nodes in the same horizontal or vertical band
  • Use swimlane cells for logical grouping with visible borders
  • Place heavily-connected "hub" nodes centrally so edges radiate outward instead of crossing
  • To force straight vertical connections, pin entry/exit points explicitly on edges: exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0
  • Always center-align a child node under its parent (same center x) to avoid diagonal routing
  • Event bus pattern: place Kafka/bus nodes in the center of the service row, not below — services on either side can reach it with short horizontal arrows (exitX=1 left side, exitX=0 right side), eliminating all line crossings
  • Horizontal connections (exitX=1 or exitX=0) never cross vertical nodes in the same row; use them for peer-to-peer and publish connections

Avoiding edge-shape overlap:

  • Before finalizing coordinates, trace each edge path mentally — if it must cross an unrelated shape, either move the shape or add waypoints
  • For tree/hierarchical layouts: assign nodes to layers (rows), connect only between adjacent layers to minimize crossings
  • For star/hub layouts: place the hub center, satellites around it — edges stay short and radial
  • When an edge must span multiple rows/columns, route it along the outer corridor, not through the middle of the diagram

Export

Commands

# macOS — Homebrew (draw.io in PATH)
draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# macOS — full path (if not in PATH)
/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# Windows
"C:\Program Files\draw.io\draw.io.exe" -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# Linux (headless — requires xvfb-run)
xvfb-run -a draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio

# SVG export
draw.io -x -f svg -o diagram.svg input.drawio

# PDF export
draw.io -x -f pdf -o diagram.pdf input.drawio

Key flags:

  • -x — export mode (required)
  • -f — format: png, svg, pdf, jpg
  • -e — embed diagram XML in output (PNG, SVG, PDF only) — exported file remains editable in draw.io
  • -s — scale: 1, 2, 3 (2 recommended for PNG)
  • -o — output file path (use .drawio.png double extension when embedding)
  • -b — border width around diagram (default: 0, recommend 10)
  • -t — transparent background (PNG only)
  • --page-index 0 — export specific page (default: all)

Checking if draw.io is in PATH

# Try short command first
if command -v draw.io &>/dev/null; then
  DRAWIO="draw.io"
elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then
  DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"
else
  echo "draw.io not found — install from https://github.com/jgraph/drawio-desktop/releases"
fi

Common Mistakes

MistakeFix
Missing id="0" and id="1" root cellsAlways include both at the top of <root>
Shapes not connectedsource and target on edge must match existing shape id values
Export command not found on macOSTry full path /Applications/draw.io.app/Contents/MacOS/draw.io
Linux: blank/error output headlesslyPrefix command with xvfb-run -a
PDF export failsEnsure Chromium is available (draw.io bundles it on desktop)
Background color wrong in CLI exportKnown CLI bug; add --transparent flag or set background via style
Overlapping shapesScale spacing with complexity (200–350px); leave routing corridors
Edges crossing through shapesAdd waypoints, distribute entry/exit points, or increase spacing
Special characters in valueUse XML entities: & < > "
Iteration loop never endsAfter 5 rounds, suggest user open.drawio in draw.io desktop for fine-tuning
Self-closing edge mxCellAlways use expanded form with <mxGeometry> child — self-closing edges won't render
-- inside XML commentsIllegal per XML spec — use single hyphens or rephrase
Arrowhead overlaps bendFinal edge segment before target must be ≥20px — increase spacing or add waypoints

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude

32.06%
按下载量换算85

Codex

31.22%
按下载量换算82

Cursor

19.07%
按下载量换算50

Gemini CLI

8.97%
按下载量换算24

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills