# terraform-style-guide

A skill that generates and validates Terraform code according to HashiCorp's official standards. Ensures consistent, secure, and readable HCL across your configurations.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 12600 installs · ★ 909
- Author: hashicorp
- License: MPL-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hashicorp/agent-skills/tree/HEAD/plugins/terraform/skills/terraform-style-guide/SKILL.md
- Updated: 2026-10-05
- HTML: https://affpapa.org/en/nevibecode/skills/terraform-style-guide

## What it 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.

## Requirements
- Works with: Terraform

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/terraform-style-guide/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/terraform-style-guide/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/terraform-style-guide/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/terraform-style-guide/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install hashicorp/agent-skills terraform-style-guide
```

2. **Manually: put the files in place**
- File: `.github/skills/terraform-style-guide/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/hashicorp/agent-skills --path plugins/terraform/skills/terraform-style-guide
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/terraform-style-guide/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add hashicorp/agent-skills --skill terraform-style-guide -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/hashicorp/agent-skills/tree/HEAD/plugins/terraform/skills/terraform-style-guide/SKILL.md

## When to use it
- 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
- 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?

## Similar
- [terraform-generator](https://affpapa.org/en/nevibecode/skills/terraform-generator.md) — skill · 639 installs
- [terraform-engineer](https://affpapa.org/en/nevibecode/agents/terraform-engineer.md) — subagent · 328 installs
- [terraform-patterns](https://affpapa.org/en/nevibecode/skills/terraform-patterns.md) — skill · 617 installs
- [terraform-diagrams](https://affpapa.org/en/nevibecode/skills/terraform-diagrams.md) — skill · 745 installs
- [terraform-aws](https://affpapa.org/en/nevibecode/skills/terraform-aws.md) — skill · 387 installs
- [terraform-skill](https://affpapa.org/en/nevibecode/skills/terraform-skill.md) — skill · 7400 installs

From the same set: [hashicorp/agent-skills](https://affpapa.org/en/nevibecode/by/hashicorp/agent-skills.md) — 20 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
