一键导入
new-integ
Scaffold a new integration test for cdkd. Creates a minimal CDK app with the specified AWS resources for deploy/destroy E2E testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new integration test for cdkd. Creates a minimal CDK app with the specified AWS resources for deploy/destroy E2E testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Detect and delete leftover AWS resources from cdkd integration tests. Only targets resources matching known cdkd stack name patterns.
Proactively hunt for cdkd bugs by deploying real CDK apps that exercise common-but-untested AWS resources, configs, and CloudFormation notations against real AWS, then fix what breaks. Use for a periodic "find latent bugs" sweep, not for verifying a specific change.
Work through already-filed GitHub issues (typically the bug-hunt's output) end to end — triage safely, pick a few FILE-DISJOINT issues to fix in parallel, claim each on the issue before starting (collision-safe with other agents), verify against real AWS, then carry each through merge → pull → release → rebuild the linked binary → worktree cleanup. Use when asked to "handle/address filed issues", not to hunt for new bugs (that is /hunt-bugs).
Recommend which integration tests to run, based on the integ ledger (staleness / last result) plus the code areas touched by recent commits. Outputs a prioritized list of `/run-integ <name>` commands. Use before a release, after a batch of merges, or when unsure what integ coverage a change needs.
Run integration tests (deploy + destroy) against real AWS. Use when you need to verify cdkd works end-to-end with actual AWS resources.
Recommend the right reviewer count for a PR based on size + bias factors. Outputs a concrete plan (inline spot-check / 1 reviewer / 3-axis parallel) plus ready-to-paste Agent dispatch prompts when reviewers are warranted.
| name | new-integ |
| description | Scaffold a new integration test for cdkd. Creates a minimal CDK app with the specified AWS resources for deploy/destroy E2E testing. |
| argument-hint | <test-name> |
You are scaffolding a new integration test for cdkd.
The user provides a kebab-case test name (e.g., ses-email-identity,
s3-event-notification).
Build cdkd first: vp run build from the repo root — verify.sh and the
synth check both run against dist/cli.js, so source changes without a build
have no effect.
Check the test does not already exist in tests/integration/<test-name>/,
AND that an existing fixture does not already cover the pattern. Grep for the
construct/resource type across tests/integration/*/lib before building —
a fixture that already deploys the thing (even without a verify.sh) means the
higher-value move is often to ADD a functional verify.sh to it rather than a
whole new fixture.
Read a recent fixture as the reference shape. Use
tests/integration/dynamodb-gsi-update/ (deploy + UPDATE + destroy with real
assertions) or tests/integration/s3-event-notification/ (functional check)
— NOT the oldest ones, whose conventions have drifted.
Create the test directory at tests/integration/<test-name>/ with these
files. The project runs CDK apps via Node 24 type-stripping (node bin/app.ts),
so the fixture is ESM ("type": "module") and imports carry the .ts
extension — there is NO ts-node / tsx dependency.
cdk.json:
{
"app": "node bin/app.ts"
}
package.json (note "type": "module"; no ts-node):
{
"name": "cdkd-integ-<test-name>",
"version": "1.0.0",
"private": true,
"description": "<one-line description>",
"scripts": {
"build": "tsc",
"watch": "tsc -w"
},
"devDependencies": {
"@types/node": "^20.0.0",
"aws-cdk": "^2.1112.0",
"typescript": "^5.0.0"
},
"dependencies": {
"aws-cdk-lib": "^2.169.0",
"constructs": "^10.0.0"
},
"type": "module"
}
tsconfig.json (ESNext / NodeNext, with rewriteRelativeImportExtensions
so the .ts-suffixed relative imports type-check):
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"lib": ["ES2023"],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": ["./node_modules/@types"],
"moduleResolution": "NodeNext",
"rewriteRelativeImportExtensions": true,
"erasableSyntaxOnly": true,
"verbatimModuleSyntax": true
},
"exclude": ["node_modules", "cdk.out"]
}
bin/app.ts — entry point. Import the stack WITH the .ts extension and
wire the env from CDK_DEFAULT_ACCOUNT / CDK_DEFAULT_REGION:
#!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { MyTestStack } from '../lib/<test-name>-stack.ts';
const app = new cdk.App();
new MyTestStack(app, 'Cdkd<PascalCaseName>Example', {
description: '<one-line description>',
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
},
});
lib/<test-name>-stack.ts — the stack. Keep it minimal: only the resource
under test + its required dependencies. In the class docstring, add a
covers: AWS::Service::Type line for each resource type the test is meant to
cover (the coverage matrix in step 7 parses these annotations).
Ask the user what specific AWS resources the test should create, if not obvious from the test name.
Write a verify.sh (the most important deliverable — a deploy-only smoke
test is NOT enough). Model it on tests/integration/dynamodb-gsi-update/verify.sh.
It must:
set -euo pipefail, cd "$(dirname "$0")", and define STACK, REGION
(${AWS_REGION:-us-east-1}), STATE_KEY, and
LOCAL_DIST="$(cd ../../../dist && pwd)/cli.js".STATE_BUCKET (fail fast if unset) and the built dist/cli.js.cleanup() and trap cleanup EXIT; run it once up-front as a
pre-run cleanup. cleanup must node "${LOCAL_DIST}" state destroy, delete
the AWS resources by deterministic name, remove the state.json + lock.json,
and sweep /aws/lambda/${STACK}* log groups (Lambda auto-creates them on
invoke and neither CFn nor cdkd deletes them — leaving them counts as an
orphan).process.env.CDKD_TEST_UPDATE === 'true'). Set the env
PER-PHASE: Phase 1 baseline via env -u CDKD_TEST_UPDATE node ... deploy,
Phase 2 via inline CDKD_TEST_UPDATE=true node ... deploy. Never gate the
whole phase on a caller-set global env. Assert the change reached AWS AND
that it was in-place, not a replacement (e.g. an identity field like
DynamoDB CreationDateTime is unchanged).--force), then assert the resource is gone, the
state.json is gone, and sweep the log groups again.echo "[verify] PASS — ..." line (the run-integ harness
greps for it).chmod +x verify.sh.Regenerate the coverage matrices (adding/removing a Construct changes
them, and CI hard-fails on a stale matrix — /check does NOT catch this):
vp run integ-coverage && vp run scenario-coverage && vp run format
Commit the regenerated docs/_generated/*.json alongside the fixture.
Install deps + verify synthesis:
cd tests/integration/<test-name> && npm install
node ../../../dist/cli.js synth --region us-east-1
Run the full test with /run-integ <test-name> (deploy + functional +
destroy + orphan-zero verification against real AWS). A fixture that has never
passed /run-integ is worse than no fixture — never commit one unrun.
stateBucket in cdk.json context (let the CLI resolve it).RemovalPolicy.DESTROY (and autoDeleteObjects: true on buckets) so
teardown is clean.lambda.Code.fromInline(...) for handlers — no asset bundling needed,
and @aws-sdk/client-* is already in the Node.js 20 runtime.Cdkd<PascalCaseName>Example (matches the STACK var in
verify.sh). Some older fixtures use <PascalCaseName>Stack; follow the
Cdkd...Example form for new tests.node_modules/, package-lock.json, cdk.out/, or build output
(*.js / *.d.ts) — tests/integration/.gitignore covers them.