关于 drawio-azure
drawio-azure 是用于在 draw.io 中制作 Azure 架构图的技能,适合记录云系统的用户和 Agent。它依靠 drawio-ai-kit 布局引擎与 CLI 构建、验证并渲染图表。
主要功能
- 01制作 Azure 架构图
- 02声明式自动布局
- 03验证并渲染图表
- 04Azure 层级与资源放置规则
适用场景
- 01梳理 Azure 资源层级
- 02绘制 VNet、子网和资源组
- 03检查并渲染 Azure 架构图
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ sparklabx/ drawio-ai-kit --skill drawio-azure安装后在 Claude Code 中输入/drawio-azure确认已加载。
详细介绍
Draw.io Azure
在 draw.io 中生成准确的 Azure 架构图。此技能是一个轻量级前端;确定性引擎、验证器和规则位于 drawio-ai-kit 包中,通过 drawio-ai CLI 调用。
0. 预检 — 必须已安装 CLI
command -v drawio-ai >/dev/null 2>&1 || echo "Install the Kit first: npm i -g github:sparklabx/drawio-ai-kit"
如果 drawio-ai 不在 PATH 中,请停止并告知用户运行
npm i -g github:sparklabx/drawio-ai-kit。切勿自行运行 npm i -g — 未经用户同意,绝不修改用户的全局环境。
1. 委托构建(当运行环境支持时优先采用)
如果你的运行环境可以启动能运行 shell 命令且能读取图像的自主子 Agent(例如 Claude Code 的 Task 工具、通用 Agent),就在子 Agent 中运行整个构建循环 — 规则、图标搜索以及每次渲染/修复迭代都不会占用本次对话的开销。如果不支持(或子 Agent 无法读取图像),请跳转到下方的内联路径 — 循环和规则相同。
启动前,先确定子 Agent 无法询问的内容:图表范围、输出目录(用户项目下的绝对路径)和文件名。自行运行上述预检。对于多图请求,请为每张图并行启动一个子 Agent,并使用不同的文件名。
模型路由 — 如果运行环境允许选择子 Agent 的模型,请根据任务复杂度进行路由:当请求符合规则中 Templates 表的模板时,使用快速/低成本层级(Claude Haiku 级 — 必须支持视觉);此类复现过程机械化,验证器的建议字符串会指导每次修复。对于自由绘制或新颖的架构,使用你的默认强模型。如果低成本子 Agent 返回 VALIDATE 不通过或 ITERATIONS > 3,请在接管内联处理前,用强模型重新启动一次。多图请求:分别为每张图路由。
子 Agent 提示词(填写每个 <...>):
Build an Azure architecture .drawio diagram with the drawio-ai CLI.
Request: <user's request + clarifications, verbatim>
Output: <ABS_PROJECT_DIR>/<NAME>.drawio — never write inside the Kit, never into cwd.
Follow exactly:
1. Set ROOT="$(drawio-ai root)". Read $ROOT/docs/api-cheatsheet.md — the full layout-engine
API in one file; never read library source.
2. Run `drawio-ai workflow` and `drawio-ai principles --mode azure` — the source of
truth. (Fallback if a command is blocked: read $ROOT/rules/*.md directly.)
3. Look up every icon with ONE batched `drawio-ai search "a, b, c"`; never recolor icons.
4. Scaffold, don't write: `drawio-ai scaffold --list`, pick the closest template, then
`drawio-ai scaffold <name>.mjs -o <dir>/build.mjs` — the script arrives runnable
(absolute imports, self-validating, self-rendering with an issues list). Edit only the
deltas. If no template is close AND you'd change more than half of it, Write a new
script instead (keep the scaffold's self-check tail). Layout engine only
(group/frame/grid/icon/box + renderTree), NO hand-written coordinates.
5. Each `node build.mjs` run prints validate JSON AND the render's machine-readable
`issues` list. Fix from THAT checklist — all issues in one Edit round — then re-run.
Loop until issues is empty.
6. Only when issues is empty: Read the PNG once as final visual confirmation (list any
remaining visual problems, fix ALL in one round). Target <= 2 PNG reads total. Then
render once WITHOUT --check for the final deliverable PNG.
Do NOT invoke any drawio skill — this prompt already contains the full procedure.
Do not ask questions — make the standard choice and record it under ASSUMPTIONS.
Return EXACTLY this block, nothing else:
DRAWIO: <absolute path to .drawio>
PNG: <absolute path to .png>
VALIDATE: <verbatim final validate JSON>
ICONS: <comma-separated icon names used>
ITERATIONS: <number of render/fix cycles>
SUMMARY: <one sentence describing the diagram>
ASSUMPTIONS: <choices made without asking, or "none">
将 DRAWIO、PNG 和 SUMMARY 原样转交给用户;请勿在本次对话中重新读取 .drawio 或 PNG — 子 Agent 已完成视觉自检。如果 VALIDATE 不通过,请通过内联路径接管处理(返回路径中的 build .mjs 和 .drawio 均已保存在磁盘上)。
内联路径(不支持子 Agent)
1. 共享工作流
drawio-ai workflow
此内容会输出每张图都要遵循的构建 → 验证 → 渲染 → 写入项目路径循环。请阅读;它是流程的权威依据。
2. 领域规则
drawio-ai principles --mode azure
返回 Azure 规则、共享原则和目录类别。
3. 使用引擎构建,然后验证并渲染
确定 Kit 的安装目录,然后通过绝对路径 import 引擎(共享工作流展示了准确的模式):
ROOT="$(drawio-ai root)" # absolute path to the installed Kit
使用声明式布局引擎构建(不得手写坐标),然后:
drawio-ai validate <file> → drawio-ai render <file> -o <file>.png(Read
PNG 以完成视觉自检)→ 将 .drawio 写入用户项目下的绝对路径(绝不写入 Kit 或 cwd)。
领域说明
层级:Management Group → Subscription → Resource Group → VNet → Subnet。
Azure 资源部署到资源组中;VNet 的范围限定为订阅。
全局服务(Azure DNS、Azure Front Door、Entra ID)位于 VNet 之外。
自检(交付前)
- 使用布局引擎构建 — 未手写坐标。
-
drawio-ai validate→ 通过,无警告、无建议。 -
drawio-ai suggest-layout→ 推荐的原型与布局相符;无稀疏性(一图标框架)警告。 - 每个图标都来自
drawio-ai search(类别颜色保持不变)。 -
drawio-ai render视觉自检通过。 - 输出已写入用户项目,而非 Kit。