Token导航 LogoToken导航

Agent Skill · 前端设计

writing-infrastructure-code(编写基础设施代码)

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写。它适合让 Agent 提炼结构、补齐章节、统一术语、检查链接或把零散材料整理成可读文档。使用时应保留项目已有事实、命令和路径,不要把未确认的信息写成确定结论;涉及对外文案时,还需要控制语气,避免过度营销或夸大能力。

writing-infrastructure-code 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描有提醒项,按安装量在前端设计类的 10,216 个 Skill 里排第 6,634。

总安装 475周安装 20GitHub Stars 350下载 166核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:writing-infrastructure-code(编写基础设施代码)
来源仓库:https://github.com/ancoleman/ai-design-components
仓库路径:skills/writing-infrastructure-code
安装命令:
npx skills add https://github.com/ancoleman/ai-design-components --skill writing-infrastructure-code
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ancoleman/ai-design-components --skill writing-infrastructure-code

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于编写基础设施即代码(IaC)脚本。适合生成 Terraform、Ansible 等自动化配置。可辅助部署环境搭建和资源管理。writing-infrastructure-code 属于前端设计类 Skill,可作为该场景下的辅助能力补充。需确认云平台类型和权限配置正确。应避免在生产环境直接运行未测试的代码。

来源仓库内路径:skills/writing-infrastructure-code

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ancoleman/ai-design-components --skill writing…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

writing-infrastructure-code 怎么安装?

在终端执行 npx skills add https://github.com/ancoleman/ai-design-components --skill writing-infrastru…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

writing-infrastructure-code 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

writing-infrastructure-code 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

writing-infrastructure-code 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

writing-infrastructure-code 用的人多吗?

公开数据是累计安装 475 次,近一周安装 20 次,下载 166 次,GitHub 350 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

writing-infrastructure-code 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
writing-infrastructure-code

编写基础设施代码 · 本页

475350调用外部服务未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Infrastructure as Code

Provision and manage cloud infrastructure using code-based automation tools. This skill covers tool selection, state management, module design, and operational patterns across Terraform/OpenTofu, Pulumi, and AWS CDK.

When to Use

Use this skill when:

  • Provisioning cloud infrastructure (compute, networking, databases, storage)
  • Migrating from manual infrastructure to code-based workflows
  • Designing reusable infrastructure modules
  • Implementing multi-cloud or hybrid-cloud deployments
  • Establishing state management and drift detection patterns
  • Integrating infrastructure provisioning into CI/CD pipelines
  • Evaluating IaC tools (Terraform vs Pulumi vs CDK)

Common requests:

  • "Create a Terraform module for VPC provisioning"
  • "Set up remote state with locking for team collaboration"
  • "Compare Pulumi vs Terraform for our use case"
  • "Design composable infrastructure modules"
  • "Implement drift detection for existing infrastructure"

Core Concepts

Infrastructure as Code Fundamentals

Key Principles:

  1. Declarative vs Imperative - Describe desired state (Terraform) or program infrastructure (Pulumi)
  2. Idempotency - Same input produces same output, safe to re-run
  3. Version Control - Infrastructure changes tracked in Git
  4. State Management - Track actual infrastructure state
  5. Module Composition - Reusable, versioned infrastructure components

Benefits:

  • Reproducibility (same code = same infrastructure)
  • Auditability (Git history shows all changes)
  • Collaboration (code reviews for infrastructure changes)
  • Automation (CI/CD deploys infrastructure)
  • Disaster recovery (rebuild from code)

Tool Selection Framework

Choose IaC tools based on team composition and cloud strategy:

Terraform/OpenTofu - Declarative, HCL-based

  • Multi-cloud and hybrid-cloud deployments
  • Operations/SRE teams prefer declarative approach
  • Largest provider ecosystem (AWS, GCP, Azure, 3000+ providers)
  • Mature module registry and community

Pulumi - Imperative, programming language-based

  • Developer-centric teams familiar with TypeScript/Python/Go
  • Complex logic requires programming constructs (loops, conditionals, functions)
  • Native unit testing using familiar test frameworks
  • Strong typing and IDE support

