SuperAPI AI 工具集

drawio-aws

部署与运维

查看项目

更新于 10-15 12:37

技能介绍

用途

drawio-aws 用于在 draw.io 中生成正确的 AWS 架构图,适用于用户提出 AWS 架构图需求的场景,例如 VPC/网络、事件驱动、Landing Zone、多可用区(multi-AZ)、无服务器流水线,或任何使用 AWS 图标构建的图。

该技能是一个薄前端;确定性的引擎、校验器和规则位于 drawio-ai-kit 包中,通过 drawio-ai CLI 访问。

前置条件

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——未经用户同意不会改动其全局环境。

主要能力与使用方式

委派构建(宿主支持时优先)

如果宿主能够启动可运行 shell 命令并读取图像的自主子代理(例如 Claude Code 的 Task 工具、通用代理),则整个构建循环在子代理中运行,规则、图标搜索以及每次渲染/修复迭代都不消耗当前对话。若不能(或子代理无法读图),则走内联路径——同样的循环、同样的规则。

启动子代理前,需先确定子代理无法询问的事项:图的范围、输出目录(用户项目下的绝对路径)、文件名。自行运行上述预检。对于多图请求,为每张图并行启动一个子代理,使用不同的文件名。

模型路由:如果宿主允许选择子代理模型,按任务重量路由——当请求匹配规则中 Templates 表的模板时使用快速/廉价层级(Claude Haiku 级,必须支持视觉),因为复现是机械性的,校验器的建议字符串会指导每处修复;自由手绘或新颖架构使用默认的强模型。如果廉价子代理返回 VALIDATE 非 ok 或 ITERATIONS > 3,则在强模型上重新启动一次,再接管内联。多图请求:每张图独立路由。

子代理提示词(需填写每个 <...>):

Build an AWS 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 aws` — 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——子代理已运行视觉自检。如果 VALIDATE 非 ok,通过内联路径接管(build.mjs 和 .drawio 已在返回路径的磁盘上)。

内联路径(无子代理支持)

  1. 共享工作流:
drawio-ai workflow

打印每张图都遵循的 build → validate → render → write-to-project-path 循环。阅读它;它是流程的事实来源。

  1. 领域规则:
drawio-ai principles --mode aws

返回 AWS 规则 + 共享原则 + 目录分类。

  1. 用引擎构建,然后校验 + 渲染:

解析 Kit 的安装目录,然后按绝对路径导入引擎(共享工作流展示了确切模式):

ROOT="$(drawio-ai root)"     # absolute path to the installed Kit

用声明式布局引擎构建(不手写坐标),然后:

drawio-ai validate <file> → drawio-ai render <file> -o <file>.png

(读取 PNG 进行视觉自检)→ 将 .drawio 写入用户项目下的绝对路径(绝不要写入 Kit,绝不要写入 cwd)。

领域说明

容器嵌套顺序:AWS Cloud → Region → VPC → AZ → Subnet → SG。

托管/全局服务(CloudFront、Route 53、S3、DynamoDB、SQS/SNS)位于 VPC 之外——它们不是子网驻留的。目录中的分类颜色是权威的;绝不要重新着色 AWS 图标。

交付前自检

  • 使用布局引擎构建——无手写坐标。
  • drawio-ai validate → ok,无警告,无建议。
  • drawio-ai suggest-layout → 推荐的 archetype 与你的布局匹配;无稀疏(单图标框架)警告。
  • 每个图标都来自 drawio-ai search(分类颜色完好)。
  • drawio-ai render 视觉自检通过。
  • 输出写入用户项目下,而非 Kit。

适用场景与限制

适用场景:需要生成 AWS 架构图的请求,包括 VPC/网络、事件驱动、Landing Zone、多可用区、无服务器流水线等。

限制:依赖 drawio-ai-kit 与 drawio-ai CLI,需先安装;技能本身不修改用户全局环境;不手写坐标,必须使用声明式布局引擎;图标不得重新着色;输出不得写入 Kit 或 cwd。关于收费、价格、平台支持范围等具体信息,资料中暂未提供。