Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
giuseppe-trisciuoglio avatar

Aws Cdk

  • 1.3k installs
  • 311 repo stars
  • Updated June 22, 2026
  • giuseppe-trisciuoglio/developer-kit

aws-cdk is an agent skill that provides AWS CDK TypeScript patterns for stacks, constructs, and synth-diff-deploy validation workflows.

About

The aws-cdk skill provides TypeScript patterns for defining, validating, and deploying AWS infrastructure as code with the CDK. It covers cdk init app scaffolding, stack and reusable construct design, choosing L1 L2 and L3 constructs, and validation-first workflows using cdk synth, tests, cdk diff, and cdk deploy. Guidance includes IAM least privilege defaults, encryption settings, VPC and serverless architectures, multi-stack apps, and environment-aware configuration. Agents help refactor existing CDK apps, wire cross-stack references, and review diffs before deployment. Triggers include aws cdk typescript, create cdk app, cdk stack, cdk construct, cdk deploy, and cdk test requests inside developer-kit workflows.

  • TypeScript CDK patterns for apps, stacks, and reusable constructs.
  • Validation loop with cdk synth, tests, diff, and deploy steps.
  • Covers L1 L2 L3 construct selection and multi-stack wiring.
  • Emphasizes IAM, encryption, and environment-aware defaults.
  • Supports serverless and VPC-focused infrastructure modeling.

Aws Cdk by the numbers

  • 1,259 all-time installs (skills.sh)
  • +55 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #296 of 1,041 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

aws-cdk capabilities & compatibility

Capabilities
cdk app and stack scaffolding · reusable construct patterns · synth diff deploy validation · iam and encryption defaults · multi stack environment configuration
Works with
aws
Use cases
devops · api development
From the docs

What aws-cdk says it does

Provides AWS CDK TypeScript patterns for defining, validating, and deploying AWS infrastructure as code.
SKILL.md
npx cdk init app --language typescript
SKILL.md
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill aws-cdk

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.3k
repo stars311
Security audit3 / 3 scanners passed
Last updatedJune 22, 2026
Repositorygiuseppe-trisciuoglio/developer-kit

How should I structure and validate an AWS CDK TypeScript app before deploying infrastructure changes?

Build and validate AWS CDK TypeScript apps, stacks, constructs, synth, diff, and deploy loops.

Who is it for?

Developers creating or refactoring AWS CDK TypeScript infrastructure with validation-first delivery.

Skip if: Skip for raw CloudFormation YAML editing without CDK or non-AWS infrastructure tools.

When should I use this skill?

User creates CDK apps, constructs, stacks, or runs cdk synth, diff, and deploy tasks.

What you get

CDK app or stack changes with synth-tested constructs, reviewed diffs, and safer IAM and encryption defaults.

  • CDK stack source code
  • Synthesized CloudFormation templates

By the numbers

  • Covers 8 core CDK concept sections in the developer-kit readme

Files

SKILL.mdMarkdownGitHub ↗

AWS CDK TypeScript

Overview

Use this skill to build AWS infrastructure in TypeScript with reusable constructs, safe defaults, and a validation-first delivery loop.

When to Use

Use this skill when:

  • Creating or refactoring a CDK app, stack, or reusable construct in TypeScript
  • Choosing between L1, L2, and L3 constructs
  • Building serverless, networking, or security-focused AWS infrastructure
  • Wiring multi-stack applications and environment-aware deployments
  • Validating infrastructure changes with cdk synth, tests, cdk diff, and cdk deploy

Instructions

1. Project Initialization

# Create a new CDK app
npx cdk init app --language typescript

# Project structure
my-cdk-app/
├── bin/
│   └── my-cdk-app.ts          # App entry point (instantiates stacks)
├── lib/
│   └── my-cdk-app-stack.ts    # Stack definition
├── test/
│   └── my-cdk-app.test.ts     # Tests
├── cdk.json                    # CDK configuration
├── tsconfig.json
└── package.json

2. Core Architecture

import { App, Stack, StackProps, CfnOutput, RemovalPolicy } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as s3 from 'aws-cdk-lib/aws-s3';

// Define a reusable stack
class StorageStack extends Stack {
  public readonly bucketArn: string;

  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const bucket = new s3.Bucket(this, 'DataBucket', {
      versioned: true,
      encryption: s3.BucketEncryption.S3_MANAGED,
      removalPolicy: RemovalPolicy.RETAIN,
      blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
    });

    this.bucketArn = bucket.bucketArn;
    new CfnOutput(this, 'BucketName', { value: bucket.bucketName });
  }
}

// App entry point
const app = new App();

new StorageStack(app, 'DevStorage', {
  env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' },
  tags: { Environment: 'dev' },
});

new StorageStack(app, 'ProdStorage', {
  env: { account: '123456789012', region: 'eu-west-1' },
  tags: { Environment: 'prod' },
  terminationProtection: true,
});

app.synth();

3. Construct Levels

LevelDescriptionUse When
L1 (Cfn*)Direct CloudFormation mapping, full controlNeed properties not exposed by L2
L2Curated with sensible defaults and helper methodsStandard resource provisioning (recommended)
L3 (Patterns)Multi-resource architecturesCommon patterns like LambdaRestApi
// L1 — Raw CloudFormation
new s3.CfnBucket(this, 'L1Bucket', { bucketName: 'my-l1-bucket' });

// L2 — Sensible defaults + grant helpers
const bucket = new s3.Bucket(this, 'L2Bucket', { versioned: true });
bucket.grantRead(myLambda);

// L3 — Multi-resource pattern
new apigateway.LambdaRestApi(this, 'Api', { handler: myLambda });

4. CDK Lifecycle Commands

cdk synth          # Synthesize CloudFormation template
cdk diff           # Compare deployed vs local changes
cdk deploy         # Deploy stack(s) to AWS
cdk deploy --all   # Deploy all stacks
cdk destroy        # Tear down stack(s)
cdk ls             # List all stacks in the app
cdk doctor         # Check environment setup

5. Recommended Delivery Loop

1. Model the stack

  • Start with L2 constructs and extract repeated logic into custom constructs.

2. Run `cdk synth`

  • Checkpoint: synthesis succeeds with no missing imports, invalid props, missing context, or unresolved references.
  • If it fails: fix the construct configuration or context values, then rerun cdk synth.

3. Run infrastructure tests

  • Checkpoint: assertions cover IAM scope, stateful resources, and critical outputs.
  • If tests fail: update the stack or test expectations, then rerun the test suite.

4. Run `cdk diff`

  • Checkpoint: review IAM broadening, resource replacement, export changes, and deletes on stateful resources.
  • If the diff is risky: adjust names, dependencies, or RemovalPolicy, then rerun cdk diff.

5. Run `cdk deploy`

  • Checkpoint: the stack reaches CREATE_COMPLETE or UPDATE_COMPLETE.
  • If deploy fails: inspect CloudFormation events, fix quotas, permissions, export conflicts, or bootstrap issues, then retry cdk deploy.

6. Verify runtime outcomes

  • Confirm stack outputs, endpoints, alarms, and integrations behave as expected before moving on.

6. Cross-Stack References

// Stack A exports a value
class NetworkStack extends Stack {
  public readonly vpc: ec2.Vpc;
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);
    this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 });
  }
}

// Stack B imports it via props
interface AppStackProps extends StackProps {
  vpc: ec2.Vpc;
}
class AppStack extends Stack {
  constructor(scope: Construct, id: string, props: AppStackProps) {
    super(scope, id, props);
    new lambda.Function(this, 'Fn', {
      runtime: lambda.Runtime.NODEJS_20_X,
      handler: 'index.handler',
      code: lambda.Code.fromAsset('lambda'),
      vpc: props.vpc,
    });
  }
}

// Wire them together
const network = new NetworkStack(app, 'Network');
new AppStack(app, 'App', { vpc: network.vpc });

Examples

Example 1: Serverless API

import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';

class ServerlessApiStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const table = new dynamodb.Table(this, 'Items', {
      partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
      billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
    });

    const fn = new lambda.Function(this, 'Handler', {
      runtime: lambda.Runtime.NODEJS_20_X,
      handler: 'index.handler',
      code: lambda.Code.fromAsset('lambda'),
      environment: { TABLE_NAME: table.tableName },
    });

    table.grantReadWriteData(fn);

    new apigateway.LambdaRestApi(this, 'Api', { handler: fn });
  }
}

Example 2: CDK Assertion Test

import { Template } from 'aws-cdk-lib/assertions';
import { App } from 'aws-cdk-lib';
import { ServerlessApiStack } from '../lib/serverless-api-stack';

test('creates DynamoDB table with PAY_PER_REQUEST', () => {
  const app = new App();
  const stack = new ServerlessApiStack(app, 'TestStack');
  const template = Template.fromStack(stack);

  template.hasResourceProperties('AWS::DynamoDB::Table', {
    BillingMode: 'PAY_PER_REQUEST',
  });

  template.resourceCountIs('AWS::Lambda::Function', 1);
});

Best Practices

1. One concern per stack — Separate network, compute, storage, and monitoring. 2. Prefer L2 constructs — Drop to Cfn* only when you need unsupported properties. 3. Set explicit environments — Pass env with account and region; avoid implicit production targets. 4. Use grant helpers — Prefer .grant*() over handwritten IAM where possible. 5. Review the diff before deploy — Treat IAM expansion, replacement, and deletes as mandatory checkpoints. 6. Test infrastructure — Cover critical resources with fine-grained assertions. 7. Avoid hardcoded values — Use context, parameters, or environment variables. 8. Use the right `RemovalPolicy`RETAIN for production data, DESTROY only for disposable environments.

Constraints and Warnings

  • CloudFormation limits — Max 500 resources per stack; split large apps into multiple stacks
  • Synthesis is not deploymentcdk synth only generates templates; cdk deploy applies changes
  • Cross-stack references create CloudFormation exports; removing them requires careful ordering
  • Stateful resources (RDS, DynamoDB, S3 with data) — Always set removalPolicy: RETAIN in production
  • Bootstrap required — Run cdk bootstrap once per account/region before first deploy
  • Asset bundling — Lambda code and Docker images are uploaded to the CDK bootstrap bucket

References

Detailed implementation guides are available in the references/ directory:

  • Core Concepts — App lifecycle, stacks, constructs, environments, assets
  • Serverless Patterns — Lambda, API Gateway, DynamoDB, S3 events, Step Functions
  • Networking & VPC — VPC design, subnets, NAT, security groups, VPC endpoints
  • Security Hardening — IAM, KMS, Secrets Manager, WAF, compliance
  • Testing Strategies — Assertions, snapshots, integration tests, CDK Nag

Related skills

Forks & variants (1)

Aws Cdk has 1 known copy in the catalog totaling 2 installs. They canonicalize to this original listing.

How it compares

Pick aws-cdk over generic CloudFormation skills when you want typed constructs, aspect hooks, and the full CDK synthesis pipeline in TypeScript or Python.

FAQ

What validation loop does aws-cdk recommend?

cdk synth, tests, cdk diff, then cdk deploy after reviewing infrastructure changes.

Which construct levels does it cover?

Guidance for choosing L1, L2, and L3 constructs based on reuse and control needs.

What project layout does cdk init create?

bin entry, lib stack, test folder, cdk.json, and tsconfig for a TypeScript CDK app.

Is Aws Cdk safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.