agentleFS
SWEStashSWEStash/swe-workflow-skills/skills/infrastructure-as-code/SKILL.md

infrastructure-as-code

Skill1 starsChanged 4 days agoMITView on GitHub

Write and review IaC with Terraform, CloudFormation, Pulumi, or CDK — modularity, security, state management. Triggers: Terraform, CloudFormation, Pulumi, infrastructure as code, IaC, provision, cloud resources, terraform module, state management, terraform plan, CDK, drift, remote state.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use feature-flag-lifecycle, mcp-server-development and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • WanbinyuSkill

    feature-flag-lifecycle

    Manage feature flag add, rollout, and removal. Use when introducing flags or cleaning old flags, or Chinese "特性开关", "feature flag", "灰度", "删 flag". Prevent eternal flags.

    Also in 3 projects that use this

  • PantaniSkill

    mcp-server-development

    Implementation patterns for the ableton-mind TypeScript MCP server: Zod tools, resources, prompts, bridge client, verify loop, transactions and idempotency.

    Also in 3 projects that use this

  • harrissohail6Skill

    ci-cd-pipelines

    CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    query-optimization

    Database query optimization

    Also in 3 projects that use this

  • travisjneumanSkill

    data-engineering

    ETL/ELT pipelines, data warehousing (BigQuery, Snowflake, Redshift), stream processing (Kafka, Spark Streaming), orchestration (Airflow, Dagster, Prefect), dbt transformations, and data lake architecture. Use when building data pipelines, designing warehouse schemas, or implementing real-time data processing.

    Also in 3 projects that use this

  • SkeneTechnologiesSkill

    product-analytics

    When the user wants to set up product analytics -- including event taxonomy, tracking plans, funnel analysis, or tool selection (Mixpanel, Amplitude, PostHog). Also use when the user says "event tracking," "analytics setup," "tracking plan," "analytics implementation," or "user identification." For PLG metrics, see plg-metrics. For experimentation, see growth-experimentation.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write and review IaC that is modular, secure, and maintainable.

    line 8
  2. Distinctive:

    Before writing any IaC:

    line 14
  3. Distinctive:

    Follow these principles. Use templates/terraform-module.md as a starting point for module structure, variables, outputs, and README format.

    line 47
  4. Distinctive:

    Parameterization: Use variables for anything that differs between environments.

    line 51
  5. Distinctive:

    State management: Use remote state backends (S3 + DynamoDB for Terraform, etc.).

    line 53
  6. Distinctive:

    Tagging: Every resource gets tags for cost allocation, ownership, and environment identification.

    line 57
  7. Very specific:

    Use plan output as the PR artifact — reviewers should see what will change

    line 75
  8. Distinctive:

    Use workspace or directory-per-environment patterns to prevent accidental cross-environment changes

    line 77
  9. Distinctive:

    KISS: Start with simple resources, refactor into modules when patterns repeat.

    line 82
  10. Distinctive:

    YAGNI: Don't create a module for a resource you define once.

    line 83

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Infrastructure as Code

Write and review IaC that is modular, secure, and maintainable. Infrastructure should be treated with the same rigor as application code — versioned, tested, reviewed, and deployed through pipelines.

Workflow

Step 1: Understand the Infrastructure Need

Before writing any IaC:

  • What resources are needed? Compute, storage, networking, databases, queues, CDN?
  • Which cloud provider? AWS, GCP, Azure, or multi-cloud?
  • Which IaC tool? Terraform (cloud-agnostic, declarative), CloudFormation (AWS-native), Pulumi (imperative, multi-language), CDK (AWS, TypeScript/Python)?
  • What environments? Dev, staging, production? How do they differ (instance sizes, replicas)?
  • What exists already? Importing existing resources? Greenfield?

Step 2: Design the Module Structure

Organize IaC for reusability and clarity:

infrastructure/
├── modules/                 # Reusable modules
│   ├── networking/          # VPC, subnets, security groups
│   ├── database/            # RDS, ElastiCache
│   ├── compute/             # ECS, EKS, Lambda
│   └── monitoring/          # CloudWatch, alerting
├── environments/
│   ├── dev/
│   │   ├── main.tf          # Compose modules with dev params
│   │   └── terraform.tfvars
│   ├── staging/
│   └── production/
├── backend.tf               # State backend configuration
└── versions.tf              # Provider version constraints

Each module should be independently usable with well-defined inputs (variables) and outputs.

Step 3: Write the Configuration

Follow these principles. Use templates/terraform-module.md as a starting point for module structure, variables, outputs, and README format.

Modularity: Each module does one thing (networking, database, compute). Modules compose through outputs → inputs.

Parameterization: Use variables for anything that differs between environments. Never hardcode region, instance size, replica count, or credentials.

State management: Use remote state backends (S3 + DynamoDB for Terraform, etc.). Enable state locking. Never commit state files to git.

Security by default: Encrypt at rest, restrict security groups to minimum required ports, use IAM roles (not keys), enable logging.

Tagging: Every resource gets tags for cost allocation, ownership, and environment identification.

Step 4: Review and Validate

Before applying:

  • terraform plan shows only expected changes
  • No hardcoded secrets or credentials
  • Security groups follow least-privilege (no 0.0.0.0/0 ingress on sensitive ports)
  • Encryption enabled for storage and databases
  • State backend is remote with locking enabled
  • All resources are tagged (environment, team, project)
  • Modules have input validation (variable constraints)
  • Outputs are defined for values downstream modules need

Step 5: Plan Deployment

  • IaC changes should go through the same PR review process as application code
  • Use plan output as the PR artifact — reviewers should see what will change
  • Apply through CI/CD pipeline, never from a developer's laptop
  • Use workspace or directory-per-environment patterns to prevent accidental cross-environment changes

Principles Applied

  • DRY: Modules eliminate repeated resource definitions across environments.
  • KISS: Start with simple resources, refactor into modules when patterns repeat.
  • YAGNI: Don't create a module for a resource you define once. Modules earn their existence through reuse.
  • Functional Independence: Each module manages its own resources with clean interfaces. No module reaches into another's state.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.