Skills DirectoryCurated open-source Skills from GitHub

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-guide
Permissions
  • read-repo
  • write-files
  • shell
  • network
Compatible with
Claude Code, Codex
GitHub
911
Source
Official · HashiCorp
Status
Scan passed
License
MPL-2.0

Core rule

Every variable must include a type and description, and every output a description.

Execution Phases

  1. 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.

  2. Phase 02Organise files

    Split into terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf and locals.tf, with variables and outputs alphabetical.

  3. 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.

  4. 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.

  5. 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)

CapabilityNeededDetails
File writesRequiredGenerates and edits Terraform configuration files (.tf).
Command executionLimitedOnly terraform fmt, terraform validate and checkers such as tflint, checkov and tfsec.
Network outboundNot requiredThe skill calls for no network access and does not run plan or apply.

SKILL.md frontmatter (YAML)

SKILL.md frontmatter (YAML)commit 4451cec
---
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
---

Related skills

A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.