Terraform Skill (Terraform/OpenTofu Diagnostics)
A diagnose-first Terraform/OpenTofu companion that classifies the failure mode, applies version-aware guards, and always ships validation commands plus rollback notes.
Dev & CodingIntermediate★ 2,254⑂ 199AI score 9/10Last updated: Jul 3, 2026
What it does
This skill rewires how Claude handles infrastructure-as-code work: diagnose first, then generate, with explicit risk controls.
- Failure-mode routing table: maps symptoms into 13 categories — identity churn (addresses shifting after refactor), secret exposure, blast radius, destroy cascade, CI drift, compliance gaps, testing blind spots, state corruption/recovery, provider upgrade and lifecycle risk, provisioner misuse, cross-cloud mapping — and loads only the matching reference file.
- Response contract on every answer: (1) assumptions and version floor (runtime, providers, backend, execution path: local/CI/Cloud/Atlantis), (2) risk category addressed, (3) chosen remediation and tradeoffs, (4) exact validation commands (
fmt -check,validate,plan -out, policy checks), (5) rollback notes for anything destructive or state-mutating. - Hard safety rails: never recommends production apply without a reviewed plan artifact and approval; requires
terraform plan -destroyplus an enumerated deletion list (including implicit dependents pulled in via locals orfor_each) and explicit confirmation before any destroy — and never-auto-approveon destroy. - Version-aware feature guards:
moved(1.1+),optional()(1.3+),import/check(1.5+), nativeterraform test(1.6+), mock providers (1.7+),removed(1.7+), cross-variable validation (1.9+), S3 native lockfile (1.10+),write_onlyargs (1.11+). - Opinionated structure: module hierarchy (resource → resource module → infrastructure module → composition), directory layout, naming and block-ordering rules, variable/output contracts, state-splitting heuristics (split above ~500 resources, combine below ~100), version pinning matrix, trivy/checkov security stage.
- terraform-ls code intelligence: position-anchored
goToDefinition/findReferences, manual rename discipline for value symbols,movedblocks instead of blind text renames, and a degradation gate before claiming LSP is broken.
Who it's for
- Platform and DevOps engineers authoring or reviewing shared Terraform modules
- Teams organizing multi-environment layouts and remote state backends
- Anyone building IaC pipelines in GitHub Actions, GitLab CI, or Atlantis, or chasing local-vs-CI plan mismatches
- Engineers designing a test strategy with native
terraform test, Terratest, or mock providers - Teams migrating to OpenTofu or planning a major provider bump
Overkill for basic HCL syntax questions or plain provider API lookups.
Example uses
count→for_eachmigration: "Deleting one subnet in the middle recreated all of them." It diagnoses identity churn, produces thefor_each = toset(...)rewrite plus the matchingmovedblocks, and requires aplanshowing zero destroys.- Fixing CI drift: "My local plan differs from the CI plan." It pins runtime and providers, commits
.terraform.lock.hcl, and restructures the pipeline so the apply job consumes the reviewed plan artifact instead of re-runningplan. - Secrets leaking into state: "Is
sensitive = trueenough?" It explains that this only masks display, then offerswrite_only/*_woon 1.11+ or runtime lookups from Secrets Manager / Key Vault below that, with tradeoffs. - Stuck lock or backend migration: walks through unlocking safely, choosing S3
use_lockfile(1.10+) over DynamoDB, and keeping backups plus evidence with clear rollback notes.
· · · Install guide · · ·
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/terraform-skill folder from the GitHub repo antonbabenko/terraform-skill into my ~/.claude/skills/antonbabenko-terraform-skill/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/antonbabenko/terraform-skill.git && mkdir -p ~/.claude/skills && cp -r terraform-skill/skills/terraform-skill ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and create the skills directory if needed:
mkdir -p ~/.claude/skills - Clone the repository:
git clone https://github.com/antonbabenko/terraform-skill.git - Copy the whole skill folder, including its
references/docs:cp -r terraform-skill/skills/terraform-skill ~/.claude/skills/ - Verify the install:
ls ~/.claude/skills/terraform-skill— you should seeSKILL.mdand areferences/directory. - (Recommended) Make sure
terraformortofuis on your PATH and runterraform initonce in your project so the terraform-ls navigation features work. - Restart Claude Code, then ask something like "review this Terraform module" or "migrate count to for_each safely" — the skill activates automatically.
- You can delete the temporary clone:
rm -rf terraform-skill - Safety note: always read the
planoutput yourself before running anyapply,destroy, or state-mutating command the skill suggests.
View source on GitHub ↗License: NOASSERTION