AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python. Use when creating CDK stacks, defining CDK constructs, implementing infrastructure as code, or when the user mentions CDK, CloudFormation, IaC, cdk synth, cdk deploy, or wants to define AWS infrastructure programmatically. Covers CDK app structure, construct patterns, stack composition, and deployment workflows.
/plugin marketplace add zxkane/aws-skills/plugin install aws-cdk@aws-skillsThis skill is limited to using the following tools:
references/cdk-patterns.mdscripts/validate-stack.shThis skill provides comprehensive guidance for developing AWS infrastructure using the Cloud Development Kit (CDK), with integrated MCP servers for accessing latest AWS knowledge and CDK utilities.
CRITICAL: This skill requires AWS MCP tools for accurate, up-to-date AWS information.
Always verify using AWS MCP tools (if available):
mcp__aws-mcp__aws___search_documentation or mcp__*awsdocs*__aws___search_documentation - Search AWS docsmcp__aws-mcp__aws___read_documentation or mcp__*awsdocs*__aws___read_documentation - Read specific pagesmcp__aws-mcp__aws___get_regional_availability - Check service availabilityIf AWS MCP tools are unavailable:
This skill includes the CDK MCP server automatically configured with the plugin:
When to use: For CDK-specific guidance and utilities
Important: Leverage this server for CDK construct guidance and advanced CDK operations.
Use this skill when:
CRITICAL: Do NOT explicitly specify resource names when they are optional in CDK constructs.
Why: CDK-generated names enable:
Pattern: Let CDK generate unique names automatically using CloudFormation's naming mechanism.
// ❌ BAD - Explicit naming prevents reusability and parallel deployments
new lambda.Function(this, 'MyFunction', {
functionName: 'my-lambda', // Avoid this
// ...
});
// ✅ GOOD - Let CDK generate unique names
new lambda.Function(this, 'MyFunction', {
// No functionName specified - CDK generates: StackName-MyFunctionXXXXXX
// ...
});
Security Note: For different environments (dev, staging, prod), follow AWS Security Pillar best practices by using separate AWS accounts rather than relying on resource naming within a single account. Account-level isolation provides stronger security boundaries.
Use the appropriate Lambda construct based on runtime:
TypeScript/JavaScript: Use @aws-cdk/aws-lambda-nodejs
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
new NodejsFunction(this, 'MyFunction', {
entry: 'lambda/handler.ts',
handler: 'handler',
// Automatically handles bundling, dependencies, and transpilation
});
Python: Use @aws-cdk/aws-lambda-python
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
new PythonFunction(this, 'MyFunction', {
entry: 'lambda',
index: 'handler.py',
handler: 'handler',
// Automatically handles dependencies and packaging
});
Benefits:
Use a multi-layer validation strategy for comprehensive CDK quality checks:
For TypeScript/JavaScript projects:
Install cdk-nag for synthesis-time validation:
npm install --save-dev cdk-nag
Add to your CDK app:
import { Aspects } from 'aws-cdk-lib';
import { AwsSolutionsChecks } from 'cdk-nag';
const app = new App();
Aspects.of(app).add(new AwsSolutionsChecks());
Optional - VS Code users: Install CDK NAG Validator extension for faster feedback on file save.
For Python/Java/C#/Go projects: cdk-nag is available in all CDK languages and provides the same synthesis-time validation.
Synthesis with cdk-nag: Validate stack with comprehensive rules
cdk synth # cdk-nag runs automatically via Aspects
Suppress legitimate exceptions with documented reasons:
import { NagSuppressions } from 'cdk-nag';
// Document WHY the exception is needed
NagSuppressions.addResourceSuppressions(resource, [
{
id: 'AwsSolutions-L1',
reason: 'Lambda@Edge requires specific runtime for CloudFront compatibility'
}
]);
Build: Ensure compilation succeeds
npm run build # or language-specific build command
Tests: Run unit and integration tests
npm test # or pytest, mvn test, etc.
Validation Script: Meta-level checks
./scripts/validate-stack.sh
The validation script now focuses on:
Always verify before implementing:
Example scenarios:
Leverage for CDK-specific guidance:
Example scenarios:
For detailed CDK patterns, anti-patterns, and architectural guidance, refer to the comprehensive reference:
File: references/cdk-patterns.md
This reference includes:
scripts/validate-stack.sh - Pre-deployment validationreferences/cdk-patterns.md - Detailed pattern libraryWhen GitHub Actions workflow files exist in the repository, ensure all checks defined in .github/workflows/ pass before committing. This prevents CI/CD failures and maintains code quality standards.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.