Terraform Atomic Commit Skill
When to Use This Skill
Use this Skill in Terraform / Terragrunt repos (for example terraform-modules/ and infrastructure/) when you want:
/terraform:pre-commit – to actively fix formatting + lint issues and get the working tree into a clean, reviewable state.
/terraform:atomic-commit – to enforce atomicity of the staged diff, run the repo’s quality gates, and propose a commit message (no AI signatures).
Example Prompts
- “Run
/terraform:pre-commit and fix all issues in the files shown by git status (fmt, validate, docs).”
- “Use
/terraform:atomic-commit to confirm the staged diff is atomic and ready; propose a commit message.”
- “We’re in a Terragrunt repo: enforce formatting, skip any apply, and run read-only validation checks where possible.”
Modes
This Skill behaves differently based on how it is invoked:
pre-commit mode:
- Actively applies changes to make the working tree/staged files conform to repo standards.
- Runs auto-fixers and focused validation.
- Does not propose or drive a commit.
atomic-commit mode:
- Runs everything from
pre-commit mode.
- Enforces atomicity of staged changes.
- Requires all gates to be green.
- Proposes a commit message without any AI signatures.
Severity Tags
[BLOCKING] – must fix before merge/commit (broken fmt/validate, dangerous workflow, non-atomic diff).
[SHOULD_FIX] – strongly recommended before merge (lint warnings, missing docs update, missing pins).
[NIT] – minor polish.
Core Priorities
- No hidden blast radius – prefer pinned refs, explicit versions, and documented breaking changes.
- Read-only by default – never run
terraform apply / terragrunt apply as part of this Skill.
- Atomic diffs – split unrelated module/workflow changes into separate commits.
- Repo rules first –
AGENTS.md, CLAUDE.md, .tool-versions, and .pre-commit-config.yaml override defaults here.
- Docs reflect reality – keep
terraform-docs sections accurate when present.
Environment & Context Gathering
Start by gathering:
- Git context:
git status --porcelain
git diff --stat
git diff --cached --stat
git diff --cached --name-only
- Repo standards:
- Read
AGENTS.md / CLAUDE.md if present.
- Detect
.pre-commit-config.yaml, .tool-versions, Taskfile.yml.
- Tooling:
terraform version
terragrunt --version (if present)
tflint --version (if present)
terraform-docs --version (if present)
If pre-commit hooks fail due to tool-version mismatch, prefer installing the repo’s pinned tool versions (e.g. via asdf install or a repo task install:tools) over bypassing checks.
Checks Pipeline (Both Modes)
Scope changed files
- Focus on changed
.tf, .hcl, .json, .yml, and module README.md files.
Formatting
- Terraform modules:
- Run
terraform fmt -recursive (or repo-preferred equivalent) on changed module directories.
- Terragrunt repos:
- Prefer running repo pre-commit hooks for formatting.
- If formatting is manual, use the Terragrunt formatting command compatible with the pinned Terragrunt version.
Validate (focused, read-only)
- Terraform modules:
- For each changed module directory, run:
terraform init -backend=false
terraform validate
- Clean up
.terraform/ and lockfiles created during local validation.
- Practical pattern (handles modules that reference an
aws.global alias):
- Create a temporary
ci_providers.tf inside the module directory:
provider "aws" { region = "us-east-1" }
provider "aws" { alias = "global" region = "us-east-1" }
- Then run
init/validate, and delete ci_providers.tf afterwards.
- Avoid committing
.terraform/ directories. Only commit .terraform.lock.hcl if the repo explicitly wants lockfiles versioned.
- Terragrunt repos:
- Prefer focused validation/plans for only the changed stacks (avoid full
run-all unless required).
- If a pre-commit hook fails due to a Terragrunt CLI flag mismatch, treat it as a tool-version drift problem first:
- Install the repo’s pinned Terragrunt version (e.g. via
.tool-versions + asdf install).
- Re-run
pre-commit run.
TFLint (when configured)
- If the repo uses
tflint (pre-commit hook or .tflint.hcl), run it on changed modules/stacks.
- If not configured, do not introduce a brand-new tflint setup as part of a formatting-only commit unless explicitly requested.
- If tflint is desired but missing, propose a separate, atomic commit that adds a baseline
.tflint.hcl + CI gate.
terraform-docs consistency (when used)
- If a module README contains
<!-- BEGIN_TF_DOCS -->, regenerate docs and ensure the resulting diff is committed.
- Recommended command (adjust to repo conventions):
terraform-docs markdown table --output-file README.md --output-mode inject <module_dir>
- If
terraform-docs tries to generate provider lockfiles, prefer a repo-approved invocation (some repos use --lockfile=false).
- After regeneration, check that
git diff is clean (or explicitly commit the README changes as part of the same atomic change).
- Treat “docs drift” as
[SHOULD_FIX] (or [BLOCKING] when the repo enforces it in CI).
Atomic Commit Mode Additions
In atomic-commit mode, additionally:
- Refuse to approve the commit if the staged diff includes unrelated changes (split commits).
- Require all checks relevant to the touched files to pass (fmt/validate/lint/docs).
- Propose a commit message with no AI signature.
Output Format
Return:
Verdict: READY or NOT READY
Checks: list of commands run + pass/fail
Changes made: brief list
Remaining issues: with [BLOCKING] / [SHOULD_FIX] / [NIT]
Proposed commit message: (atomic-commit mode only)
Source: DiversioTeam/agent-skills-marketplace — distributed by TomeVault.
1---2name: terraform-atomic-commit3description: Terraform-focused pre-commit + atomic-commit Skill for IaC repos (fmt/validate/tflint/terraform-docs) with strict atomicity and no AI commit signatures. Use when this capability is needed.4---56# Terraform Atomic Commit Skill78## When to Use This Skill910Use this Skill in Terraform / Terragrunt repos (for example `terraform-modules/` and `infrastructure/`) when you want:1112- `/terraform:pre-commit` – to actively fix formatting + lint issues and get the working tree into a clean, reviewable state.13- `/terraform:atomic-commit` – to enforce atomicity of the staged diff, run the repo’s quality gates, and propose a commit message (no AI signatures).1415## Example Prompts1617- “Run `/terraform:pre-commit` and fix all issues in the files shown by `git status` (fmt, validate, docs).”18- “Use `/terraform:atomic-commit` to confirm the staged diff is atomic and ready; propose a commit message.”19- “We’re in a Terragrunt repo: enforce formatting, skip any apply, and run read-only validation checks where possible.”2021## Modes2223This Skill behaves differently based on how it is invoked:2425- `pre-commit` mode:26 - Actively applies changes to make the working tree/staged files conform to repo standards.27 - Runs auto-fixers and focused validation.28 - Does **not** propose or drive a commit.29- `atomic-commit` mode:30 - Runs everything from `pre-commit` mode.31 - Enforces atomicity of staged changes.32 - Requires all gates to be green.33 - Proposes a commit message **without** any AI signatures.3435## Severity Tags3637- `[BLOCKING]` – must fix before merge/commit (broken fmt/validate, dangerous workflow, non-atomic diff).38- `[SHOULD_FIX]` – strongly recommended before merge (lint warnings, missing docs update, missing pins).39- `[NIT]` – minor polish.4041## Core Priorities42431. **No hidden blast radius** – prefer pinned refs, explicit versions, and documented breaking changes.442. **Read-only by default** – never run `terraform apply` / `terragrunt apply` as part of this Skill.453. **Atomic diffs** – split unrelated module/workflow changes into separate commits.464. **Repo rules first** – `AGENTS.md`, `CLAUDE.md`, `.tool-versions`, and `.pre-commit-config.yaml` override defaults here.475. **Docs reflect reality** – keep `terraform-docs` sections accurate when present.4849## Environment & Context Gathering5051Start by gathering:5253- Git context:54 - `git status --porcelain`55 - `git diff --stat`56 - `git diff --cached --stat`57 - `git diff --cached --name-only`58- Repo standards:59 - Read `AGENTS.md` / `CLAUDE.md` if present.60 - Detect `.pre-commit-config.yaml`, `.tool-versions`, `Taskfile.yml`.61- Tooling:62 - `terraform version`63 - `terragrunt --version` (if present)64 - `tflint --version` (if present)65 - `terraform-docs --version` (if present)6667If pre-commit hooks fail due to tool-version mismatch, prefer installing the repo’s pinned tool versions (e.g. via `asdf install` or a repo `task install:tools`) over bypassing checks.6869## Checks Pipeline (Both Modes)70711. **Scope changed files**72 - Focus on changed `.tf`, `.hcl`, `.json`, `.yml`, and module `README.md` files.73742. **Formatting**75 - Terraform modules:76 - Run `terraform fmt -recursive` (or repo-preferred equivalent) on changed module directories.77 - Terragrunt repos:78 - Prefer running repo pre-commit hooks for formatting.79 - If formatting is manual, use the Terragrunt formatting command compatible with the pinned Terragrunt version.80813. **Validate (focused, read-only)**82 - Terraform modules:83 - For each changed module directory, run:84 - `terraform init -backend=false`85 - `terraform validate`86 - Clean up `.terraform/` and lockfiles created during local validation.87 - Practical pattern (handles modules that reference an `aws.global` alias):88 - Create a temporary `ci_providers.tf` inside the module directory:89 - `provider "aws" { region = "us-east-1" }`90 - `provider "aws" { alias = "global" region = "us-east-1" }`91 - Then run `init/validate`, and delete `ci_providers.tf` afterwards.92 - Avoid committing `.terraform/` directories. Only commit `.terraform.lock.hcl` if the repo explicitly wants lockfiles versioned.93 - Terragrunt repos:94 - Prefer focused validation/plans for only the changed stacks (avoid full `run-all` unless required).95 - If a pre-commit hook fails due to a Terragrunt CLI flag mismatch, treat it as a tool-version drift problem first:96 - Install the repo’s pinned Terragrunt version (e.g. via `.tool-versions` + `asdf install`).97 - Re-run `pre-commit run`.98994. **TFLint (when configured)**100 - If the repo uses `tflint` (pre-commit hook or `.tflint.hcl`), run it on changed modules/stacks.101 - If not configured, do not introduce a brand-new tflint setup as part of a formatting-only commit unless explicitly requested.102 - If tflint is desired but missing, propose a separate, atomic commit that adds a baseline `.tflint.hcl` + CI gate.1031045. **terraform-docs consistency (when used)**105 - If a module README contains `<!-- BEGIN_TF_DOCS -->`, regenerate docs and ensure the resulting diff is committed.106 - Recommended command (adjust to repo conventions):107 - `terraform-docs markdown table --output-file README.md --output-mode inject <module_dir>`108 - If `terraform-docs` tries to generate provider lockfiles, prefer a repo-approved invocation (some repos use `--lockfile=false`).109 - After regeneration, check that `git diff` is clean (or explicitly commit the README changes as part of the same atomic change).110 - Treat “docs drift” as `[SHOULD_FIX]` (or `[BLOCKING]` when the repo enforces it in CI).111112## Atomic Commit Mode Additions113114In `atomic-commit` mode, additionally:115116- Refuse to approve the commit if the staged diff includes unrelated changes (split commits).117- Require all checks relevant to the touched files to pass (fmt/validate/lint/docs).118- Propose a commit message with no AI signature.119120## Output Format121122Return:123124- `Verdict:` **READY** or **NOT READY**125- `Checks:` list of commands run + pass/fail126- `Changes made:` brief list127- `Remaining issues:` with `[BLOCKING]` / `[SHOULD_FIX]` / `[NIT]`128- `Proposed commit message:` (atomic-commit mode only)129130---131> Source: [DiversioTeam/agent-skills-marketplace](https://github.com/DiversioTeam/agent-skills-marketplace) — distributed by [TomeVault](https://tomevault.io).132<!-- tomevault:4.0:skill_md:2026-06-16 -->