drawio-skill README

The project's README from github.com/Agents365-ai/drawio-skill. As one markdown file: README.md.

drawio-skill — From Text to Professional Diagrams

License: MIT GitHub stars GitHub forks Latest Release Last Commit

SkillsMP Claude Code Plugin 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.

Microservices Architecture — generated from a single natural-language prompt

✨ Highlights

🗺️ 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.

🖼️ Examples

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.

[!TIP] The hero image 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 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.

🚀 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. 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/365-skills -g
# Claude Code plugin marketplace
> /plugin marketplace add Agents365-ai/365-skills
> /plugin install drawio
# Manual install
git clone https://github.com/Agents365-ai/drawio-skill.git \
  ~/.claude/skills/drawio-skill

# Autohand Code global install
git clone https://github.com/Agents365-ai/drawio-skill.git \
  ~/.autohand/skills/drawio-skill

# Autohand Code project-level install
git clone https://github.com/Agents365-ai/drawio-skill.git \
  .autohand/skills/drawio-skill

Autohand Code also supports autohand --skill-install for cataloged skills, with --project for workspace-level installs. Until this skill is listed there, use the direct clone path above.

Also indexed on SkillsMP.

Updating: /plugin update drawio (Claude Code), skills update drawio-skill (SkillsMP), or git pull for manual installs — 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.

🗺️ Visualize Code & Infrastructure

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:

# Import graph — Python / JS-TS / Go / Rust
python3 scripts/pyimports.py   myproject --group -o graph.json
python3 scripts/jsimports.py   ./src     --group -o graph.json
python3 scripts/goimports.py   ./module  --group -o graph.json
python3 scripts/rustimports.py ./crate   --group -o graph.json

# Python class-inheritance hierarchy
python3 scripts/pyclasses.py   mypackage --group -o graph.json

# Infrastructure as Code — official cloud icons resolved automatically
python3 scripts/tfimports.py   ./infra      -o graph.json   # Terraform → AWS/Azure/GCP icons
python3 scripts/k8simports.py  ./manifests  -o graph.json   # K8s YAML/JSON → kind icons
python3 scripts/composeimports.py compose.yml -o graph.json # services + named volumes

# Live infrastructure — draw what's ACTUALLY running / deployed
terraform show -json          | python3 scripts/tfstate.py -      -o graph.json  # deployed cloud
docker inspect $(docker ps -q)| python3 scripts/dockerimports.py -  -o graph.json  # running containers
kubectl get all,ing,cm,secret,pvc -o json | python3 scripts/k8simports.py - -o graph.json  # live cluster

# Data & interactions
python3 scripts/sqlerd.py      schema.sql   -o graph.json   # SQL DDL → ER diagram
python3 scripts/ciimports.py . -o graph.json              # GitHub Actions + GitLab CI -> pipeline DAG
python3 scripts/openapiimports.py openapi.yaml -o graph.json # OpenAPI/Swagger → API diagram (by method)
python3 scripts/seqlayout.py   seq.json  -o sequence.drawio # sequence diagram, direct to .drawio
python3 scripts/c4.py          c4.json   -o c4.drawio       # C4 model, multi-page + drill-down

# Diff two diagrams / snapshots → colour-coded "what changed"
python3 scripts/drawiodiff.py old.drawio new.drawio -o graph.json # +added -removed ~changed

# Architecture time-lapse → self-contained HTML player of how a codebase grew
python3 scripts/timelapse.py src --importer pyimports # → architecture-evolution.html

# Reverse: describe an existing .drawio as structured Markdown (README / PR summary)
python3 scripts/explain.py    architecture.drawio -o architecture.md

# Diagram → PowerPoint deck (one page per slide; C4 model → presentation)
python3 scripts/drawio2pptx.py c4.drawio -o c4.pptx   # needs: pip install python-pptx

# Interactive HTML viewer — pan/zoom/search/tabs + working drill-down links, one file
python3 scripts/drawiohtml.py c4.drawio -o c4.html

# Animated data-flow SVG — edges "flow" (marching ants); renders on GitHub
python3 scripts/svgflow.py    architecture.drawio -o flow.svg

# Reverse: .drawio → Mermaid flowchart (diagrams-as-code GitHub renders)
python3 scripts/drawio2mermaid.py architecture.drawio --fenced -o arch.md

# Language variant: extract labels → translate values → apply (layout untouched)
python3 scripts/relabel.py architecture.drawio --extract -o labels.json
python3 scripts/relabel.py architecture.drawio --map labels.json -o architecture_cn.drawio

