terraform-style-guidecommit 4451cecSKILL.md · Code Standards
Terraform Style Guide
Generates and maintains Terraform HCL code following HashiCorp's official style conventions and best practices.
npx skills add hashicorp/agent-skills --skill terraform-style-guideCommand selected. Copy it manually.
- Permissions
- read-repo
- write-files
- shell
- network
- Compatible with
- Claude Code, Codex
- GitHub
- 911
- Source
- Official · HashiCorp
- Status
- Scan passed
- License
- MPL-2.0
- Category
- Code Standards
Core rule
Every variable must include a type and description, and every output a description.
Execution Phases
Phase 01Generate in order
Start with providers and version constraints, then data sources, resources in dependency order and outputs, using variables for every configurable value.
Phase 02Organise files
Split into terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf and locals.tf, with variables and outputs alphabetical.
Phase 03Format and name
Indent two spaces and align equals signs, meta-arguments first and lifecycle last; use singular lowercase_underscore names and prefer for_each over count.
Phase 04Secure and pin
Pin versions explicitly, mark sensitive values, never hardcode credentials, apply SECURITY.md hardening; never commit state, always commit .terraform.lock.hcl.
Phase 05Validate
Before committing, run terraform fmt -recursive and terraform validate, optionally tflint, checkov or tfsec, and walk the review checklist.
Permissions (summarised from SKILL.md)
| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Generates and edits Terraform configuration files (.tf). |
| Command execution | Limited | Only terraform fmt, terraform validate and checkers such as tflint, checkov and tfsec. |
| Network outbound | Not required | The skill calls for no network access and does not run plan or apply. |
SKILL.md frontmatter (YAML)
---
name: terraform-style-guide
description: Generate Terraform HCL code following HashiCorp's official style conventions and best practices. Use when writing, reviewing, or generating Terraform configurations.
metadata:
lifecycle-status: active
---