Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.
Python agent-skillsarchitecturearchitecture-diagramasyncapibpmnc4-modelclaude-codediagramdiagrams-as-codedrawioflowchartgithub-actionsgraphqlimage-to-diagramkubernetesmcp-serverprotobufsysmlterraformuml
Unarchive project, add comparison tables, and enhance SKILL.md
Agents365-ai10e82d6fec9b
diff --git a/README.md b/README.mdindex e2781f8..21e8192 100644--- a/README.md+++ b/README.md@@ -1,27 +1,7 @@-# drawio-skill (Archived)--> **This project has been archived.** Claude Code can already generate draw.io XML natively — a dedicated skill adds little value. See [Alternative](#alternative) below for a simpler approach.+# drawio-skill[中文文档](README_CN.md)-## Alternative--Instead of installing this skill, add these lines to your `CLAUDE.md` (global or project-level):--```markdown-## Draw.io-- Export: `/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -s 2 input.drawio`-- Default style: rounded=1, spacing=15, edge routing orthogonal-```--That's it. Claude Code already knows draw.io XML syntax, layout principles, and diagram design — no skill needed.-------*Original README below for reference.*------## What it does- Generates `.drawio` XML files from natural language descriptions@@ -133,6 +113,48 @@ CI/CD pipeline with a closed loop and 2 spur branches. Edges flow along the peri+## Comparison++### vs Native Claude Code (no skill)++| Feature | Native Claude Code | This skill |+|---------|-------------------|------------|+| Generate draw.io XML | Yes — Claude knows the format | Yes |+| Self-check after export | No | Yes — reads PNG and auto-fixes 6 issue types |+| Iterative review loop | No — must manually re-prompt | Yes — targeted edits, 5-round safety valve |+| Proactive triggers | No — only when explicitly asked | Yes — auto-suggests when 3+ components |+| Layout guidelines | None — varies by run | Complexity-scaled spacing, routing corridors, hub placement |+| Color palette | Random/inconsistent | 7-color semantic system (blue=services, green=DB, purple=auth…) |+| Edge routing rules | Basic | Pin entry/exit points, distribute connections, waypoint corridors |+| Container/group patterns | None | Swimlane, group, custom container with parent-child nesting |+| Embed diagram in export | No | Yes — `--embed-diagram` keeps exported PNG/SVG/PDF editable |+| Chinese language triggers | No | Yes — "画图", "架构图", "流程图" |++### vs Other draw.io Skills & Tools++| Feature | This skill | [jgraph/drawio-mcp](https://github.com/jgraph/drawio-mcp) (official, 1.3k⭐) | [bahayonghang/drawio-skills](https://github.com/bahayonghang/drawio-skills) (60⭐) | [GBSOSS/ai-drawio](https://github.com/GBSOSS/ai-drawio) (63⭐) | [ekusiadadus/draw-mcp](https://github.com/ekusiadadus/draw-mcp) (24⭐) |+|---------|-----------|---------------|-------------------|--------------|----------------|+| **Approach** | Pure SKILL.md | SKILL.md / MCP / Project | YAML DSL + MCP | Plugin + browser | SKILL.md + validator |+| **Dependencies** | draw.io desktop only | draw.io desktop | MCP server (`npx`) | Browser + local server | Python CLI |+| **Self-check** | ✅ 2-round auto-fix | ❌ | ❌ | ❌ screenshot | ❌ |+| **Iterative review** | ✅ 5-round loop | ❌ generate once | ✅ 3 workflows | ❌ | ❌ |+| **Layout guidance** | ✅ complexity-scaled | ✅ basic spacing | ❌ relies on MCP | ❌ | ❌ |+| **Color system** | ✅ 7-color semantic | ❌ | ✅ 5 themes | ❌ | ❌ |+| **Container/group** | ✅ swimlane + group | ✅ detailed | ❌ | ❌ | ❌ |+| **Embed diagram** | ✅ `--embed-diagram` | ✅ | ❌ | ❌ | ❌ |+| **Edge routing** | ✅ corridors + waypoints | ✅ arrowhead rules | ❌ | ❌ | ✅ validation |+| **Chinese support** | ✅ triggers + docs | ❌ | ❌ | ✅ | ❌ |+| **XML validation** | Self-check (visual) | ❌ | ❌ | ❌ | ✅ 31 rules, CI hooks |+| **Cloud icons** | AWS basic | ❌ | ✅ AWS/GCP/Azure/K8s | ❌ | ❌ |+| **Zero-config** | ✅ copy SKILL.md | ✅ | ❌ needs `npx` | ❌ needs plugin install | ❌ needs Python |++### Key advantages of this skill++1. **Self-check + iterative loop** — the only pure-SKILL.md solution that reads its own output and auto-fixes before showing the user, then supports multi-round refinement+2. **Zero-config, zero-dependency** — just one `SKILL.md` file + draw.io desktop. No MCP server, no Python, no Node.js, no browser+3. **Production-grade layout** — complexity-scaled spacing, routing corridors, hub-center strategy, connection distribution rules+4. **Full Chinese support** — proactive triggers ("画图", "架构图"), bilingual documentation+## Files- `SKILL.md` — **the only required file**. This is what Claude Code loads as the skill instructions.diff --git a/README_CN.md b/README_CN.mdindex ffdccc6..c7e30a3 100644--- a/README_CN.md+++ b/README_CN.md@@ -1,27 +1,7 @@-# drawio-skill(已归档)--> **本项目已归档。** Claude Code 本身就能生成 draw.io XML,专门的 skill 意义不大。替代方案见下方 [替代方案](#替代方案)。+# drawio-skill[English](README.md)-## 替代方案--不需要安装这个 skill,只需在你的 `CLAUDE.md`(全局或项目级)中加几行:--```markdown-## Draw.io-- Export: `/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -s 2 input.drawio`-- Default style: rounded=1, spacing=15, edge routing orthogonal-```--就这样。Claude Code 已经掌握 draw.io XML 语法、布局原则和图表设计,不需要额外的 skill。-------*以下为原始 README,仅供参考。*------## 功能说明- 根据自然语言描述生成 `.drawio` XML 文件@@ -134,6 +114,48 @@ CI/CD 流水线,包含闭合回路和 2 个分支。线条沿矩形外围流+## 对比++### 与原生 Claude Code(无 skill)对比++| 功能 | 原生 Claude Code | 本 skill |+|------|-----------------|---------|+| 生成 draw.io XML | 是 — Claude 本身了解格式 | 是 |+| 导出后自检 | 否 | 是 — 读取 PNG 自动修复 6 类问题 |+| 迭代反馈循环 | 否 — 需手动重新提问 | 是 — 定向编辑,5 轮安全阀 |+| 主动触发 | 否 — 仅在明确要求时 | 是 — 3+ 组件时自动建议画图 |+| 布局规范 | 无 — 每次结果不一致 | 按复杂度分级间距、路由走廊、hub 居中策略 |+| 配色方案 | 随机/不一致 | 7 色语义系统(蓝=服务、绿=数据库、紫=安全…) |+| 连线路由规则 | 基础 | 锚点分配、连接分布、走廊绕行 |+| 容器/分组 | 无 | Swimlane、Group、自定义容器 + 父子嵌套 |+| 嵌入式导出 | 否 | 是 — `--embed-diagram` 保持导出文件可编辑 |+| 中文支持 | 否 | 是 — "画图"、"架构图"、"流程图" |++### 与其他 draw.io Skills / 工具对比++| 功能 | 本 skill | [jgraph/drawio-mcp](https://github.com/jgraph/drawio-mcp)(官方,1.3k⭐) | [bahayonghang/drawio-skills](https://github.com/bahayonghang/drawio-skills)(60⭐) | [GBSOSS/ai-drawio](https://github.com/GBSOSS/ai-drawio)(63⭐) | [ekusiadadus/draw-mcp](https://github.com/ekusiadadus/draw-mcp)(24⭐) |+|---------|-----------|---------------|-------------------|--------------|----------------|+| **方式** | 纯 SKILL.md | SKILL.md / MCP / Project | YAML DSL + MCP | 插件 + 浏览器 | SKILL.md + 验证器 |+| **依赖** | 仅 draw.io 桌面版 | draw.io 桌面版 | MCP 服务(`npx`) | 浏览器 + 本地服务 | Python CLI |+| **自检** | ✅ 2 轮自动修复 | ❌ | ❌ | ❌ 截图 | ❌ |+| **迭代审查** | ✅ 5 轮循环 | ❌ 一次生成 | ✅ 3 种工作流 | ❌ | ❌ |+| **布局指南** | ✅ 按复杂度分级 | ✅ 基础间距 | ❌ 依赖 MCP | ❌ | ❌ |+| **配色系统** | ✅ 7 色语义 | ❌ | ✅ 5 种主题 | ❌ | ❌ |+| **容器/分组** | ✅ swimlane + group | ✅ 详细 | ❌ | ❌ | ❌ |+| **嵌入式导出** | ✅ `--embed-diagram` | ✅ | ❌ | ❌ | ❌ |+| **连线路由** | ✅ 走廊 + waypoints | ✅ 箭头间距规则 | ❌ | ❌ | ✅ 验证 |+| **中文支持** | ✅ 触发词 + 文档 | ❌ | ❌ | ✅ | ❌ |+| **XML 验证** | 自检(视觉) | ❌ | ❌ | ❌ | ✅ 31 条规则、CI 集成 |+| **云图标** | AWS 基础 | ❌ | ✅ AWS/GCP/Azure/K8s | ❌ | ❌ |+| **零配置** | ✅ 复制 SKILL.md | ✅ | ❌ 需要 `npx` | ❌ 需安装插件 | ❌ 需要 Python |++### 本 skill 核心优势++1. **自检 + 迭代循环** — 唯一纯 SKILL.md 方案中能自动读取输出、修复问题、支持多轮优化的+2. **零配置、零依赖** — 仅需一个 `SKILL.md` 文件 + draw.io 桌面版,无需 MCP、Python、Node.js、浏览器+3. **专业级布局** — 按复杂度分级间距、路由走廊、hub 居中、连接分布规则+4. **完整中文支持** — 主动触发词("画图"、"架构图")、双语文档+## 文件说明- `SKILL.md` — **唯一必需的文件**,Claude Code 加载的 skill 指令。diff --git a/SKILL.md b/SKILL.mdindex 1b5ea48..cf8c667 100644--- a/SKILL.md+++ b/SKILL.md@@ -11,6 +11,8 @@ Generate `.drawio` XML files and export to PNG/SVG/PDF/JPG locally using the nat**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", "架构图", "流程图"@@ -126,8 +128,10 @@ Once the user approves:**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"`+- 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)@@ -160,8 +164,38 @@ Once the user approves:</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.++| Type | Style | When 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 container** | Add `container=1;pointerEvents=0;` to any shape | Any 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**++```xml+<!-- 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.+```xml<!-- 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">@@ -187,6 +221,7 @@ Once the user approves:- **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@@ -250,16 +285,16 @@ When multiple edges connect to the same shape, assign different entry/exit point```bash# macOS — Homebrew (draw.io in PATH)-draw.io -x -f png -s 2 -o diagram.png input.drawio+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 -s 2 -o diagram.png input.drawio+/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 -s 2 -o diagram.png input.drawio+"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 -s 2 -o diagram.png input.drawio+xvfb-run -a draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio# SVG exportdraw.io -x -f svg -o diagram.svg input.drawio@@ -271,8 +306,11 @@ 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+- `-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@@ -302,3 +340,6 @@ fi| Edges crossing through shapes | Add waypoints, distribute entry/exit points, or increase spacing || Special characters in `value` | Use XML entities: `&` `<` `>` `"` || Iteration loop never ends | After 5 rounds, suggest user open .drawio in draw.io desktop for fine-tuning |+| Self-closing edge `mxCell` | Always use expanded form with `<mxGeometry>` child — self-closing edges won't render |+| `--` inside XML comments | Illegal per XML spec — use single hyphens or rephrase |+| Arrowhead overlaps bend | Final edge segment before target must be ≥20px — increase spacing or add waypoints |