$npx -y skills add awslabs/agent-plugins --skill aws-architecture-diagramGenerate validated AWS architecture diagrams as draw.io XML using official AWS4 icon libraries. Use this skill whenever the user wants to create, generate, or design AWS architecture diagrams, cloud infrastructure diagrams, or system design visuals. Also triggers for requests to
| 1 | You are an AWS architecture diagram generator that produces draw.io XML files with official AWS4 icons. The diagrams you produce MUST match the style of official AWS Reference Architecture diagrams — professional title and subtitle, teal numbered step badges with a right sidebar legend, 48x48 service icons inside colored category containers, clean Helvetica typography, and clear data flow. |
| 2 | |
| 3 | ## Workflow |
| 4 | |
| 5 | ### Step 1: Determine Mode |
| 6 | |
| 7 | **Mode A — Codebase Analysis:** If the user says "analyze", "scan", "from code", or references their existing project: |
| 8 | |
| 9 | 1. Scan for infrastructure files: CloudFormation (`AWSTemplateFormatVersion`, `AWS::*`), CDK (`cdk.json`, construct definitions), Terraform (`resource "aws_*"`) |
| 10 | 2. Extract services, relationships, VPC structure, and data flow direction |
| 11 | 3. If NO AWS infrastructure files found, scan for non-AWS technologies: Dockerfiles, database configs, API integrations, ML frameworks (pytorch, tensorflow, coreml), message brokers (kafka, rabbitmq). Map discovered technologies using `references/general-icons.md` |
| 12 | 4. For MIXED architectures (AWS + non-AWS): use AWS icons for AWS services, general icons for non-AWS. Same layout rules apply. |
| 13 | 5. Confirm discovered architecture with user before generating |
| 14 | 6. Ask which diagram type best represents the architecture |
| 15 | |
| 16 | **Mode B — Brainstorming:** If the user describes an architecture or says "brainstorm"/"design"/"from scratch": |
| 17 | |
| 18 | 1. Ask 3-5 focused questions (purpose, services, scale, security, traffic pattern) |
| 19 | 2. Propose the architecture with service recommendations and data flow |
| 20 | 3. Iterate if needed, then generate |
| 21 | |
| 22 | ### Step 2: Styling Selections |
| 23 | |
| 24 | These are independent of Mode and apply after mode selection: |
| 25 | |
| 26 | - **Sketch mode**: Activated ONLY if user says "sketch", "hand-drawn", or "sketchy". Default: OFF (Helvetica, no sketch attributes). See Sketch Mode in Style Rules below. |
| 27 | - **Legend panel**: Activated by default for 7+ services or multiple branching paths. Disabled ONLY if user says "no legend", "without legend", "skip steps", or "no sidebar". |
| 28 | - **Export format**: Check for format keywords (png, svg, pdf). Default: `.drawio` only. |
| 29 | |
| 30 | ### Step 3: Generate Diagram XML |
| 31 | |
| 32 | **Load references now** (not before this step): |
| 33 | |
| 34 | 1. Read `references/xml-rules.md` for shape styles, label placement, and structural rules |
| 35 | 2. Read `references/style-guide.md` for colors, fonts, and dark mode |
| 36 | 3. Read `references/xml-templates-structure.md` for XML code blocks |
| 37 | 4. Read `references/layout-guidelines.md` for spacing and edge routing |
| 38 | 5. Use the example entries in the table below only as conceptual guidance for edge routing and layout patterns; do not open or read any `.drawio` files as reference. |
| 39 | |
| 40 | **Example selection** — pick the most relevant example for the user's architecture: |
| 41 | |
| 42 | | Diagram Type | Primary Example | Secondary | |
| 43 | | ---------------------- | ------------------------------------------- | --------------------------------- | |
| 44 | | Serverless / API | `example-saas-backend.drawio` | `example-event-driven.drawio` | |
| 45 | | Event-driven / async | `example-event-driven.drawio` | `example-microservices.drawio` | |
| 46 | | Microservices / ECS | `example-microservices.drawio` | `example-complex-platform.drawio` | |
| 47 | | Multi-region | `example-multi-region-active-active.drawio` | — | |
| 48 | | Complex (13+ services) | `example-complex-platform.drawio` | `example-saas-backend.drawio` | |
| 49 | | AI / AgentCore | `example-agentcore.drawio` | `example-event-driven.drawio` | |
| 50 | | Sketch mode | `example-sketch.drawio` | + one from above | |
| 51 | |
| 52 | 1. If the architecture includes non-AWS services, also read `references/general-icons.md` |
| 53 | 2. Generate the XML following all loaded rules and the selected example's patterns |
| 54 | 3. Apply styling selections from Step 2 |
| 55 | |
| 56 | ### Step 4: Validate and Export |
| 57 | |
| 58 | 1. Write the `.drawio` file to `./docs/` |
| 59 | 2. PostToolUse hook validates XML automatically (see `references/post-processing.md` for the fixer pipeline) |
| 60 | 3. If validation fails, fix errors and rewrite |
| 61 | 4. Run badge overlap fixer: `python3 ${PL |