AWS CDK - AWS-native, programming language-based

  • AWS-only infrastructure
  • Tight integration with AWS services
  • L1/L2/L3 construct abstractions
  • CloudFormation under the hood

Decision Tree:

Multi-cloud required?
├─ YES → Team composition?
│  ├─ Ops/SRE focused → Terraform/OpenTofu
│  └─ Developer focused → Pulumi
└─ NO → AWS only?
   ├─ YES → Language preference?
   │  ├─ HCL/declarative → Terraform
   │  ├─ TypeScript/Python → AWS CDK
   │  └─ YAML/simple → CloudFormation
   └─ NO → GCP/Azure only?
      └─ Terraform or Pulumi

State Management Architecture

Remote state with locking enables team collaboration:

Backend Selection:

Cloud ProviderRecommended BackendLocking Mechanism
AWSS3 + DynamoDBDynamoDB table
GCPGoogle Cloud StorageNative
AzureAzure Blob StorageLease-based
Multi-cloudTerraform Cloud/EnterpriseBuilt-in
PulumiPulumi ServiceBuilt-in

State Isolation Strategies:

  1. Directory Separation (recommended for most teams)

- Separate directories per environment (prod/, staging/, dev/) - Complete state file isolation - No risk of cross-environment contamination

  1. Workspaces

- Single codebase, multiple environments - Shared state backend, environment namespacing - Risk: accidental cross-environment operations

  1. Layered Architecture

- Separate state files for networking, compute, data layers - Blast radius reduction - Cross-layer references via remote state data sources

Critical State Management Rules:

  • Always use remote state for team environments
  • Enable state file encryption at rest
  • Enable versioning on state storage
  • Use state locking to prevent concurrent modifications
  • Never commit state files to Git
  • Mark sensitive outputs as sensitive = true

Module Design Patterns

Composable Module Structure:

modules/
├── vpc/              # Network foundation
├── security-group/   # Reusable security group patterns
├── rds/              # Database with backups, encryption
├── ecs-cluster/      # Container orchestration base
├── ecs-service/      # Individual microservice
└── alb/              # Application load balancer

Module Versioning:

  • Pin module versions in production (version = "5.1.0")
  • Use semantic versioning for internal modules
  • Test module updates in non-prod first
  • Maintain CHANGELOG for module releases

Module Design Principles:

  • Clear input contract (required vs optional variables)
  • Documented outputs (what consumers can reference)
  • Sane defaults where possible
  • Validation rules for inputs
  • Examples directory showing usage

When to Create a Module:

  • Resource group is reused 3+ times
  • Clear boundaries and responsibilities
  • Stable interface contract
  • Team has module maintenance capacity

When to Keep Monolithic:

  • One-off infrastructure
  • Rapid prototyping phase
  • High coupling between resources
  • Small team, simple infrastructure

Quick Reference

Terraform/OpenTofu Commands

# Initialize providers and backend
terraform init

# Plan changes (preview)
terraform plan

# Apply changes
terraform apply

# Destroy infrastructure
terraform destroy

# Format HCL files
terraform fmt

# Validate syntax
terraform validate

# Show state
terraform state list
terraform state show <resource>

# Import existing resources
terraform import <resource.name> <id>

# Workspace management
terraform workspace list
terraform workspace new staging
terraform workspace select prod

Pulumi Commands

# Initialize new project
pulumi new aws-typescript

# Preview changes
pulumi preview

# Apply changes
pulumi up

# Destroy infrastructure
pulumi destroy

# Show stack outputs
pulumi stack output

# Manage stacks
pulumi stack ls
pulumi stack select prod

# Import existing resources
pulumi import <type> <name> <id>

# Export/import state
pulumi stack export > state.json
pulumi stack import < state.json

AWS CDK Commands

# Initialize new app
cdk init app --language typescript

# Synthesize CloudFormation
cdk synth

# Preview changes
cdk diff

# Deploy stack
cdk deploy

# Destroy stack
cdk destroy

# Bootstrap account/region
cdk bootstrap