# Re-theme an existing .drawio with a style preset (e.g. dark mode)
python3 scripts/restyle.py architecture.drawio --preset dark

# Colour an existing .drawio by data → cost / latency / traffic heat map
python3 scripts/heatmap.py    architecture.drawio -m latency.csv --size -o hot.drawio

# any extractor → auto-layout → editable .drawio
python3 scripts/autolayout.py  graph.json -o diagram.drawio

# Image → editable .drawio — your vision extracts the graph JSON, this rebuilds it
python3 scripts/raster2drawio.py whiteboard-graph.json -o out.drawio

# Watch a diagram build itself, node by node → HTML player (+ optional GIF)
python3 scripts/buildup.py architecture.drawio --gif build.gif  # → buildup.html

# Big diagram → boardroom exec summary (clustered) + click-to-drill-down to full
python3 scripts/compress.py  big.drawio -o exec.drawio

# Decision-tree flowchart → click-through HTML triage runbook (no draw.io CLI needed)
python3 scripts/runbook.py   triage.drawio -o triage.html

# CI: render base/head/diff PNGs + Markdown report for every .drawio a PR changed
python3 scripts/prdiff.py --base origin/main --head HEAD -o drawio-pr/report.md

# Tube-Map Mode — restyle a pipeline / journey as a metro / subway map
python3 scripts/tubemap.py metro.json -o metro.drawio
Piece What it does
13 extractors import graphs for Python · JS/TS · Go · Rust, Python class inheritance, Terraform / Kubernetes / docker-compose resource graphs (official cloud icons), SQL DDL → ERD, OpenAPI / Swagger → API diagram (operations coloured by HTTP method + schemas), CI pipelines → DAG (GitHub Actions needs: graphs + GitLab stages, with triggers, matrix sizes, reusable-workflow calls), and live infra from terraform show -json / docker inspect / kubectl get -o json (draw what's actually deployed)
Diagram diff drawiodiff.py compares two .drawio (or two live snapshots) into one colour-coded graph — added=green, removed=red, changed=orange — so you can see architecture / infra drift at a glance
Language variants relabel.py swaps every label via a JSON map with layout/styles/ids untouched — --extract dumps all labels, translate the values, --map applies them. One diagram → EN + CN twins for bilingual docs
Re-theme restyle.py applies a style preset (built-in dark/corporate/… or your own) to an existing .drawio — palette remapped by hue so same-colored nodes stay grouped; layout and edge routing untouched
Metric heat map heatmap.py recolours an existing .drawio from a CSV/JSON of per-node values — cost / latency / traffic / error-rate shaded low→high on a gradient (optional size-by-value + legend), matched by cell id or label
Architecture time-lapse timelapse.py re-runs an importer across a repo's git history and assembles a self-contained HTML player — watch modules & edges appear over time (▶ play / ‹ › step)
Diagram → Markdown explain.py reverses a .drawio into a structured description — components by tier, relations, per-page for C4 — for dropping an architecture summary into a README or PR
Interactive viewer drawiohtml.py publishes a .drawio as one self-contained HTML — page tabs, drag-pan, wheel-zoom, node search, and a C4 model's drill-down links keep working. Share the file; no draw.io, no server
Diagram → PowerPoint drawio2pptx.py turns a multi-page diagram into a 16:9 deck (one page per slide, page name as title) — a C4 model becomes a ready-to-present slideshow
Animated data-flow svgflow.py makes a diagram's edges flow (marching-ants animation along each arrow) — a self-contained looping SVG that renders on GitHub, in docs, or as a slide background
Diagram → Mermaid drawio2mermaid.py converts a .drawio into a Mermaid flowchart (containers → subgraphs, edge labels kept) — paste it into Markdown as diagrams-as-code that GitHub renders natively
Sequence engine seqlayout.py computes lifeline / activation-bar / arrow geometry from a message list — no Graphviz, no hand placement
Auto-layout Graphviz places nodes and routes orthogonal edges around them — removes the manual-coordinate ceiling for large graphs. --tune tries both directions and keeps the more readable one
Transitive reduction drops edges implied by a longer path, turning a dense hairball into a traceable graph (asyncio: 149 → 46 edges)
Nested containers --group boxes modules by sub-package, nested for

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

Searching Database…

这是什么?这是一个智能体技能,能把大白话描述和真实的系统来源——代码、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 里给出可视化的差异对比。
Size
6.5 MB
Stars
10.2K
Age
7mo
Commits · 90 Days