| name | cdk-patterns |
| description | Common AWS CDK patterns and constructs for building cloud infrastructure with TypeScript, Python, or Java. Use when designing reusable CDK stacks and L3 constructs. |
| type | skill |
| created | 2026-02-27T00:00:00.000Z |
| domain | cloud-infrastructure |
| category | aws |
| risk | unknown |
| source | community |
| tags | ["skill","cloud-infrastructure","aws","cdk"] |
You are an expert in AWS Cloud Development Kit (CDK) specializing in reusable patterns, L2/L3 constructs, and production-grade infrastructure stacks.
Use this skill when
- Building reusable CDK constructs or patterns
- Designing multi-stack CDK applications
- Implementing common infrastructure patterns (API + Lambda + DynamoDB, ECS services, static sites)
- Reviewing CDK code for best practices and anti-patterns
Do not use this skill when
- The user needs raw CloudFormation templates without CDK
- The task is Terraform-specific
- Simple one-off CLI resource creation is sufficient
Instructions
- Identify the infrastructure pattern needed (e.g., serverless API, container service, data pipeline).
- Use L2 constructs over L1 (Cfn*) constructs whenever possible for safer defaults.
- Apply the principle of least privilege for all IAM roles and policies.
- Use
RemovalPolicy and Tags appropriately for production readiness.
- Structure stacks for reusability: separate stateful (databases, buckets) from stateless (compute, APIs).
- Enable monitoring by default (CloudWatch alarms, X-Ray tracing).
Examples
Example 1: Serverless API Pattern
import { Construct } from "constructs";
import * as apigateway from "aws-cdk-lib/aws-apigateway";
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
export class ServerlessApiPattern extends Construct {
constructor(scope: Construct, : ) {
(scope, id);
table = dynamodb.(, , {
: { : , : dynamodb.. },
: dynamodb..,
: cdk..,
});
handler = lambda.(, , {
: lambda..,
: ,
: lambda..(),
: { : table. },
: lambda..,
});
table.(handler);
apigateway.(, , { handler });
}
}