aws-cdk

Authors, deploys, and troubleshoots AWS CDK infrastructure in TypeScript or Python.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/sakicodes/BuildFestHackathon26 --skill aws-cdk-sakicodes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: aws-cdk
Source: https://github.com/sakicodes/BuildFestHackathon26/tree/main/.agents/skills/aws-cdk
Command: npx skills add https://github.com/sakicodes/BuildFestHackathon26 --skill aws-cdk-sakicodes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing and operating AWS CDK infrastructure involves many failure modes: cross-stack reference deadlocks, accidental resource replacement from construct ID changes, stuck UPDATE_ROLLBACK_FAILED stacks, synth-time module errors, and credential or bootstrap misconfigurations. This Skill provides the domain expertise to author constructs correctly, deploy safely, and diagnose CDK and CloudFormation errors quickly. ## Core Features & Use Cases - Construct Authoring & Patterns: Guidance on L1/L2/L3 construct selection, escape hatches, cross-stack references, custom constructs, and testing with Template assertions. - Deployment Workflows: Bootstrap procedures, project setup for TypeScript and Python, cdk-nag compliance checks, drift detection, resource import, and safe refactoring with cdk refactor. - Troubleshooting Playbooks: Step-by-step diagnosis for deploy failures, credential errors, synth failures, asset bundling issues, and v1-to-v2 migration problems. - Use Case: A deploy fails with "Export cannot be deleted as it is in use". The Skill walks you through the three-deploy reference-weakening fix using CrossStackReferences.of() with ReferenceStrength.BOTH then WEAK. ## Quick Start Ask the assistant to help you write a CDK stack, run cdk deploy, or diagnose a specific CDK or CloudFormation error message you are seeing.

Frequently Asked Questions about aws-cdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix the CDK deadly embrace cross-stack reference error?

The deadly embrace occurs when removing an export still imported by another stack. Weaken the reference first using CrossStackReferences.of(resource).produce(ReferenceStrength.BOTH), then WEAK, then remove it, deploying between each step.

How do I prevent CDK from replacing stateful resources during refactoring?

Construct ID changes alter CloudFormation logical IDs and trigger replacement. Use cdk refactor --unstable=refactor for moves and renames, run cdk diff before every deploy, and lock logical IDs of stateful resources with unit tests.

How do I import existing AWS resources into a CDK stack?

Use cdk import interactively or with --resource-mapping for CI, or run cdk deploy --import-existing-resources to match resources by explicit physical names. For read-only references, use from* methods like Bucket.fromBucketName.

Why does cdk deploy fail with NoCredentials or ExpiredToken?

These errors mean the CLI cannot authenticate. Run aws sts get-caller-identity and cdk doctor first, then refresh expired SSO sessions with aws sso login, set the correct profile, and verify sts:AssumeRole on bootstrap roles.

Does this CDK guidance apply to raw CloudFormation or Terraform?

No. The Skill explicitly excludes raw CloudFormation YAML/JSON, SAM, Terraform, and Pulumi. It covers only CDK authoring, deployment, and troubleshooting in TypeScript or Python.

How do I recover a stack stuck in UPDATE_ROLLBACK_FAILED?

Run cdk rollback $STACK to recover, or cdk rollback $STACK --orphan <LogicalId> to skip a resource that cannot roll back. Afterward run cdk diff, fix the root cause, and redeploy.