$npx -y skills add sparklabx/drawio-ai-kit --skill drawio-awsUse when the user asks for an AWS architecture diagram — VPC/networking, event-driven, landing zone, multi-AZ, serverless pipeline, or any diagram built with AWS service icons. Builds with the declarative layout engine using ground-truth mxgraph.aws4 stencils, validates (stencils
| 1 | # Draw.io AWS |
| 2 | |
| 3 | Produce correct AWS architecture diagrams in draw.io. This skill is a thin |
| 4 | frontend; the deterministic engine, validator, and rules live in the |
| 5 | `drawio-ai-kit` package, reached via the `drawio-ai` CLI. |
| 6 | |
| 7 | ## 0. Preflight — the CLI must be installed |
| 8 | |
| 9 | ```bash |
| 10 | command -v drawio-ai >/dev/null 2>&1 || echo "Install the Kit first: npm i -g github:sparklabx/drawio-ai-kit" |
| 11 | ``` |
| 12 | |
| 13 | If `drawio-ai` is **not** on PATH, stop and tell the user to run |
| 14 | `npm i -g github:sparklabx/drawio-ai-kit`. **Never run `npm i -g` yourself** — nothing mutates the |
| 15 | user's global environment without their say-so. |
| 16 | |
| 17 | ## 1. Delegate the build (preferred when your harness supports it) |
| 18 | |
| 19 | If your harness can spawn autonomous subagents that run shell commands AND read |
| 20 | images (e.g. Claude Code's Task tool, a general-purpose agent), run the whole |
| 21 | build loop in a subagent — the rules, icon searches, and every render/fix |
| 22 | iteration then cost this conversation nothing. If it can't (or the subagent |
| 23 | can't read images), skip to **Inline path** below — same loop, same rules. |
| 24 | |
| 25 | **Before spawning**, resolve what the subagent cannot ask about: diagram scope, |
| 26 | output directory (absolute path under the user's project), filename. Run the |
| 27 | preflight above yourself. For a multi-diagram request, spawn one subagent per |
| 28 | diagram in parallel with distinct filenames. |
| 29 | |
| 30 | |
| 31 | **Model routing** — if your harness lets you choose the subagent's model, route by |
| 32 | task weight: a **fast/cheap tier** (Claude Haiku-class — must support vision) when |
| 33 | the request matches a template from the rules' Templates table (reproduction is |
| 34 | mechanical; the validator's advice strings teach every fix), your **default strong |
| 35 | model** for free-hand or novel architectures. If a cheap subagent returns VALIDATE |
| 36 | not ok or ITERATIONS > 3, respawn ONCE on the strong model before taking over |
| 37 | inline. Multi-diagram requests: route each diagram independently. |
| 38 | |
| 39 | Subagent prompt (fill every `<...>`): |
| 40 | |
| 41 | ```text |
| 42 | Build an AWS architecture .drawio diagram with the drawio-ai CLI. |
| 43 | Request: <user's request + clarifications, verbatim> |
| 44 | Output: <ABS_PROJECT_DIR>/<NAME>.drawio — never write inside the Kit, never into cwd. |
| 45 | Follow exactly: |
| 46 | 1. Set ROOT="$(drawio-ai root)". Read $ROOT/docs/api-cheatsheet.md — the full layout-engine |
| 47 | API in one file; never read library source. |
| 48 | 2. Run `drawio-ai workflow` and `drawio-ai principles --mode aws` — the source of |
| 49 | truth. (Fallback if a command is blocked: read $ROOT/rules/*.md directly.) |
| 50 | 3. Look up every icon with ONE batched `drawio-ai search "a, b, c"`; never recolor icons. |
| 51 | 4. Scaffold, don't write: `drawio-ai scaffold --list`, pick the closest template, then |
| 52 | `drawio-ai scaffold <name>.mjs -o <dir>/build.mjs` — the script arrives runnable |
| 53 | (absolute imports, self-validating, self-rendering with an issues list). Edit only the |
| 54 | deltas. If no template is close AND you'd change more than half of it, Write a new |
| 55 | script instead (keep the scaffold's self-check tail). Layout engine only |
| 56 | (group/frame/grid/icon/box + renderTree), NO hand-written coordinates. |
| 57 | 5. Each `node build.mjs` run prints validate JSON AND the render's machine-readable |
| 58 | `issues` list. Fix from THAT checklist — all issues in one Edit round — then re-run. |
| 59 | Loop until issues is empty. |
| 60 | 6. Only when issues is empty: Read the PNG once as final visual confirmation (list any |
| 61 | remaining visual problems, fix ALL in one round). Target <= 2 PNG reads total. Then |
| 62 | render once WITHOUT --check for the final deliverable PNG. |
| 63 | Do NOT invoke any drawio skill — this prompt already contains the full procedure. |
| 64 | Do not ask questions — make the standard choice and record it under ASSUMPTIONS. |
| 65 | Return EXACTLY this block, nothing else: |
| 66 | DRAWIO: <absolute path to .drawio> |
| 67 | PNG: <absolute path to .png> |
| 68 | VALIDATE: <verbatim final validate JSON> |
| 69 | ICONS: <comma-separated icon names used> |
| 70 | ITERATIONS: <number of render/fix cycles> |
| 71 | SUMMARY: <one sentence describing the diagram> |
| 72 | ASSUMPTIONS: <choices made without asking, or "none"> |
| 73 | ``` |
| 74 | |
| 75 | Relay `DRAWIO`, `PNG` and `SUMMARY` to the user verbatim; do NOT re-read the |
| 76 | .drawio or PNG in this conversation — the subagent already ran the vision |
| 77 | self-check. If `VALIDATE` is not ok, take over via the Inline path (the build |
| 78 | .mjs and .drawio are on disk at the returned paths). |
| 79 | |
| 80 | ## Inline path (no subagent support) |
| 81 | |
| 82 | ### 1. Shared Workflow |
| 83 | |
| 84 | ```bash |
| 85 | drawio-ai workflow |
| 86 | ``` |
| 87 | |
| 88 | Prints the build → validate → render → write-to-project-path loop every diagram |
| 89 | follows. Read it; it is the source of truth for the process. |
| 90 | |
| 91 | ### 2. Domain rules |
| 92 | |
| 93 | ```bash |
| 94 | drawi |