agentleFS
sohaibdevvsohaibdevv/AI-AGENT-SKILLS/skills/infrastructure-as-code/SKILL.md

infrastructure-as-code

Skill2 starsChanged 6 months agoMITView on GitHub

Manage infrastructure with version-controlled, reviewed, and tested IaC

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use containerization.

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.
  • mmondoraSkill

    containerization

    Docker best practices for cloud-native applications. Multi-stage builds, distroless images, security scanning, non-root users, Cloud Run orchestration. Use when writing Dockerfiles, configuring container builds, or deploying to Cloud Run/GKE.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before provisioning any cloud resource

    line 14
  2. Distinctive:

    Before modifying production infrastructure

    line 15
  3. Distinctive:

    When investigating a drift between expected and actual infrastructure state

    line 16
  4. Distinctive:

    Write the IaC code that represents the desired state before applying it.

    line 21
  5. Distinctive:

    Use remote state with locking (never local state for team environments)

    line 39
  6. Distinctive:

    Never manually modify state files

    line 40
  7. Distinctive:

    Test: can you destroy and recreate from scratch?

    line 42
  8. Distinctive:

    Run drift detection on a schedule.

    line 45
  9. Distinctive:

    No secrets in IaC code or state files

    line 48
  10. Distinctive:

    Use: Vault, AWS Secrets Manager, GCP Secret Manager, or similar

    line 49
  11. Distinctive:

    Wait for validation at each stage before proceeding.

    line 59

“Common” is measured: kept by at least 6 in 10 of the 10 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

Overview

Infrastructure defined by hand is infrastructure that drifts, that can't be reviewed, and that can't be reproduced. This skill enforces that all infrastructure is version-controlled code with the same discipline as application code: specs, reviews, tests, and staged deployment.

When to Use

  • Before provisioning any cloud resource
  • Before modifying production infrastructure
  • When investigating a drift between expected and actual infrastructure state

Process

Step 1: Define the desired state first

Write the IaC code that represents the desired state before applying it. Terraform plan / Pulumi preview / CloudFormation change set must be reviewed before apply.

Step 2: Review the plan output

The plan is the diff for infrastructure changes. Review it as carefully as a code diff:

  • Are only expected resources being created/modified/destroyed?
  • Are any resources being replaced (destroy + create) that should only be modified?
  • Are sensitive values being exposed in the plan output?

Step 3: Blast radius analysis

Before applying:

  • What is the maximum impact if this change fails?
  • Does this change affect production traffic?
  • Does this change touch the database, auth system, or network layer?
  • Is the rollback procedure documented?

High blast radius changes require explicit approval from a second engineer.

Step 4: State management

  • Use remote state with locking (never local state for team environments)
  • Never manually modify state files
  • Version state file changes
  • Test: can you destroy and recreate from scratch?

Step 5: Drift detection

Run drift detection on a schedule. If the actual state diverges from the IaC state, investigate and resolve - don't let drift accumulate.

Step 6: Secrets management

  • No secrets in IaC code or state files
  • Use: Vault, AWS Secrets Manager, GCP Secret Manager, or similar
  • Rotate secrets via IaC, not manually

Step 7: Test the IaC

  • Unit tests for modules (Terratest, Pulumi testing)
  • Integration tests: deploy to a non-prod environment and verify
  • Destroy test: can you tear it down and recreate it?

Step 8: Staged apply

Apply to: development → staging → production. Wait for validation at each stage before proceeding.

Anti-Rationalizations

"It's a small change - I'll do it in the console" Console changes become invisible drift. IaC is the only source of truth. No exceptions.

"We don't need to test infrastructure" Untested IaC fails at the worst moment: during an incident when you need to provision fast.

Verification Requirements

  • Plan/preview reviewed before apply
  • Blast radius analyzed
  • Rollback procedure documented
  • State stored remotely with locking
  • No secrets in code or state
  • Applied to non-prod first
  • Drift detection in place

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.