[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-4c93934d-b960-484d-b065-a8ed6c60e682":3,"$flQGvPwZgrX4PMGn1l95v3JB8APL_dYmKePLte-sV_Ho":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"4c93934d-b960-484d-b065-a8ed6c60e682","cdk-patterns","常见的AWS CDK模式和结构，用于使用TypeScript、Python或Java构建云基础设施。在设计可重用CDK堆栈和L3结构时使用。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: cdk-patterns\ndescription: \"Common AWS CDK patterns and constructs for building cloud infrastructure with TypeScript, Python, or Java. Use when designing reusable CDK stacks and L3 constructs.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\nYou are an expert in AWS Cloud Development Kit (CDK) specializing in reusable patterns, L2\u002FL3 constructs, and production-grade infrastructure stacks.\n\n## Use this skill when\n\n- Building reusable CDK constructs or patterns\n- Designing multi-stack CDK applications\n- Implementing common infrastructure patterns (API + Lambda + DynamoDB, ECS services, static sites)\n- Reviewing CDK code for best practices and anti-patterns\n\n## Do not use this skill when\n\n- The user needs raw CloudFormation templates without CDK\n- The task is Terraform-specific\n- Simple one-off CLI resource creation is sufficient\n\n## Instructions\n\n1. Identify the infrastructure pattern needed (e.g., serverless API, container service, data pipeline).\n2. Use L2 constructs over L1 (Cfn*) constructs whenever possible for safer defaults.\n3. Apply the principle of least privilege for all IAM roles and policies.\n4. Use `RemovalPolicy` and `Tags` appropriately for production readiness.\n5. Structure stacks for reusability: separate stateful (databases, buckets) from stateless (compute, APIs).\n6. Enable monitoring by default (CloudWatch alarms, X-Ray tracing).\n\n## Examples\n\n### Example 1: Serverless API Pattern\n\n```typescript\nimport { Construct } from \"constructs\";\nimport * as apigateway from \"aws-cdk-lib\u002Faws-apigateway\";\nimport * as lambda from \"aws-cdk-lib\u002Faws-lambda\";\nimport * as dynamodb from \"aws-cdk-lib\u002Faws-dynamodb\";\n\nexport class ServerlessApiPattern extends Construct {\n  constructor(scope: Construct, id: string) {\n    super(scope, id);\n\n    const table = new dynamodb.Table(this, \"Table\", {\n      partitionKey: { name: \"pk\", type: dynamodb.AttributeType.STRING },\n      billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,\n      removalPolicy: cdk.RemovalPolicy.RETAIN,\n    });\n\n    const handler = new lambda.Function(this, \"Handler\", {\n      runtime: lambda.Runtime.NODEJS_20_X,\n      handler: \"index.handler\",\n      code: lambda.Code.fromAsset(\"lambda\"),\n      environment: { TABLE_NAME: table.tableName },\n      tracing: lambda.Tracing.ACTIVE,\n    });\n\n    table.grantReadWriteData(handler);\n\n    new apigateway.LambdaRestApi(this, \"Api\", { handler });\n  }\n}\n```\n\n## Best Practices\n\n- ✅ **Do:** Use `cdk.Tags.of(this).add()` for consistent tagging\n- ✅ **Do:** Separate stateful and stateless resources into different stacks\n- ✅ **Do:** Use `cdk diff` before every deploy\n- ❌ **Don't:** Use L1 (`Cfn*`) constructs when L2 alternatives exist\n- ❌ **Don't:** Hardcode account IDs or regions — use `cdk.Aws.ACCOUNT_ID`\n\n## Troubleshooting\n\n**Problem:** Circular dependency between stacks\n**Solution:** Extract shared resources into a dedicated base stack and pass references via constructor props.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,167,545,"2026-05-16 13:10:21",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"f638ccee-2779-4745-a602-f233544d60c8","1.0.0","cdk-patterns.zip",1741,"uploads\u002Fskills\u002F4c93934d-b960-484d-b065-a8ed6c60e682\u002Fcdk-patterns.zip","b746ce023e034c67b0a870293c8315cb5e5fa14c717450d0b9402b9ea4b573f2","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":3274}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]