# List stacks
cdk list

Common Patterns Checklist

Infrastructure Provisioning:

  • Remote state configured with locking
  • State file encryption enabled
  • Provider versions pinned
  • Module versions pinned (production)
  • Variables have descriptions and types
  • Sensitive outputs marked as sensitive
  • Tagging strategy implemented
  • Cost allocation tags applied

Module Development:

  • Clear README with usage examples
  • Required vs optional variables documented
  • Outputs documented with descriptions
  • Validation rules for critical inputs
  • Examples directory with working code
  • Tests for module behavior (Terratest/CDK assertions)
  • CHANGELOG for version tracking
  • Semantic versioning followed

Operational Readiness:

  • Drift detection scheduled
  • CI/CD pipeline for plan/apply
  • State backup strategy
  • Disaster recovery documented
  • Team access controls configured (IAM/RBAC)
  • Cost estimation integrated (Infracost)
  • Security scanning integrated (Checkov/tfsec)
  • Documentation kept current

Detailed Documentation

For comprehensive patterns and implementation details:

Tool-Specific Patterns:

  • references/terraform-patterns.md - Terraform/OpenTofu best practices, HCL patterns
  • references/pulumi-patterns.md - Pulumi across TypeScript/Python/Go

Architecture and Design:

  • references/state-management.md - Remote state, locking, isolation strategies
  • references/module-design.md - Composable modules, versioning, registries

Operations:

  • references/drift-detection.md - Detecting and remediating infrastructure drift

Working Examples

Practical implementations demonstrating IaC patterns:

Terraform Examples:

  • examples/terraform/vpc-module/ - Multi-AZ VPC with public/private subnets
  • examples/terraform/ecs-service/ - ECS service with ALB, autoscaling
  • examples/terraform/rds-cluster/ - Aurora cluster with backups, encryption
  • examples/terraform/state-backend/ - S3 + DynamoDB backend setup

Pulumi Examples:

  • examples/pulumi/typescript/vpc/ - TypeScript VPC component
  • examples/pulumi/python/ecs-service/ - Python ECS service
  • examples/pulumi/go/rds-cluster/ - Go RDS cluster
  • examples/pulumi/testing/ - Unit tests for Pulumi programs

AWS CDK Examples:

  • examples/cdk/typescript/vpc-stack/ - VPC using L2 constructs
  • examples/cdk/typescript/ecs-fargate/ - Fargate service with ALB
  • examples/cdk/typescript/pipeline-stack/ - Self-mutating CDK pipeline
  • examples/cdk/testing/ - CDK assertions and snapshot tests

Utility Scripts

Automated validation and operational tools:

  • scripts/validate-terraform.sh - Terraform fmt, validate, tflint
  • scripts/cost-estimate.sh - Infracost wrapper for cost analysis
  • scripts/drift-check.sh - Scheduled drift detection
  • scripts/security-scan.sh - Checkov/tfsec security scanning
  • scripts/state-backup.sh - State file backup automation
  • scripts/module-release.sh - Module versioning and publishing

Integration with Other Skills

Deployment Pipeline:

  • building-ci-pipelines - Automate terraform plan/apply in CI/CD
  • gitops-workflows - GitOps-based infrastructure deployment

Platform Engineering:

  • kubernetes-operations - Provision EKS, GKE, AKS clusters
  • platform-engineering - Internal developer platform infrastructure

Security:

  • secret-management - Provision Vault, External Secrets Operator
  • security-hardening - Implement infrastructure security controls
  • compliance-frameworks - Policy-as-code for compliance

Operations:

  • observability - Provision monitoring infrastructure (Prometheus, Grafana)
  • disaster-recovery - Infrastructure rebuild procedures
  • cost-optimization - Implement cost controls via IaC

Data Platform:

  • data-architecture - Provision data lakes, warehouses
  • streaming-data - Provision Kafka, Kinesis infrastructure

Best Practices

Development Workflow:

  1. Write infrastructure code in feature branches
  2. Run terraform plan / pulumi preview locally
  3. Submit pull request with plan output
  4. Code review focuses on security, cost, blast radius
  5. CI runs automated tests and security scans
  6. Apply only after approval and CI passes
  7. Monitor for drift post-deployment

State Management:

  • Use remote state from day one (never local state for teams)
  • Separate state files per environment
  • Enable state locking to prevent concurrent modifications
  • Version state storage for rollback capability
  • Encrypt state at rest (contains sensitive data)
  • Regular state backups to separate location

Module Development:

  • Start with monolithic code, extract modules when patterns emerge
  • Design for reusability but avoid premature abstraction
  • Document all inputs and outputs
  • Provide working examples in examples/ directory
  • Pin provider versions in modules
  • Test modules before publishing
  • Use semantic versioning for releases

Security:

  • Scan IaC for security issues before apply (Checkov, tfsec)
  • Never commit secrets to code (use secret references)
  • Mark sensitive outputs as sensitive = true
  • Implement least-privilege IAM policies
  • Enable resource encryption by default
  • Use private module registries for internal modules

Cost Management:

  • Estimate costs before applying changes (Infracost)
  • Tag all resources for cost allocation
  • Review cost impact in pull requests
  • Set up cost alerts for drift
  • Rightsize resources based on usage

Operational Excellence:

  • Schedule regular drift detection
  • Document disaster recovery procedures
  • Maintain runbooks for common operations
  • Monitor state file access logs
  • Practice infrastructure rebuilds periodically
  • Keep provider versions current with testing

Common Pitfalls

State File Issues:

  • Manual state editing - Use terraform state commands, not direct edits
  • No state locking - Race conditions corrupt state
  • Local state for teams - State divergence across team members
  • Large state files - Break into multiple state files by layer

Module Design:

  • Over-abstraction - Too generic, hard to understand
  • Under-abstraction - Copy-paste code everywhere
  • No version pinning - Unexpected breaking changes
  • No examples - Users don't know how to consume module

Operations:

  • No drift detection - Manual changes go unnoticed
  • Direct resource modification - Bypassing IaC creates drift
  • No rollback plan - Can't recover from failed apply
  • Ignoring plan output - Surprises during apply

Security:

  • Secrets in code - Hard-coded credentials
  • No security scanning - Vulnerabilities in production
  • Overly permissive IAM - Excessive privileges
  • No state encryption - Sensitive data exposed

Troubleshooting Guide

State Lock Issues:

terraform force-unlock <lock-id>  # Use only if certain no other process running

Import Existing Resources:

terraform import aws_vpc.main vpc-12345678
pulumi import aws:ec2/vpc:Vpc main vpc-12345678

Drift Detection:

terraform plan -detailed-exitcode  # Exit 2 = drift detected
pulumi preview --diff

For detailed drift remediation, see references/drift-detection.md.

State Recovery:

# Terraform: Restore from S3 versioning
aws s3 cp s3://bucket/backup/terraform.tfstate terraform.tfstate

# Pulumi: Restore from checkpoint
pulumi stack export --version <timestamp> | pulumi stack import

Related Skills

For cloud-specific implementations:

  • aws-patterns - AWS-specific resource patterns
  • gcp-patterns - GCP-specific resource patterns
  • azure-patterns - Azure-specific resource patterns

For infrastructure operations:

  • kubernetes-operations - Manage Kubernetes clusters provisioned via IaC
  • gitops-workflows - GitOps-based infrastructure deployment
  • platform-engineering - Internal developer platforms

For security and compliance:

  • security-hardening - Infrastructure security controls
  • secret-management - Secret injection and rotation
  • compliance-frameworks - Policy-as-code for compliance

For deployment automation:

  • building-ci-pipelines - CI/CD for infrastructure code
  • deploying-applications - Application deployment to provisioned infrastructure

For cost and observability:

  • cost-optimization - FinOps practices for infrastructure
  • observability - Monitoring infrastructure health

平台分布

Codex

37.51%
按下载量换算62

Claude

27.9%
按下载量换算46

Cursor

19.65%
按下载量换算33

Gemini CLI

10.25%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills