aws-cdk-development
它能做什么
帮你使用 AWS CDK 构建和管理 Amazon Web Services(AWS)云基础设施。它提供一些最佳实践指导,例如资源命名和 Lambda 函数的设置,确保你的基础设施既安全又高效。
适用场景
- ✓当你用 CDK 启动一个新的 AWS 基础设施项目时。
- ✓当你需要重构或改进现有的基础设施时。
- ✓当你想确保基础设施的搭建遵循安全和效率方面的最佳实践时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-cdk-development/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我如何使用 AWS CDK 创建一个 Python Lambda 函数,并让依赖项自动管理?”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具基于 AWS CDK,它允许你用代码(TypeScript 或 Python)来定义基础设施,也就是“基础设施即代码”。它会用验证工具检查你的配置,并针对 Lambda 函数等常见资源提供示例,遵循 AWS 的推荐做法。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Bundled upstream support
Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.
Restored helper safety
scripts/validate-stack.sh runs cdk synth from the caller-selected project root, which executes that project's CDK application and dependencies, can write cdk.out, and may contact AWS context providers if the project requires lookups. Review the project and AWS context before invoking it. The helper does not deploy; deployment needs separate user authorization.
AWS CDK Development
This 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.
AWS Documentation Requirement
Always verify AWS facts using MCP tools (mcp__aws-mcp__* or mcp__*awsdocs*__*) before answering. The aws-mcp-setup dependency is auto-loaded — if MCP tools are unavailable, guide the user through that skill's setup flow.
CDK-Specific MCP Guidance
AWS Labs replaced the dedicated CDK MCP server (awslabs.cdk-mcp-server) with the broader awslabs.aws-iac-mcp-server, which covers CDK alongside CloudFormation and other AWS infrastructure-as-code workflows.
For CDK construct lookups, best-practice recommendations, and pattern guidance, install awslabs.aws-iac-mcp-server. It ships in the deploy-on-aws plugin from awslabs/agent-plugins, or can be registered directly with claude mcp add aws-iac uvx awslabs.aws-iac-mcp-server@latest.
When to reach for it:
- CDK construct recommendations and API lookups
- CDK and CloudFormation best-practice patterns
- Validation of synthesized templates
- Cross-resource configuration guidance
When to Use This Skill
Use this skill when:
- Creating new CDK stacks or constructs
- Refactoring existing CDK infrastructure
- Implementing Lambda functions within CDK
- Following AWS CDK best practices
- Validating CDK stack configurations before deployment
- Verifying AWS service capabilities and regional availability
Core CDK Principles
Resource Naming
CRITICAL: Do NOT explicitly specify resource names when they are optional in CDK constructs.
Why: CDK-generated names enable:
- Reusable patterns: Deploy the same construct/pattern multiple times without conflicts
- Parallel deployments: Multiple stacks can deploy simultaneously in the same region
- Cleaner shared logic: Patterns and shared code can be initialized multiple times without name collision
- Stack isolation: Each stack gets uniquely identified resources automatically
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.
Lambda Function Development
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:
- Automatic bundling and dependency management
- Transpilation handled automatically
- No manual packaging required
- Consistent deployment patterns
Pre-Deployment Validation
Use a multi-layer validation strategy for comprehensive CDK quality checks:
Layer 1: Real-Time IDE Feedback (Recommended)
For TypeScript/JavaScript projects:
…
常见问题
为什么在 CDK 中不应该显式指定资源名称?
不指定名称,CDK 就能自动生成唯一的名称。这样你的代码更容易复用,便于并行部署,也能避免基础设施不同部分之间出现命名冲突。
CDK 如何创建 Lambda 函数?
对于 TypeScript/JavaScript,使用 `@aws-cdk/aws-lambda-nodejs`;对于 Python,使用 `@aws-cdk/aws-lambda-python-alpha`。这些工具会自动处理打包、依赖项和转译,让流程更简单。
什么是部署前验证,为什么它很重要?
它是一个多层检查过程,确保基础设施在部署到 AWS 之前质量过关。它包括 IDE 中的实时反馈、合成阶段的验证(生成模板),以及提交前的安全保障(构建和测试)。
详情
作者的原始描述
AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.
热度
- GitHub 星标
- 48k
- 排名
- #3852
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。