terraform-style-guide — Claude Code skill: HashiCorp Terraform
A skill that generates and validates Terraform code according to HashiCorp's official standards. Ensures consistent, secure, and readable HCL across your configurations.
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a claude-codeWhat terraform-style-guide does
terraform-style-guide provides a complete ruleset for organizing Terraform configs: file structure, code formatting, resource and variable naming, version management, and sensitive data handling. The skill draws from HashiCorp recommendations and includes examples for common scenarios—from basic AWS resources to dynamic creation with for_each and conditional deployments using count.
It covers file organization (Terraform, providers, variables, outputs in separate files), two-space indentation, equals-sign alignment, lowercase with underscores for all names. Examples show provider versioning, multi-region setup, and validation checks. Security guidance includes what to commit (.tf files and .terraform.lock.hcl), what to ignore (tfstate, .tfvars with secrets), and how to mark sensitive values.
Code quality relies on terraform fmt and terraform validate—the skill includes these in its review checklist.
What it helps with
- Align existing Terraform code with HashiCorp standards
- Generate a new configuration with proper file structure and formatting
- Verify resource, variable, and output naming conventions
- Set up provider and Terraform version constraints following best practices
- Ensure sensitive data does not leak into version control
Example prompts for the agent
- Generate a Terraform config for AWS VPC with two subnets following the style guide
- Help me reformat this terraform.tf to match HashiCorp standards
- Review my variables and outputs in main.tf: do they meet the recommendations for types and descriptions?
How to install terraform-style-guide
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a claude-code2Manually: put the files in place
~/.claude/skills/terraform-style-guide/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/terraform-style-guide/
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a codex2Manually: put the files in place
.agents/skills/terraform-style-guide/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a cursor2Manually: put the files in place
.cursor/skills/terraform-style-guide/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hashicorp/agent-skills terraform-style-guide2Manually: put the files in place
.github/skills/terraform-style-guide/SKILL.md1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a gemini-cli2Platform CLI
gemini skills install https://github.com/hashicorp/agent-skills --path plugins/terraform/skills/terraform-style-guideManually: put the files in place
.devin/skills/terraform-style-guide/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-style-guide -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-style-guide
How do I install terraform-style-guide in Claude Code?
Run npx skills add hashicorp/agent-skills --skill terraform-style-guide -a claude-code. The skill will load into ~/.claude/skills/terraform-style-guide/SKILL.md and be available in Claude Code.
What does terraform-style-guide do?
The skill helps you write Terraform configs according to HashiCorp's official standards: proper file organization, formatting, naming conventions, provider versioning, and security best practices.
Do I need additional tools for this skill to work?
The skill itself is a code generator and reference. For quality checks, run terraform fmt -recursive and terraform validate. You can also use tflint, checkov, or tfsec for linting and security scanning.