skills/aws-cdk-builder/SKILL.md
AWS CDK infrastructure builder using TypeScript with L2/L3 constructs and Well-Architected patterns. Activate on: AWS CDK, CDK construct, CDK stack, CDK pipeline, AWS infrastructure as code TypeScript, L2 construct, CDK patterns. NOT for: Terraform IaC (use terraform-module-builder), Kubernetes manifests (use kubernetes-manifest-generator), serverless framework (use devops-automator).
npx skillsauth add curiositech/windags-skills aws-cdk-builderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert in building AWS infrastructure using CDK with TypeScript, leveraging L2/L3 constructs and Well-Architected Framework patterns.
Activate on: "AWS CDK", "CDK construct", "CDK stack", "CDK pipeline", "AWS IaC TypeScript", "L2 construct", "CDK patterns", "cdk deploy", "cdk synth"
NOT for: Terraform IaC → terraform-module-builder | Kubernetes manifests → kubernetes-manifest-generator | Serverless Framework → devops-automator
npx cdk init app --language typescript| Domain | Technologies | |--------|-------------| | CDK Core | CDK 2.180+, Constructs library, CDK CLI, cdk.json | | L2/L3 Constructs | aws-lambda, aws-apigateway, aws-ecs-patterns, aws-rds | | Compliance | cdk-nag (AwsSolutions, NIST, HIPAA, PCI packs) | | CI/CD | CDK Pipelines, CodePipeline, CodeBuild, self-mutation | | Patterns | ECS Fargate patterns, API Gateway + Lambda, S3 + CloudFront |
// bin/app.ts — top-level app with environment separation
const app = new cdk.App();
// Stateful stack — rarely changes, careful with updates
const dataStack = new DataStack(app, 'Data-Prod', {
env: { account: '123456789', region: 'us-east-1' },
});
// Stateless stack — frequently deployed, safe to destroy/recreate
const apiStack = new ApiStack(app, 'Api-Prod', {
env: { account: '123456789', region: 'us-east-1' },
database: dataStack.database,
bucket: dataStack.bucket,
});
// Pipeline stack — self-mutating CI/CD
new PipelineStack(app, 'Pipeline', {
env: { account: '123456789', region: 'us-east-1' },
});
// lib/api-stack.ts
export class ApiStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: ApiStackProps) {
super(scope, id, props);
const handler = new lambda.Function(this, 'Handler', {
runtime: lambda.Runtime.NODEJS_22_X,
handler: 'index.handler',
code: lambda.Code.fromAsset('lambda/'),
memorySize: 256,
timeout: cdk.Duration.seconds(30),
tracing: lambda.Tracing.ACTIVE, // X-Ray
insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_229_0,
environment: {
TABLE_NAME: props.table.tableName,
POWERTOOLS_SERVICE_NAME: 'api', // Lambda Powertools
},
});
props.table.grantReadWriteData(handler); // Least privilege
const api = new apigw.RestApi(this, 'Api', {
deployOptions: {
tracingEnabled: true,
metricsEnabled: true,
throttlingRateLimit: 1000,
throttlingBurstLimit: 500,
},
});
api.root.addResource('items').addMethod('GET',
new apigw.LambdaIntegration(handler));
}
}
Source (GitHub) → Synth (cdk synth) → Self-Mutate
│ │
▼ ▼
UpdatePipeline ─── Deploy Staging ─── Manual Approval ─── Deploy Prod
│ │
Integration Tests Smoke Tests
CfnBucket instead of s3.Bucket. L2 constructs encode best practices (encryption, logging, access control) by default.Aspects.of(app).add(new AwsSolutionsChecks()) to catch security issues pre-deploy.account: '123456789' in construct code. Use cdk.json context or cdk.Environment lookup for portability.expect(template).toMatchSnapshot() tests to detect unintended changes.[ ] Stacks separated: stateful (data) vs stateless (compute)
[ ] L2/L3 constructs used (not raw CloudFormation L1)
[ ] cdk-nag enabled with AwsSolutions pack
[ ] Snapshot tests for all stacks
[ ] CDK Pipelines for self-mutating CI/CD
[ ] Least privilege IAM via grant methods (grantRead, grantWrite)
[ ] cdk synth produces valid CloudFormation
[ ] Cross-stack references use exported outputs
[ ] Removal policies set (RETAIN for production data, DESTROY for dev)
[ ] Tags applied via Aspects for cost allocation
[ ] cdk diff reviewed before every deployment
[ ] Lambda functions use Powertools for observability
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.