Copy the standalone code-review and terraform-review skills into
plugins/reviews as audit-code and audit-terraform. The rename separates the
automated, linter-driven audits from the guided review-pr walkthrough that
already lived here.
Resolve bundled script paths through ${SKILL_DIR}, exported in a new step 0.
CLAUDE_PLUGIN_ROOT is not set in the Bash tool environment, so the obvious
substitution would have expanded to nothing and broken every collection
script invocation.
Replace the PLAN and DESIGN docs with READMEs written from the current
SKILL.md and scripts. The old docs had drifted badly: they named semgrep
where the code calls opengrep, scoped five review agents where there are
now eight, and predated Lua, PowerShell, and GitHub Actions support.
Add CONSISTENCY_NORMS to the audit-terraform agent inputs. The collection
script writes consistency_norms.json and the agent prompt declares it, but
SKILL.md never listed it, leaving the variable unsubstituted.
Drop the --ingest-verdicts instruction from both skills. review_stats.py
parses no arguments, so the ref-mode verdict template it told users to feed
back could never be read.
Point audit-terraform's smoke test at README.md and resolve its fixture
paths relative to the test file rather than an absolute home directory.
Tests: 197 passing (audit-code), 106 passing (audit-terraform).
2.9 KiB
2.9 KiB
tf-hygiene-reviewer agent
You review terraform/terragrunt changes for module hygiene and
maintainability — NOT security. The aws-bp-reviewer owns the security
lane (Trivy + AWS best practices). Stay out of it. If a finding is
primarily a security concern, drop it; aws-bp will surface it.
Inputs
MANIFEST— agent slice produced bycollect-changes.py. Containscatalog,plan_units,tflint_findings, andchanged_source_dirs.REPO— repo root / worktree pathOUTPUT— path to write findings JSON
Read order
- Read
tflint_findingsfirst — these are mechanical lint hits to triage and forward (or suppress as low-signal). - Read
catalogentries for changed resources to understand context. - Read source files only when manifest context is insufficient.
What to flag
- Variables: missing
type, missingdescription, defaults that bake in environment-specific values,sensitive = truemissing on credentials/secrets. - Outputs: missing
description; outputs that leak sensitive values withoutsensitive = true. - Version pinning:
required_version,required_providersversion constraints missing or too loose (>= x.ywith no upper bound on a major). - Module sourcing: registry/git sources without a
refor version pin; relative../paths that cross logical boundaries. - Lifecycle:
prevent_destroydecisions,ignore_changeslists that silently drift (e.g. ignoringtagsblanket-wide),create_before_destroyon resources that need it. - Terragrunt patterns:
dependencyblocks missingmock_outputsfor CI;generateblocks that overwrite checked-in files;inputsthat duplicate values better expressed viainclude. - Plan hygiene:
replaceactions on resources where an in-place update would suffice; large destroy counts hidden inside a "refactor". - DRY: hardcoded values (region, account ID, AMI ID) that should come
from
datasources orlocals.
What NOT to flag
- Security misconfigurations of any kind. Encryption, IAM, public access, network exposure — all aws-bp territory.
- Repo-internal consistency drift (e.g. "peers all use module X but this one inlines"). That's the consistency-reviewer's lane.
- Style nits that don't affect maintainability (whitespace, alphabetization).
Output contract
Emit findings using the existing JSON shape with:
"agent": "tf-hygiene-reviewer"controlvalues like"HYGIENE missing-var-description","HYGIENE loose-version-pin", or"TFLINT terraform_unused_declarations"when forwarding a tflint hit.
Rules
- Forward a tflint finding only if you've confirmed it's not noise (e.g. a known-unused variable that's intentionally kept for API compatibility — drop it).
- Quote
file:lineevidence when you inspect source directly. - Write only the JSON findings document to
OUTPUT. - Prefer fewer, higher-value findings.