
CDK Patterns
FreeStreamline AWS infrastructure with reusable CDK constructs.
Free · Opens the source repo
What CDK Patterns does
The CDK Patterns skill provides a comprehensive guide for developers and designers looking to build cloud infrastructure using the AWS Cloud Development Kit (CDK). This skill focuses on reusable patterns and constructs, particularly in TypeScript, Python, and Java, making it ideal for those who want to create production-grade infrastructure stacks. By leveraging this skill, users can efficiently design multi-stack CDK applications and implement common infrastructure patterns such as serverless APIs, container services, and data pipelines.
This skill is particularly beneficial for those who are tasked with creating reusable CDK constructs or patterns. It offers step-by-step instructions and best practices for structuring stacks, ensuring that resources are organized effectively. The guidance on using L2 constructs over L1 constructs promotes safer defaults, while the emphasis on the principle of least privilege for IAM roles enhances security. Additionally, the skill encourages the use of monitoring tools like CloudWatch and X-Ray, which are essential for maintaining production-ready environments.
Whether you are a seasoned AWS developer or a newcomer to cloud infrastructure, this skill equips you with the knowledge to avoid common pitfalls and anti-patterns. It serves as a valuable resource for reviewing CDK code and ensuring adherence to best practices. By utilizing the CDK Patterns skill, you can streamline your development process, reduce errors, and create robust cloud applications that meet the demands of modern infrastructure.
In summary, the CDK Patterns skill is a must-have for anyone looking to enhance their AWS CDK experience. It simplifies the process of building complex cloud architectures and ensures that your infrastructure is both efficient and secure.
When to use it
Use this skill when building reusable CDK constructs, designing multi-stack applications, or implementing common infrastructure patterns.
When not to use it
Avoid this skill if you need raw CloudFormation templates, are working with Terraform, or only require simple one-off resource creations.
What you can build with it
Building a Serverless API
Use the Serverless API pattern to create a fully managed API backed by AWS Lambda and DynamoDB, streamlining your serverless architecture.
Designing Multi-Stack Applications
Leverage the skill to structure complex applications into reusable stacks, separating stateful and stateless resources for better organization.
Implementing Common Infrastructure Patterns
Quickly implement standard patterns like API + Lambda + DynamoDB setups, ensuring best practices are followed for production environments.
How to install CDK Patterns
View source1. Install with the skills CLI
npx skills add sickn33/agentic-awesome-skills/cdk-patterns --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by sickn33You 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
RemovalPolicyandTagsappropriately 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, id: string) {
super(scope, id);
const table = new dynamodb.Table(this, "Table", {
partitionKey: { name: "pk", type: dynamodb.AttributeType.STRING },
billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
removalPolicy: cdk.RemovalPolicy.RETAIN,
});
const handler = new lambda.Function(this, "Handler", {
runtime: lambda.Runtime.NODEJS_20_X,
handler: "index.handler",
code: lambda.Code.fromAsset("lambda"),
environment: { TABLE_NAME: table.tableName },
tracing: lambda.Tracing.ACTIVE,
});
table.grantReadWriteData(handler);
new apigateway.LambdaRestApi(this, "Api", { handler });
}
}
Best Practices
- ✅ Do: Use
cdk.Tags.of(this).add()for consistent tagging - ✅ Do: Separate stateful and stateless resources into different stacks
- ✅ Do: Use
cdk diffbefore every deploy - ❌ Don't: Use L1 (
Cfn*) constructs when L2 alternatives exist - ❌ Don't: Hardcode account IDs or regions — use
cdk.Aws.ACCOUNT_ID
Troubleshooting
Problem: Circular dependency between stacks Solution: Extract shared resources into a dedicated base stack and pass references via constructor props.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Frequently asked questions about CDK Patterns
Similar skills
Turborepo
Optimized build system for JavaScript/TypeScript monorepos.
Azure Pipelines Validation
Streamline your Azure DevOps pipeline changes locally.
Azure Developer CLI
Streamline your Azure project workflows with best practices.
Azure Container Registry CLI
Manage Azure Container Registry resources with ease.
Aspire
Build and orchestrate polyglot distributed applications seamlessly.
Vercel CLI
Manage and deploy Vercel projects from the command line.
