terraform-style-guide Skill for Claude: Write Terraform to HashiCorp Style
Makes Claude write and review Terraform code to HashiCorp's style guide, with set file layout, naming, variable rules and security practices.
- Installs
- 12.8K
- on skills.sh
- Stars
- 911
- on GitHub
- Files
- 1
- besides SKILL.md
- Updated
- Oct 2026
- last repo commit
terraform-style-guide is a skill from HashiCorp's agent-skills repository. When you ask Claude to write, review or generate Terraform configuration, it follows a generation order (providers, data sources, resources, outputs), a six-file layout, naming rules, version pinning and a review checklist. Security rules sit in a second file in the folder, SECURITY.md, which SKILL.md points to.
The skill bundles no scripts. It tells Claude to run terraform fmt -recursive and terraform validate before committing and names tflint, checkov and tfsec as extra tools, so Claude may run those in your project. You need Terraform installed for that part.
Good for
- Engineers writing new Terraform who want HashiCorp-style layout and names from the start
- Reviewers checking a pull request against a written checklist
- Platform teams that want generated infrastructure code to use variables, tags and pinned versions
- Anyone adding encryption and secret handling rules to generated Terraform
Install terraform-style-guide
Claude Code
- 1
Copy this prompt.
Install the terraform-style-guide skill in Claude Code. Run this command: npx skills add hashicorp/agent-skills/plugins/terraform/skills/terraform-style-guide Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
The skill folder has two files, SKILL.md and SECURITY.md, and SKILL.md points to SECURITY.md, so install the whole folder. The plugin route installs all 16 skills in HashiCorp's terraform plugin. Its manifest points to a skills folder and lists no hooks or MCP servers.
From the project README. Source.
What's in the skill
When it loads
Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
Sections in SKILL.md
- Code Generation Strategy
- File Organization
- Example Structure
- Code Formatting
- Indentation and Alignment
- Block Organization
- Naming Conventions
- Variables
- Outputs
- Dynamic Resource Creation
- Prefer for_each over count
- count for Conditional Creation
- Security Best Practices
- Version Pinning
- Provider Configuration
- Version Control
Key facts
- Author
- HashiCorp
- Repository
- hashicorp/agent-skills
- Installs on skills.sh
- 12,830 as of 2026-11-02
- GitHub stars
- 911 for the whole repo, 2026-11-02
- License
- MPL-2.0 (repo metadata)
- Last commit to the repo
- 2026-10-28
- Reference
- HashiCorp Terraform Style Guide
What it includes
Providers and version constraints first, then data sources, resources, outputs
Five steps in order: provider configuration, data sources, resources in dependency order, outputs for key attributes, and variables for every configurable value.
Try: “Write Terraform for an AWS VPC with private subnets, using the HashiCorp style.”
Code generation strategyterraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, locals.tf
A table of what each file holds. Variables and outputs are in alphabetical order.
File organizationTwo-space indent, aligned equals, lowercase names with underscores
Meta-arguments come first, then arguments, then blocks, with lifecycle last. Resource names are singular, descriptive nouns, and main is the default when only one instance exists.
Formatting and namingEvery variable needs a type and description; every output needs a description
Shows validation blocks and marks passwords and similar values sensitive.
Variables and outputsUse for_each for multiple resources, count only for on/off creation
Shows a named for_each set against a count loop, and count = condition ? 1 : 0 for optional resources.
for_each over countrequired_version, provider version constraints, default_tags, aliases
Says to use the latest major provider version and latest minor Terraform version unless a lock file or module requires otherwise.
Version pinning and providersEncryption, private networking, least privilege, no hardcoded secrets
Adds a secure S3 bucket example and a priority order for secrets: native secrets manager first, then write-only attributes with ephemeral resources, then regular resources as a last resort. Ephemeral resources need Terraform 1.11.0 or newer.
Read ·
SECURITY.mdterraform fmt -recursive, terraform validate, tflint, checkov, tfsec
Says to run fmt and validate before committing and lists tflint, checkov and tfsec as additional tools.
Runs code ·
Validation toolsTen checkbox items from formatting to no hardcoded credentials
A closing checklist Claude can run against a configuration.
Code review checklist
From the official docs
Permissions
Low risk
Claude writes Terraform and may run terraform fmt and validate in your project. Keep your files in git and read the plan before any apply.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It runs Terraform commands in your project
SKILL.md has Claude run terraform fmt -recursive across your folders. Use version control so you can review any changes it makes. github.com
Generated infrastructure code can create real resources
The skill only writes code. Anything you apply to a cloud account is created by Terraform, so read the plan first. github.com
Technical details
| Scopes |
|
|---|
Questions
What does the terraform-style-guide skill do?
It makes Claude write and review Terraform HCL to HashiCorp's style conventions, including file layout, naming, variables, version pinning and security practices.
How do I install it in Claude Code, the Claude app or Codex?
Use the install box at the top of this page. It covers the single skill and HashiCorp's terraform plugin. Install the whole folder, because SKILL.md points to SECURITY.md.
Does it need Terraform or an API key?
SKILL.md names no API key. It tells Claude to run terraform fmt and terraform validate, so Terraform must be installed for those steps.
Is it safe?
The skill bundles no scripts and only tells Claude to run formatting and validation commands. Claude writes Terraform that can create real cloud resources when you apply it, so review the plan before any apply.
Should I install the single skill or the terraform plugin?
The single skill covers style only. The plugin installs all 16 skills in HashiCorp's terraform plugin, which covers more tasks. Its manifest lists a skills folder and no hooks or MCP servers.
Does it write secrets into Terraform?
No, it tells Claude not to. SKILL.md says never to commit state files or sensitive .tfvars and to avoid hardcoded credentials, and SECURITY.md prefers a secrets manager or ephemeral resources.
Information
updated Nov 2, 2026
- Repository
- hashicorp/agent-skills
- Folder
plugins/terraform/skills/terraform-style-guide
Sources
Docs, issue trackers and discussions this page is built from.
Show all 4Hide
- hashicorp/agent-skills README · github.com
- terraform plugin.json · github.com
- terraform-style-guide SKILL.md · github.com
- terraform-style-guide SECURITY.md · github.com