terraform-best-practices — Claude Code skill for Terraform
This skill guides Terraform code reviews and authoring, covering file layout, modules, state, and security. Use it when shaping infrastructure configuration.
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a claude-codeWhat terraform-best-practices does
The skill lays out conventions for splitting configuration across files and environments, naming resources and variables, and defining module inputs and outputs. It also covers pinned module versions, remote state, and references between stacks.
Security guidance includes sensitive variables, encrypted storage, private databases, and security-group rules. It flags patterns such as secrets in code, wildcard IAM permissions, unpinned modules, and state without locking. Its S3 backend example uses DynamoDB for locking, so the backend setup needs to account for that.
The CI/CD section outlines formatting checks, validation, and a plan on pull requests, followed by applying after a merge. It advises against automatic applies on pull requests and recommends passing secrets through CI environment variables. This is a reference for Terraform conventions, not a replacement for checking the settings in your own configuration.
What it helps with
- organize Terraform configuration by file and environment
- choose consistent names for resources and variables
- define reusable modules with pinned versions
- configure remote state and locking
- spot secrets and unsafe settings in Terraform code
Example prompts for the agent
- Review these Terraform files for secrets and unsafe settings.
- Suggest a file layout for this Terraform configuration.
- Check this module and its callers for unpinned versions and interface issues.
How to install terraform-best-practices
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/terraform-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/terraform-best-practices/
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a codex2Manually: put the files in place
.agents/skills/terraform-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a cursor2Manually: put the files in place
.cursor/skills/terraform-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install c0x12c/ai-toolkit terraform-best-practices2Manually: put the files in place
.github/skills/terraform-best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/c0x12c/ai-toolkit --path toolkit/skills/terraform-best-practicesManually: put the files in place
.devin/skills/terraform-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about terraform-best-practices
How do I install terraform-best-practices in Claude Code?
Run npx skills add c0x12c/ai-toolkit --skill terraform-best-practices -a claude-code. The skill file is located at ~/.claude/skills/terraform-best-practices/SKILL.md.
What does terraform-best-practices do?
It provides Terraform guidance for configuration layout, module design, state management, and security reviews.
How does the skill handle Terraform state locking?
Its S3 backend example uses DynamoDB for locking. It also shows how to read outputs from another stack with terraform_remote_state.