agentleFS
kaiohenricunhakaiohenricunha/dotbabel/skills/terraform-specialist/SKILL.md

terraform-specialist

Skill0 starsChanged 2 months agoMITView on GitHub

Deep-dive Terraform architecture review, module design, state management, and migration. Use for structured investigations of Terraform workspaces, provider configuration, module coupling, import workflows, and test coverage. Triggers on: "Terraform audit", "module review", "state management", "Terraform import", "workspace design", "provider config review", "Terraform testing".

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 3

    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:

    Check backend and provider configuration:

    line 46
  2. Distinctive:

    Check for existing state:

    line 51
  3. Distinctive:

    After fixes are applied:

    line 127
  4. Very specific:

    Run terraform plan — confirm zero unexpected changes.

    line 130

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

Terraform Specialist

Structured investigation for Terraform codebases. Five phases: gather context, diagnose, design, recommend, verify.

Arguments

  • $0 — module path, workspace context, or problem description. Required.

Phase 1: Context Gathering

  1. Identify the scope: module, workspace, or full repo.
  2. Glob for Terraform files:
    find . -name "*.tf" | sort
    find . -name "*.tfvars" | sort
    find . -name ".terraform.lock.hcl" | sort
  3. Check backend and provider configuration:
    grep -r "backend" . --include="*.tf" -l
    grep -r "required_providers" . --include="*.tf" -l
  4. Check for existing state:
    terraform workspace list
    terraform state list

Phase 2: Diagnosis

Module structure:

# Check module inputs/outputs surface
grep -r "variable\|output\|locals" . --include="*.tf" -l
terraform validate

State health:

terraform state list
terraform state show <resource>
terraform plan -detailed-exitcode

Provider locks:

cat .terraform.lock.hcl
terraform providers

Test coverage:

find . -name "*_test.go" -o -name "*.tftest.hcl" | sort

Phase 3: Design / Root-Cause Analysis

Map symptoms to causes:

SymptomCommon CausesCheck
Plan shows unexpected replaceForceNew attribute changed, ID driftterraform state show + provider docs
State driftManual console change, import not runterraform refresh + terraform plan
Module couplingOutputs passed through too many layersCount cross-module variable chains
Provider version conflictLock file pinned differently per module.terraform.lock.hcl comparison
count vs for_each bugResource renamed on index changeSwitch to for_each with stable keys

Cite file:line for every finding.


Phase 4: Recommendations

Output findings in priority order:

[CRITICAL] <title>
Resource: <address or file:line>
Issue: <one sentence>
Evidence: <plan output or code snippet>
Fix: <specific change, with HCL diff if applicable>
Trade-off: <alternative and its downside, if meaningful>

Order: CRITICAL → WARNING → INFO.


Phase 5: Verification

After fixes are applied:

  1. Re-run terraform validate — no errors.
  2. Run terraform plan — confirm zero unexpected changes.
  3. For state moves: terraform state list before and after.
  4. For module refactors: run tests if present (terraform test or go test ./...).
  5. Confirm .terraform.lock.hcl is committed and unchanged.

Reference Docs

FileWhen to use
modules.mdModule design, variable/output surface, coupling
state-management.mdBackends, state mv, import, drift remediation
workspaces.mdWorkspace-per-env vs stack-per-env trade-offs
testing.mdUnit tests, integration tests, tftest
providers.mdProvider config, version pinning, aliases
import-patterns.mdterraform import, import blocks, bulk import

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.