/dx-automation:auto-initfrom dx-automation
Scaffolds AI automation for a project: sets up .ai/automation/ and infra.json with Azure DevOps pipelines and AWS Lambda agents. Run once after /dx-init.
Ships in dx-automation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You scaffold and configure AI automation for the current project. Every project is self-contained — it owns its own AWS infrastructure (Lambda, DynamoDB, SQS, S3, API Gateway) and its own ADO pipelines. There is no hub/consumer split. Projects share no Lambda infrastructure with each other.
This skill scaffolds Azure DevOps + AWS Lambda automation. It is intentionally narrower than the rest of the dx-* and aem-* skills.
| Layer | Compatibility |
|---|---|
Skill invocation (running /auto-init in your terminal) | Claude Code, Copilot CLI, VS Code Chat, Codex CLI, Gemini CLI — same as any other plugin skill |
Generated pipelines (.ai/automation/pipelines/) | Azure DevOps only — pipeline YAMLs target ADO. No GitHub Actions, GitLab CI, Jenkins, or CircleCI templates exist |
Generated agent runtime (.ai/automation/agents/) | AWS Lambda only — handlers assume Lambda invocation context, Anthropic API, and AWS Secrets Manager. No Cloud Functions, Azure Functions, or self-hosted variants |
| Webhooks → triggers | ADO service hooks → API Gateway → Lambda for work-item agents. PR Review/Answer use ADO build validation policy. SimpleAgent/BugFix use ADO Incoming Webhooks (Azure-native, no Lambda) |
| AI provider | Anthropic Claude API direct (Lambda agents); not Bedrock, Vertex, or other providers |
| Tracker integration | ADO work items + PR APIs. Jira-only projects can install dx-core but not dx-automation |
If your project uses GitHub Actions, GitLab CI, or any CI/CD other than Azure DevOps, do not run /auto-init — it will produce pipeline YAMLs that target the wrong platform. dx-core (/dx-init) and dx-aem (/aem-init) work fine on any tracker/CI combination; only dx-automation is ADO-locked.
This is tracked as a backlog item — see docs/todo/todo-automation.md § CI/CD pipeline portability for non-ADO CI work and docs/todo/todo-provider-support.md for tracker/SCM portability (GitHub as tracker).
CRITICAL: When auto-init is re-run, EVERY step MUST execute. NEVER stop early. If the user chooses "Keep config", skip to Phase 2 and continue through ALL remaining phases. Each step validates:
| File Category | Re-run Behavior |
|---|---|
| Config (infra.json) | Ask: keep / re-scaffold |
| Data bundle (.ai/automation/) | Compare against plugin data. Update silently only when the consumer copy is unmodified or differs in comments / project-specific names only. If a file has functional local divergence (added pipeline steps, gate scripts like pr-answer-gate.sh, branch-pins, lambda AGENTS edits, connection-name conventions) → show a diff and ASK before overwriting; default to keep. Never silently clobber local functional changes (the sync-clobber gap). Always preserve user-filled values in infra.json, repos.json, .env. |
| Policy file (.ai/automation/policy/pipeline-policy.yaml) | Compare against plugin data → if user customized: ask. If only template changed: update |
| Generated files (infra.json, repos.json, .env.template) | Validate structure and required fields exist — report missing fields from newer templates |
Check all prerequisites before proceeding:
dx-init required — read .ai/config.yaml. If missing: "Run /dx-init first." STOP.
audit.sh required — check .ai/lib/audit.sh exists. If missing: "Run /dx-init first — it installs the audit library." STOP.
Ask the agent question (Question 5) BEFORE checking CLI tools — the answer determines which tools are required.
CLI tools — verify: Node.js, AWS CLI, and Azure CLI are required. STOP if any are missing. (If user only enables PR-pipeline agents and no Lambda agents, AWS CLI is optional — prompt accordingly.)
Existing scaffold — if .ai/automation/ already exists and has infra.json:
Automation already configured. What would you like to do? (A) Keep config — validate all automation files against plugin data (B) Re-scaffold — re-run questions with current values pre-loaded
If A: Say "Config kept. Validating automation files..." — then CONTINUE to Phase 2 to validate data bundle, policy, and generated files. DO NOT stop or exit.
Ask these questions one at a time. Wait for each answer before asking the next.
Question 1 — Agent selection (ask this FIRST — it determines which subsequent questions to ask):
This is the same question from Phase 0 step 3. If already answered there, use the saved answer. Otherwise ask now using the Question 5 format below.
Question 2 — Pipeline folder (optional):
ADO pipeline folder? Pipelines will be created inside this folder for organization.
Example:
\KAI,\AI-AgentsDefault: root folder (no folder). Stored as
pipelineFolderin infra.json.
Question 3 — Your ADO identity:
Before asking, run
git config user.emailandgit config user.nameto get the current git user. Offer that as the default suggestion.Your ADO identity? Used to filter PR Review (skip your own PRs) and PR Answer (respond to comments on your PRs).
Format:
[email protected], Display NameDefault:
<git-email>, <git-name>(from git config)
Question 4 — Resource prefix:
Resource prefix? Used for all AWS resource names (DynamoDB tables, Lambda functions, S3 bucket, SQS queue, CloudWatch alarms).
Example:
myproject→myproject-dedupe,myproject-DOR-AgentDefault: derive from
dx.project-namein config.yaml, lowercase with hyphens only (e.g.my-project).
Question 4b — AWS region:
AWS region? (default:
us-east-1)
Question 5 — Enable all agents, or customize?
Which agents to enable? Each project is self-contained — it owns its own AWS infrastructure and pipeline agents. You can enable all agents or pick the ones you need.
- All agents (default) — DoR, DoD, DoD Fix, PR Review, PR Answer, BugFix, QA, DevAgent, DOCAgent, Estimation, SimpleAgent
- Customize — pick individual agents
If user chose customize, show the agent list:
Which agents to enable? (comma-separated numbers or "all")
- PR Review — reviews PRs via build validation (no Lambda)
- PR Answer — responds to PR comments (needs PR-Router Lambda)
- DoR — Definition of Ready check on tagged work items
- DoD — Definition of Done check on tagged work items
- DoD Fix — auto-fixes DoD failures (cross-repo aware)
- BugFix — triages and fixes Bugs (cross-repo aware)
- QA — browser-based AEM verification
- DevAgent — full autonomous development (cross-repo, Figma support)
- DOCAgent — wiki docs + AEM demo pages
- Estimation — auto-estimates story points
- SimpleAgent — small AEM changes from an
@kai-simplecomment (no Lambda)
Resolve the chosen selection into a list of enabled agents. Save automationProfile: "per-project" in infra.json alongside the enabled agents list.
If DoR enabled (full-hub or custom with DoR) — Question 5a:
DoR wiki URL? ADO wiki page containing your Definition of Ready criteria.
Example:
https://dev.azure.com/myorg/myproject/_wiki/wikis/MyWiki/123/Definition-of-Ready(Leave blank to skip wiki fetch — agent uses default criteria only)
If QA enabled (full-hub or custom with QA) — Question 5b:
Remote AEM Author URL? For dialog and component verification (content editing instance).
Example:
https://author-myproject.adobeaemcloud.com(Leave blank for local AEM author at
http://localhost:4502)
If QA enabled (full-hub or custom with QA) — Question 5c:
Remote AEM Publisher URL? For user-facing page verification (publisher instance — always different from author).
Example:
https://publish-myproject.adobeaemcloud.com(Leave blank for local AEM publisher at
http://localhost:4503)
If DevAgent enabled (full-hub, consumer, or custom with DevAgent) — Figma note:
Figma design-to-code works automatically via the Figma MCP server (connects to the local Figma desktop app). No token or configuration needed — DevAgent extracts Figma URLs from work items and calls Figma MCP for design context.
Note: Figma integration in CI/CD pipelines (headless environments without a local Figma app) is not yet supported. See TODO for remote Figma API support.
@kai-simple)Prompt the user for:
| Prompt | Stored as | Where used |
|---|---|---|
QA AEM author URL (e.g., https://qa-author.example.com) | ADO pipeline variable AEM_QA_URL | Pipeline ado-cli-simple.yml env |
| QA AEM service-account username | ADO pipeline variable AEM_QA_USER (secret) | Same |
| QA AEM service-account password | ADO pipeline variable AEM_QA_PASSWORD (secret) | Same |
Document in the generated infra.json:
{
"simpleAgent": {
"qaAemUrl": "<from prompt>",
"pipelineVariables": ["AEM_QA_URL", "AEM_QA_USER", "AEM_QA_PASSWORD"]
}
}
/dx-simple in .ai/config.yaml/dx-simple runs out of the box on any component once SimpleAgent is enabled.
For faster compile cycles or a custom cost ceiling, add an optional block to
.ai/config.yaml:
dx-simple:
cost-ceiling-usd: 2.0
build-compile-fast: "mvn compile -pl ui.frontend,core -am"
recovery: # resumable error recovery
trigger-token: "@kai-simple" # MUST match the ADO Service Hook comment filter
max-attempts: 3 # human-answer cycles before downgrading to hard
All keys are optional — defaults are applied when the block is absent.
Prerequisite for resumable recovery. SimpleAgent's recovery uses the per-ticket git branch as the durable state store, so
.ai/specs/must be tracked in git./dx-inittracks it by default; an older install may still have a.ai/specs/gitignore line — remove it. Also configure the ADO Service Hook on the "work item commented on" event with a subscription filter requiring the comment to containtrigger-token(@kai-simple), wired to re-runado-cli-simple.yml. Recovery is human-re-triggered (a human replies with the keyword); it is not automatic.
Scaffolding is profile-aware. Consumer profile gets a minimal subset — only pipeline YAMLs and config. They NEVER get Lambda handlers, webhook config, or AWS resource definitions.
mkdir -p .ai/automation
Copy the entire data bundle (pipelines, Lambda handlers, scripts, policy):
PLUGIN_DIR="$(dirname "$(dirname "$0")")"
if [ -d ".ai/automation" ]; then
rsync -a --ignore-existing "$PLUGIN_DIR/data/" ".ai/automation/"
echo "Validated .ai/automation/ data bundle (new files added, existing preserved)"
else
cp -r "$PLUGIN_DIR/data/." ".ai/automation/"
echo "Installed .ai/automation/ data bundle"
fi
chmod +x .ai/automation/lambda/deploy.sh \
.ai/automation/lambda/cloudwatch/setup-alarms.sh
mkdir -p .ai/automation/policy
SRC="$PLUGIN_DIR/data/policy/pipeline-policy.yaml"
DST=".ai/automation/policy/pipeline-policy.yaml"
if [ ! -f "$DST" ]; then
cp "$SRC" "$DST"
echo "Installed .ai/automation/policy/pipeline-policy.yaml"
elif diff -q "$SRC" "$DST" >/dev/null 2>&1; then
echo "Validated .ai/automation/policy/pipeline-policy.yaml (up to date)"
else
echo "REVIEW: .ai/automation/policy/pipeline-policy.yaml (differs from plugin data)"
fi
For REVIEW items: read both files, show the user what changed, and ask: (A) Keep existing (user may have customized), (B) Replace with plugin version.
.ai/automation/infra.jsonFull hub: Read infra.template.json, then fill in:
{{ADO_ORG_URL}} → from dx.scm.org-url in config.yaml (or ask if not found){{ADO_PROJECT}} → from dx.scm.project in config.yaml (or ask if not found){{AWS_REGION}} → from Question 5b{{AWS_ACCOUNT_ID}} → run aws sts get-caller-identity --query Account --output text (leave as {{AWS_ACCOUNT_ID}} if fails — note for user){{RESOURCE_PREFIX}} → from Question 5 (lowercase){{PIPELINE_NAME_PREFIX}} → use the pipelineFolder name (strip backslash, e.g. \KAI → KAI). If no folder, derive from project.name in config.yaml with a KAI-<RepoShortName> format (e.g., KAI-MyApp for Experience-MyApp). Strip common prefixes like Experience-. Never ask the user about pipeline naming — ADO lists all pipelines in the project dropdown, so names must be distinguishable across repos.{{PIPELINE_FOLDER}} → from Question 2 (e.g. \\KAI). If user left blank, remove the field or set to empty string.{{DOR_PIPELINE_ID}}, {{DOD_PIPELINE_ID}}, etc. as-is (filled by later skills)Write to .ai/automation/infra.json.
.ai/automation/repos.jsonRead the template. Replace the example repo entry with the current repo (from git remote get-url origin + dx.project-name in config.yaml). Write to .ai/automation/repos.json.
.ai/automation/.env.templateFull hub:
cat > .ai/automation/.env.template << 'EOF'
# AI Automation — environment variables for local runner and Lambda
# Copy to .env and fill in values. NEVER commit .env to git.
# ADO credentials
AZURE_DEVOPS_PAT= # ADO Personal Access Token
# LLM credentials
ANTHROPIC_API_KEY= # Claude API key (used by all pipelines)
# Lambda env vars (also set in AWS Console)
BASIC_USER= # Webhook basic auth username
BASIC_PASS= # Webhook basic auth password
WEBHOOK_SECRET= # Shared webhook secret header value
ADO_PAT= # Same as AZURE_DEVOPS_PAT
# AWS credentials (for local runner; Lambda uses IAM role)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=
EOF
If user did NOT enable an agent, add "disabled": true to the relevant pipeline entry in infra.json.
If agent.index.md exists at the project root and does not already contain ## CI/CD Pipeline Agents, insert before ## Not Agent Files:
## CI/CD Pipeline Agents
| Path | What | Committed |
|------|------|-----------|
| `.ai/automation/` | CI/CD automation — pipeline agents, Lambda handlers | Yes |
| `.ai/automation/policy/` | Runtime policy (capability gating, redaction, rate limits) | Yes |
| Agent | Trigger |
|-------|---------|
| DoR (Definition of Ready) | Tag work item |
| DoD (Definition of Done) | Tag work item |
| DoD Fix | Tag work item |
| PR Review | PR created/updated |
| PR Answer | Comment on your PR |
| BugFix | Tag bug ticket |
| QA | Tag work item |
| DevAgent | Tag work item |
| DOCAgent | Tag work item |
| Estimation | Tag work item |
Only include agents that were enabled in Question 6. If agent.index.md doesn't exist, skip (user hasn't run dx-init yet).
## Automation Scaffolded
**Profile:** Per-project (self-contained)
**Pipeline prefix:** KAI-<RepoShortName>
**Region:** <region>
**Agents:** DoR <✓/✗> | DoD <✓/✗> | DoD Fix <✓/✗> | PR Review <✓/✗> | PR Answer <✓/✗> | BugFix <✓/✗> | QA <✓/✗> | DevAgent <✓/✗> | DOCAgent <✓/✗> | Estimation <✓/✗>
**ADO identity:** <email, Name>
**Files created:**
- `.ai/automation/` — Lambda handlers, ADO pipelines
- `.ai/rules/` — shared rules (installed by dx-init). Edit to customize review criteria, answer tone, pragmatism filters. Changes apply to BOTH local dx skills and automation agents.
- `.ai/automation/policy/pipeline-policy.yaml` — agent capability gates, redaction policy, rate limits, token budget. Update the three `← Update` fields.
- `.ai/automation/infra.json` — fill remaining `{{PLACEHOLDER}}` values after provisioning
- `.ai/automation/repos.json` — add repos your agents should search (for DoR code discovery)
- `.ai/automation/.env.template` — credential reference (copy to `.env`, never commit)
<If AWS account ID was not auto-detected:>
⚠️ **AWS account ID not detected.** Run `aws sts get-caller-identity` and fill `{{AWS_ACCOUNT_ID}}` in `infra.json`.
### Setup Sequence
Run these skills in order to complete the setup:
1. `/auto-provision` — Create AWS resources (DynamoDB, SQS, S3, Lambda, API Gateway)
2. `/auto-pipelines` — Import ADO pipelines + set variables
3. `/auto-deploy` — Deploy Lambda code
4. `/auto-lambda-env` — Set Lambda environment variables
5. `/auto-webhooks` — Configure ADO service hooks
6. `/auto-alarms` — Set up CloudWatch monitoring
7. `/auto-test --dryRun` — Verify end-to-end
### Verify anytime
- `/auto-doctor` — Health check (files, ADO pipelines, Lambda functions)
- `/auto-status` — DLQ depth, token budget, rate limits (**currently broken**, TODO #251: until it is fixed, check the DLQ with `aws sqs get-queue-attributes`, as in the runbook)
/auto-init — First-time setup. Asks which agents to enable, scaffolds full .ai/automation/ directory with infra.json containing AWS resource prefix, region, and agent definitions. Prints next step: /auto-provision.
/auto-init (customize agents) — User picks specific agents (e.g., PR Review + PR Answer only — no Lambda agents needed). Scaffolds pipelines but skips Lambda-only setup. Prints next step: /auto-pipelines.
/auto-init (re-run on existing setup) — Detects infra.json already exists with automationProfile: per-project. Validates each section against current plugin data, finds 2 new agent definitions added in the latest plugin version, and asks whether to add them. Updates infra.json with the new agents while preserving existing pipeline IDs and configuration.
".ai/config.yaml not found — run /dx-init first"
Cause: /auto-init requires the base config from /dx-init.
Fix: Run /dx-init to create .ai/config.yaml with SCM settings, then re-run /auto-init.
"infra.json already exists — overwrite?" Cause: Automation was already initialized for this project. Fix: Choose "validate and update" to preserve existing pipeline IDs and AWS resource references. Only choose "overwrite" if the config is corrupted.
AskUserQuestion tool to pause and wait for the user's response. Never proceed past a question without receiving the user's answer first. Present numbered options in the question text, then STOP and wait. Do not batch multiple questions into one message — ask one, wait for the answer, then continue./auto-provision, /auto-deploy, /auto-lambda-env, or /auto-alarms for pipeline-only setups. DO still run /auto-webhooks (for PR Answer hook + PR Review build policy).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
10 skills in this plugin
/auto-alarmsCreate CloudWatch alarms and SNS subscription for AI automation monitoring. Creates 4 alarms (DLQ depth, WI-Router errors, PR-Router errors, throttles) and subscribes an email address to alerts. Reads config from .ai/automation/infra.json./auto-deployDeploy Lambda code for AI automation agents (wi-router and/or pr-router). Packages agent steps + shared libs into a zip and uploads to AWS Lambda. Safe to re-run after code changes. Reads function names from .ai/automation/infra.json./auto-doctorHealth check of the AI automation setup — local files, ADO pipeline configuration, Lambda state. Use when automation seems broken, for 'check automation'.npx claudepluginhub easingthemes/dx-aem-flow --plugin dx-automation