Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Aws Cdk Patterns

ASecurity

当用 TypeScript/Python/Java 编写 AWS CDK 基础设施、设计可复用 L2/L3 构造或多 Stack 应用、评审 CDK 最佳实践时使用;做出有状态/无状态分离、最小权限 IAM、默认监控的生产级 CDK 栈与构造产物;不适用于纯 CloudFormation 模板、Terraform 或一次性 CLI 建资源。触发词:CDK、construct、Stack、Lambda+DynamoDB API

3 stars
0 votes
0 copies
0 views
Added 9/19/2026
ai-agentstypescriptpythonjavanodenodejsawsterraformapidevops

Works with

cursorcliapi

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add findscripter/everything-skills --skill aws-cdk-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Aws Cdk Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Aws Cdk Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/findscripter-aws-cdk-patterns/badge)](https://www.skillsdirectory.com/skills/findscripter-aws-cdk-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: aws-cdk-patterns
title: AWS CDK 构造与基础设施模式
description: 当用 TypeScript/Python/Java 编写 AWS CDK 基础设施、设计可复用 L2/L3 构造或多 Stack 应用、评审 CDK 最佳实践时使用;做出有状态/无状态分离、最小权限 IAM、默认监控的生产级 CDK 栈与构造产物;不适用于纯 CloudFormation 模板、Terraform 或一次性 CLI 建资源。触发词:CDK、construct、Stack、Lambda+DynamoDB API
domain: 研发/devops
triggers: [AWS CDK, CDK 构造, L2 L3 construct, 可复用 CDK 模式, 多 Stack 应用, serverless API Lambda DynamoDB, ECS 服务栈, CDK 评审最佳实践, RemovalPolicy 标签, cdk diff 部署]
tags: [aws-cdk, iac, infrastructure, aws, typescript, serverless, construct, 研发]
level: 进阶
status: stable
agents: [claude-code, codex, cursor, gemini-cli]
tools: [aws-cdk, cdk-cli, TypeScript, Python, Java]
requires: []
related: []
combines_with: []
license: MIT
source: sickn33/agentic-awesome-skills
source_license: MIT
---
## 何时使用

适用:
- 编写可复用的 CDK 构造或模式(L2/L3 construct)。
- 设计多 Stack 的 CDK 应用并管理跨栈引用。
- 落地常见基础设施模式:API + Lambda + DynamoDB、ECS 服务、静态站点、数据管道。
- 按最佳实践与反模式评审已有 CDK 代码。

不该用(负边界):
- 用户要的是纯 CloudFormation 模板,不经过 CDK。
- 任务是 Terraform 专属的。
- 一次性、简单的 CLI 建资源就够了,无需写代码。

## 步骤 / 指令

1. 先识别目标基础设施模式(如无服务器 API、容器服务、数据管道),再选构造。
2. 优先用 L2 构造,避免 L1(`Cfn*`)——L2 自带更安全的默认值;仅当 L2 无对应能力时才下沉到 L1。
3. 所有 IAM 角色与策略遵循最小权限原则,优先用 `grantXxx()`(如 `table.grantReadWriteData(handler)`)而非手写宽泛策略。
4. 为生产就绪合理设置 `RemovalPolicy`(有状态资源用 `RETAIN`)和统一标签 `cdk.Tags.of(this).add(...)`。
5. 按可复用性拆分 Stack:有状态资源(数据库、桶)与无状态资源(计算、API)分栈,便于独立生命周期管理。
6. 默认开启监控:CloudWatch 告警、X-Ray 追踪(`tracing: lambda.Tracing.ACTIVE`)。
7. 每次部署前先 `cdk diff` 核对变更。
8. 不要硬编码账号/区域,用 `cdk.Aws.ACCOUNT_ID`、`cdk.Aws.REGION` 等占位符。

## 示例

无服务器 API 模式(API Gateway + Lambda + DynamoDB),封装为可复用 L3 构造:

```typescript
import { Construct } from "constructs";
import * as cdk from "aws-cdk-lib";
import * as apigateway from "aws-cdk-lib/aws-apigateway";
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";

export class ServerlessApiPattern extends Construct {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const table = new dynamodb.Table(this, "Table", {
      partitionKey: { name: "pk", type: dynamodb.AttributeType.STRING },
      billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
      removalPolicy: cdk.RemovalPolicy.RETAIN, // 有状态资源保留,防误删
    });

    const handler = new lambda.Function(this, "Handler", {
      runtime: lambda.Runtime.NODEJS_20_X,
      handler: "index.handler",
      code: lambda.Code.fromAsset("lambda"),
      environment: { TABLE_NAME: table.tableName },
      tracing: lambda.Tracing.ACTIVE, // 默认开启 X-Ray
    });

    table.grantReadWriteData(handler); // 最小权限授予

    new apigateway.LambdaRestApi(this, "Api", { handler });
  }
}
```

## 注意事项

- 该做:用 `cdk.Tags.of(this).add()` 做一致标签;有状态与无状态资源分栈;每次部署前 `cdk diff`。
- 别做:在有 L2 替代时仍用 L1(`Cfn*`)构造;硬编码账号 ID 或区域(改用 `cdk.Aws.ACCOUNT_ID`)。
- 排障——栈间循环依赖:把共享资源抽到独立的基础(base)栈,通过构造函数 props 传递引用,打破环。
- 边界:本技能产出不能替代环境特定的验证、测试与专家评审;缺少必要输入、权限、安全边界或验收标准时,先停下来澄清。

## 互见

- 纯 CloudFormation / Terraform 等其他 IaC 工具:另寻对应技能。
- IAM 最小权限、CloudWatch 监控告警等专项可与本技能配合使用。

---
采编自 sickn33/antigravity-awesome-skills(MIT 许可)。

Attribution

findscripterfindscripter
View sourceSee grades on GitHubMore from findscripter →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →