Managing cloud infrastructure using declarative and imperative IaC tools. Use when provisioning cloud resources (Terraform/OpenTofu for multi-cloud, Pulumi for developer-centric workflows, AWS CDK for AWS-native infrastructure), designing reusable modules, implementing state management patterns, or establishing infrastructure deployment workflows.
View on GitHubancoleman/ai-design-components
backend-ai-skills
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/ancoleman/ai-design-components/blob/main/skills/writing-infrastructure-code/SKILL.md -a claude-code --skill writing-infrastructure-codeInstallation paths:
.claude/skills/writing-infrastructure-code/# 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 modul