drawio-skill README

项目的 README,来自 github.com/Agents365-ai/drawio-skill。合并为一个 markdown 文件:README.md。

drawio-skill — From Text to Professional Diagrams

License: MIT GitHub stars GitHub forks Latest Release Last Commit

SkillsMP Agent Skills

English · 中文 · 日本語 · 📖 Online Docs

A skill that turns natural language and real system sources into maintainable .drawio architecture models. Beyond generation and export, it incrementally synchronizes without discarding manual layout, projects multiple views from one model, enforces architecture contracts, queries dependencies, simulates failure propagation, and publishes dependency-free interactive walkthroughs. Works with Claude Code, Cursor, Copilot, OpenClaw, Codex, Autohand Code, Hermes, and any agent compatible with the Agent Skills format.

Hero demo: Terraform source becomes an architecture diagram with official icons; the v2 change renders as an updated diagram

✨ Highlights

From a prompt

From real sources

Keep it true over time

Share and restyle

🗺️ Feature Map

drawio-skill feature map — one mind map covering every capability, itself drawn with the skill

A bird's-eye view of everything the skill does — diagram types, import sources, layout engines, styling, export formats, and repurposing — in one map. Fittingly, this map was itself drawn with drawio-skill.

🚀 Installation

1. Install the draw.io desktop CLI

Platform Command
macOS brew install --cask drawio
Windows Download installer
Linux .deb/.rpm from releases; sudo apt install xvfb for headless

Verify with drawio --version (draw.io.exe --version on Windows). Version ≥ 30 recommended — it unlocks Mermaid → .drawio conversion and the ELK --layout pass (both unavailable on ≤ 29). On WSL2 the CLI is the Windows desktop exe reached via /mnt/c — the skill detects this automatically (see troubleshooting). Full recipes in docs/INSTALL_CLI.md.

2. Install the skill

# Any agent (Claude Code, Cursor, Copilot, ...)
npx skills add Agents365-ai/drawio-skill -g

Manual install: clone once to a persistent path, then link the skill subdirectory (Claude Code shown). Use cp -R instead of ln -s on hosts that do not follow symlinks. The destination must not exist yet, so move an existing drawio-skill entry aside first.

mkdir -p ~/src
git clone https://github.com/Agents365-ai/drawio-skill.git ~/src/drawio-skill
mkdir -p ~/.claude/skills
ln -s ~/src/drawio-skill/skills/drawio-skill ~/.claude/skills/drawio-skill

# Copy alternative, for hosts that do not follow symlinks
# mkdir -p ~/.claude/skills
# cp -R ~/src/drawio-skill/skills/drawio-skill ~/.claude/skills/drawio-skill

The skill is the skills/drawio-skill/ subdirectory, so SKILL.md must sit directly under the host entry: <skills root>/drawio-skill/SKILL.md. Do not clone the repository root into a skills directory. Other host roots (Opencode, OpenClaw, Codex, Autohand Code global and project): docs/INSTALL_SKILL.md.

Autohand Code also supports autohand --skill-install for cataloged skills, with --project for workspace-level installs. Until this skill is listed there, use the manual recipe above with the Autohand Code skills root: ~/.autohand/skills/ (global) or <project>/.autohand/skills/ (project).

Also indexed on SkillsMP.

Updating: npx skills update drawio-skill -g (skills CLI) for installer installs; link installs update with git -C ~/src/drawio-skill pull, and copy installs need a manual refresh. See docs/INSTALL_SKILL.md#updates. Release history in CHANGELOG.md.

⚡ Quick Start

After installation, just describe what you want. For example, an ML model:

Draw a Transformer encoder-decoder for machine translation: 6-layer encoder
with self-attention, 6-layer decoder with cross-attention, input embeddings
(batch × 512 × 768), positional encoding, and a final output projection.
Annotate tensor shapes between layers and color-code by layer type.

The skill plans the layout, generates the .drawio XML, exports to your chosen format, self-checks the result, and lets you iterate.

🖼️ Examples

Microservices Architecture: generated from a single natural-language prompt

[!TIP] The diagram above was generated from this single prompt:

Create a microservices e-commerce architecture with Mobile/Web/Admin clients,
API Gateway (auth + rate limiting + routing), Auth/User/Order/Product/Payment
services, Kafka message queue, Notification service, and User DB / Order DB /
Product DB / Redis Cache / Stripe API

The maintained Architecture Studio showcase covers code → IR → .drawio, conflict-aware synchronization that preserves a manually tuned layout, and architecture → policy/views/what-if/accessible Story. Every artifact is regenerated by one script and verified in the test suite.

The skill is designed to route edges cleanly across different topologies, avoiding lines that cross through shapes:

Star topology
Star · 7 nodes
Central message broker with 6 microservices radiating outward, no edge crossings on this example.
Layered flow
Layered · 10 nodes / 4 tiers
E-commerce stack with horizontal and diagonal cross-connections routed via corridors.
Ring cycle
Ring · 8 nodes
CI/CD pipeline with a closed loop and 2 spur branches flowing along the perimeter.

It also speaks Mermaid — standard types (flowchart, mindmap, kanban, gitGraph, timeline…) convert straight to native, editable .drawio. Here's a Kanban board (this project's own roadmap) generated from a few lines of Mermaid:

Kanban board generated by drawio-skill from Mermaid — this project's roadmap across Backlog / Todo / In Progress / Done

Tube-Map Mode restyles a pipeline or journey as a London-Underground-style metro map — coloured lines, octilinear (H/V/45°) routing, and white interchange circles. Here's the skill's own flow (this map is assets/tubemap.json, ~20 lines):

drawio-skill's pipeline drawn as a metro map — Author / Import / Repurpose / Analyze lines meeting at the Auto-layout and .drawio interchange stations

Full walkthrough in docs/USAGE.md.

🗺️ From Real Sources to Diagrams

Beyond hand-authored diagrams, the skill turns existing code, infrastructure, and schemas into diagrams — no manual coordinates. Just ask:

"Visualize the module structure of this Python project" · "Draw the class hierarchy of mypackage"

Auto-generated class hierarchy of Python's logging package — modules boxed, inheritance arrows resolved

↑ Python's logging package as a class hierarchy — one command, modules auto-boxed, every inheritance edge resolved.

Under the hood it runs a bundled extractor → auto-layout → validate pipeline:

# source -> graph JSON -> placed, editable .drawio
python3 scripts/tfimports.py ./infra -o graph.json          # Terraform -> official AWS icons
python3 scripts/autolayout.py graph.json -o architecture.drawio

# drift between two states, then share as one interactive file
python3 scripts/drawiodiff.py v1.drawio v2.drawio -o drift.json
python3 scripts/drawiohtml.py architecture.drawio -o architecture.html

The full toolbox, grouped by stage:

Stage Tools
Import 16 extractors: Python · JS/TS · Go · Rust import graphs, Python class inheritance, Terraform / Kubernetes / docker-compose with official cloud icons, live infra from terraform show -json / docker inspect / kubectl get -o json, SQL DDL → ERD, OpenAPI → API diagram (coloured by HTTP method), AsyncAPI → event-driven architecture diagram, Protobuf → message/service diagram, GraphQL SDL → entity type diagram, GitHub Actions + GitLab CI → DAG
Compare & evolve drawiodiff.py colour-codes drift between two diagrams or two live snapshots (added=green, removed=red, changed=orange); timelapse.py replays git history as an HTML player; prdiff.py renders PR diffs in CI
Repurpose explain.py → Markdown, drawiohtml.py → pan/zoom/search HTML viewer, drawio2pptx.py → deck, svgflow.py → animated SVG, drawio2mermaid.py → diagrams-as-code, runbook.py → clickable triage app, compress.py → exec summary with drill-down, buildup.py → self-drawing player, tubemap.py → metro map
Restyle & enrich restyle.py applies presets by hue remap, relabel.py produces translated twins with layout untouched, heatmap.py shades nodes from a metrics CSV/JSON, edgeports.py un-stacks edges at shape boundaries
Layout & lint autolayout.py (Graphviz placement, orthogonal routing, --tune direction picking, --group containers, transitive reduction: asyncio 149 → 46 edges), seqlayout.py, c4.py, and the deterministic validate.py linter (--score / --strict)

Layout needs Graphviz (brew install graphviz / apt install graphviz) — optional; everything else works without it. Full format + flag reference in references/autolayout.md, every tool in references/toolbox.md. Regenerate, validate (--strict gate) and render headlessly in CI: docs/CI.md.

🧩 Supported Diagram Types

Category Examples Notable features
Architecture microservices, cloud (AWS/GCP/Azure), network topology, deployment Tier-based swimlanes, hub-center strategy
C4 model system context, containers, components Multi-page .drawio, click-to-drill-down links
ML / Deep Learning Transformer, CNN, LSTM, GRU Tensor shape annotations, layer-type color coding
Flowcharts business processes, workflows, decision trees, state machines Semantic shapes (parallelogram I/O, diamond decisions)
UML class diagrams, sequence diagrams Inheritance / composition / aggregation arrows; lifelines + activation boxes
SysML / MBSE block definition (bdd), internal block (ibd), requirement (req), parametric (par) «block» / «requirement» compartments, satisfy/derive/verify edges, native mxgraph.sysml.* ports & flows
BPMN business processes, pools & lanes Native mxgraph.bpmn.* events/tasks/gateways, sequence vs message flows
Network topology LAN/WAN, subnets, DMZ mxgraph.networks.* device shapes, zone containers, link labels; Cisco/rack via shape search
Cross-functional swimlane who-does-what processes, handoffs Pool + role lanes, flowchart vocabulary, orthogonal handoff edges
Data ER diagrams, data flow diagrams (DFD) Table containers, PK/FK notation
Mermaid-authored mind maps, gantt, timeline, journey, pie, sankey, kanban + 20 more Native CLI conversion (≥ v30) — structure only, layout free
Other org charts, wireframes —

Need a real AWS / Azure / GCP / Cisco / Kubernetes / UML / BPMN icon? The skill searches 10,000+ official draw.io shapes for the exact style string — so vendor icons render correctly instead of falling back to a blank box from a guessed shape=mxgraph.* name.

"Add an AWS Lambda wired to an S3 bucket" · "Use the real Kubernetes pod icon"

python3 scripts/shapesearch.py "aws lambda" --limit 5
# → Lambda (77x93)
#   outlineConnect=0;...;shape=mxgraph.aws3.lambda;fillColor=#F58534;...

Serverless AWS architecture built from official draw.io icons resolved by shapesearch.py

↑ A serverless AWS architecture — every icon is the real official draw.io shape resolved by shapesearch.py, not a hand-guessed shape= string.

Covers AWS / Azure / GCP / Cisco / Kubernetes / UML / BPMN / ER / electrical / P&ID and the general shape sets. Hand-writable style cheatsheet + search usage in references/shapes.md.

🤖 AI / LLM Brand Logos

draw.io ships no modern AI/LLM logos, so an LLM-app diagram renders as generic boxes. aiicons.py resolves a brand name to a draw.io image style for any of 321 logos (OpenAI, Claude, Gemini, Mistral, Llama, Cohere, DeepSeek, Qwen, Ollama, LangChain, HuggingFace…) from lobe-icons (MIT), plus 18 data-store brands (Redis, Postgres, MongoDB, Qdrant, Milvus, Supabase…) via simple-icons (CC0) for RAG stacks.

python3 scripts/aiicons.py "claude" --json      # CDN-referenced (default)
python3 scripts/aiicons.py "openai" --embed     # self-contained data URI

Multi-provider LLM app diagram with real AI brand logos resolved by aiicons.py

↑ A multi-provider LLM app — every brand logo resolved by aiicons.py. Icons are referenced from the unpkg CDN by default (network needed at render time); --embed inlines them for offline use. Logos are trademarks of their owners, used for identification only.

🎨 Style Presets

Capture a visual style once, reuse it everywhere. Five presets are built in — default, corporate, handdrawn, colorblind-safe (Okabe-Ito palette), dark — and you can teach the skill your own style from a .drawio file or a flat image:

Draw a microservices architecture using my "corporate" style
Learn my style from ~/diagrams/brand.drawio as "mybrand"

The skill extracts colors, shapes, fonts, and edge style, renders a preview, and only saves the preset after you approve. Full preset-management commands in docs/STYLE_PRESETS.md.

🔄 How it works

Internal workflow

Behind the scenes: check dependencies → plan layout → generate .drawio XML → export draft PNG → self-check + auto-fix (up to 2 rounds) → show to user → 5-round feedback loop until approved → final export.

🆚 Comparison

vs Other draw.io Skills & Tools

Feature drawio-skill jgraph/drawio-mcp (official)
stars
bahayonghang/drawio-skills
stars
GBSOSS/ai-drawio
stars
Approach Pure SKILL.md + optional MCP server MCP servers / Claude Code plugin / Project YAML DSL + CLI (MCP optional) Claude Code plugin
Dependencies draw.io desktop only draw.io desktop draw.io desktop (MCP optional) draw.io plugin + browser
Multi-agent ✅ 6 platforms ⚠️ MCP hosts (Claude, Cursor, VS Code) ✅ Claude / Gemini / Codex ❌ Claude Code only
Self-check + auto-fix ✅ 2-round (reads PNG) ❌ ✅ validation + strict mode ❌ screenshot only
Iterative review ✅ 5-round loop ❌ generate once ✅ 3 workflows ❌
Diagram presets ✅ 7 types ❌ ✅ paper-mode classifier ❌
Mermaid authoring ✅ 28 types (CLI ≥ 30) ✅ ❌ ❌
ML/DL diagrams ✅ tensor shapes, layer colors ❌ ❌ ❌
Color system ✅ 7-color semantic ❌ ✅ 6 themes ❌
Official shape search ✅ 10k+ shapes (local) ✅ 10k+ shapes (MCP) ❌ ❌
AI/LLM brand logos ✅ 321 + 18 data-store ❌ ❌ ❌
Browser fallback ✅ diagrams.net URL (viewer + editable) ✅ diagrams.net URL (plugin) + inline preview ✅ via optional MCP ✅ diagrams.net viewer (primary)
Zero-config ✅ copy skills/drawio-skill/ ✅ ✅ desktop-only mode ❌ needs plugin install

Using the official jgraph plugin? jgraph/drawio-mcp now ships an official Claude Code plugin (/plugin install drawio@drawio) that also generates .drawio and exports via the desktop CLI. drawio-skill is complementary — reach for it when you want the code / IaC / SQL / OpenAPI / AsyncAPI / Protobuf importers, AI-brand logos, deterministic sequence & C4 generators, self-check + review loop, and the interactive HTML viewer, all from a single SKILL.md with no MCP server.

Full comparison + key-advantages summary in docs/COMPARISON.md (with audit timestamp).

🎯 When to use (and when not to)

Good fit:

Reach for a sibling skill instead when you need:

Part of the Agents365-ai diagram-skill family — pick the right tool for the job:

Skill Style Best for
excalidraw-skill Hand-drawn / sketchy Whiteboard mockups, informal diagrams
mermaid-skill Text-based, auto-layout README-embeddable, version-control friendly
plantuml-skill UML-focused Class / sequence diagrams in CI pipelines
tldraw-skill Whiteboard collaboration Casual sketches, FigJam-style boards

💖 Support

If this project helps you, consider supporting the author:

WeChat Pay
WeChat Pay
Alipay
Alipay
Buy Me a Coffee
Buy Me a Coffee
Tip Author
Tip Author

👤 Author

Agents365-ai

📄 License

MIT

drawio-skill (Agents365-ai/drawio-skill)

正在搜索数据库…

这是什么?这是一个智能体技能,能把大白话描述和真实的系统来源——代码、Terraform、Kubernetes、SQL、OpenAPI——变成可编辑的 .drawio 架构图,之后还能保持同步、自动检查并导出。
它是一个独立的画图软件,还是装在我的编程智能体里的东西?不是独立软件——它是一个可移植的 Agent Skills 包,外加一个 diagramctl 命令行工具,运行在你的编程智能体里。你用大白话描述想要什么,这个技能就会规划、生成、排版并检查这张图。
我该怎么把它跑起来?两步:先安装 draw.io 桌面版命令行工具(macOS 上用 brew install --cask drawio,Windows 上用安装包,Linux 上用 .deb/.rpm 包再加 xvfb),然后把技能克隆到你的智能体里。之后你只要描述想要什么就行。
我能把它接进哪些编程智能体?我的电脑还需要装什么?支持 Claude Code、Cursor、Copilot、OpenClaw、Codex、Autohand Code、Hermes,以及任何兼容 Agent Skills 的智能体。核心工作流只需要 Python;draw.io 命令行工具(建议 v30 及以上)只用于原生导出,Graphviz 可以辅助自动排版。
开始之前,版本或平台方面有什么要注意的坑吗?建议使用 draw.io 30 或更高版本——Mermaid 转 .drawio 和 ELK 排版在 29 及更早版本上跑不了。在 WSL2 上,这个技能会通过 /mnt/c 访问 Windows 桌面版的 exe,并自动检测到它。
画图需要联网或者 API 密钥吗?不需要——核心语义工作流默认离线运行,内置的 MCP 服务器只用 Python 标准库,不依赖 mcp 包。AI 能力来自承载这个技能的编程智能体本身。
它能画哪些类型的图?有十一种预设:ERD、UML 类图、时序图、C4、架构图、机器学习/深度学习、流程图、SysML(BDD/IBD/需求图/参数图)、BPMN、网络拓扑和跨职能泳道图。C4 会生成系统上下文 → 容器 → 组件的多页图集,并带有逐层下钻的链接。
它能根据我现有的代码和基础设施画图,而不只是根据我的文字描述吗?可以——13 个提取器覆盖 Python、JS/TS、Go 和 Rust 的导入关系图、Python 类继承结构、Terraform、Kubernetes 和 docker-compose 资源、SQL DDL、OpenAPI 规范以及 CI 流水线。基础设施即代码的图会使用官方的 AWS、Azure、GCP 和 K8s 图标,这些都是从真实参考资料推导出来的。
如果我手动调过一张图,代码改动后重新生成会不会把我的排版弄丢?不会——diagramctl sync 只更新有变化的节点和关系,保留你手动调整的坐标、样式和标注,被删除的内容默认也会保留下来供你审查。
生成的图真的会好看、整洁吗?它会自查——读取自己输出的 PNG,自动修复元素重叠、文字被裁切和连线堆叠的问题(最多 2 轮),你还可以通过对话继续微调,最多 5 轮。排版按网格对齐,连线的走线也会避开节点。
除了 .drawio 文件,我还能导出成什么?自包含的交互式 HTML 查看器(分享文件即可,不需要 draw.io 或服务器)、16:9 的 PowerPoint 演示文稿(每页一张图)、GitHub 原生就能渲染的 Mermaid 流程图,以及带动画的 SVG 数据流图。
它能在 CI 里自动检查我的架构规则吗?可以。你用 YAML/JSON 写 Diagram-as-Test 规则——比如禁止前端直连数据库、禁止循环依赖、禁止孤立节点、必须有可观测性、信任边界上的协议要求等。官方的 GitHub Action 会在每个 PR 上执行这些检查,不需要安装 draw.io、Xvfb 或 Graphviz,还能在 PR 里给出可视化的差异对比。
大小
6.7 MB
星标
10.8K
时长
9个月
提交 · 90 天