H

terraform-style-guide

by hashicorp

terraform-style-guide helps generate and review Terraform HCL using HashiCorp style conventions, file layout, and security-minded defaults. Use it for Terraform-native code generation, module structure, variables, outputs, and safer configuration in real repositories.

Stars583
Favorites0
Comments0
AddedApr 29, 2026
CategoryCode Generation
Install Command
npx skills add hashicorp/agent-skills --skill terraform-style-guide
Curation Score

This skill scores 84/100 because it is a solid, install-worthy Terraform code-generation guide with clear trigger language, concrete file-organization rules, and security-specific companion guidance. For directory users, that means the skill is likely to reduce guesswork for agents writing Terraform HCL, though it is still more of a style/workflow guide than a fully operational, tool-backed workflow.

84/100
Strengths
  • Strong triggerability: the frontmatter says to use it for writing, reviewing, or generating Terraform configurations.
  • Operational clarity: it gives a specific code-generation strategy and file layout for terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf.
  • Better agent leverage than a generic prompt: includes concrete HCL examples and a separate security-focused companion skill with explicit hardening rules.
Cautions
  • No install command, scripts, or support files, so adoption depends on reading and following the markdown guidance directly.
  • It is a style guide rather than an executable workflow, so it may not cover deeper edge cases or project-specific Terraform conventions.
Overview

Overview of terraform-style-guide skill

The terraform-style-guide skill helps you generate Terraform HCL that follows HashiCorp’s style conventions, file layout, and security-minded defaults. It is a good fit when you want code generation that is Terraform-native rather than a generic “infrastructure as code” answer.

What this skill is for

Use the terraform-style-guide skill when the job is to produce clean Terraform modules, review generated HCL for style drift, or reshape rough infrastructure requirements into a maintainable Terraform layout. It is especially useful when you want the output to be organized for real repositories, not just a single pasted example.

Where it adds value

This skill is strongest when you care about dependency order, file separation, variable declarations, outputs, and avoiding brittle hardcoded values. The terraform-style-guide guide also helps when security choices matter, because it reinforces encryption, least privilege, sensitive outputs, and safer handling of secrets.

Best-fit readers

If you are a developer, platform engineer, or AI agent trying to produce Terraform that is easier to read, extend, and review, this terraform-style-guide skill is a practical starting point. If you only need a one-off snippet and do not care about structure or conventions, a plain prompt may be enough.

How to Use terraform-style-guide skill

Install and trigger it

For the terraform-style-guide install step, add the skill from the HashiCorp skills repo and then invoke it in a Terraform-specific generation task. In practice, the skill works best when the prompt clearly says the output should follow the terraform-style-guide skill and you want Terraform HCL generated or reviewed against HashiCorp style.

Give it the right inputs

The terraform-style-guide usage pattern is to provide the cloud provider, resource goals, naming conventions, environment assumptions, and any security or state constraints up front. Strong input looks like: “Generate Terraform for an AWS S3 bucket, versioned and encrypted, with variables in variables.tf, outputs in outputs.tf, and no hardcoded secrets.” Weak input looks like: “Write Terraform for storage.”

Read these files first

Start with SKILL.md because it contains the core generation rules and file organization guidance. Then check SECURITY.md for hardening expectations, especially if the code will manage real cloud resources. If you are adapting the terraform-style-guide for Code Generation in your own repo, also inspect any surrounding repository standards that control module layout, naming, or provider pinning.

Workflow that produces better output

Use the skill in a two-step flow: first ask for the Terraform design and file plan, then ask for the actual HCL. This reduces missing variables, wrong resource ordering, and inconsistent file placement. If you already know the target structure, tell the model to place provider constraints in terraform.tf, configuration in providers.tf, resources in main.tf, and declarations in variables.tf and outputs.tf.

terraform-style-guide skill FAQ

Is terraform-style-guide only for new Terraform code?

No. The terraform-style-guide skill is also useful for refactoring existing HCL into a more consistent structure, especially when files are mixed together or variables are duplicated. It is most valuable when you want the result to be easier to maintain, not just syntactically valid.

How is this different from a normal prompt?

A normal prompt may produce working Terraform, but the terraform-style-guide skill adds a stronger bias toward HashiCorp-style file organization, dependency order, and safer defaults. That matters when you want the output to be reviewable and reusable, not just technically correct once.

Does it replace Terraform knowledge?

No. The terraform-style-guide skill improves formatting, structure, and generation discipline, but it does not remove the need to verify provider-specific arguments, resource semantics, or backend decisions. Treat it as a style and workflow guide, not a substitute for platform validation.

When should I not use it?

Do not rely on it if your task is intentionally nonstandard, highly opinionated, or tied to an existing module architecture that conflicts with HashiCorp conventions. In those cases, the terraform-style-guide skill may be a constraint rather than a benefit.

How to Improve terraform-style-guide skill

Provide clearer infrastructure intent

The biggest quality gain comes from specifying the target cloud, resource types, environment model, and what must be configurable. For example, “multi-environment AWS module with environment, region, and tags variables” is far more useful than “build AWS Terraform.”

State your constraints early

If the output must support remote state, private networking, encryption at rest, or sensitive outputs, say so before generation. The terraform-style-guide skill performs best when it can encode those constraints into the structure instead of patching them in afterward.

Ask for file-by-file output

When results feel messy, request output separated by Terraform files instead of one combined block. This aligns with the terraform-style-guide guide and makes it easier to spot missing variables, outputs, or provider requirements during review.

Iterate from review feedback

After the first pass, improve the result by asking for specific corrections: “move all configurable values into variables,” “add validation blocks,” “separate locals from resources,” or “mark secret-related outputs sensitive.” That kind of feedback is more effective than asking for a vague “better version” of the same Terraform.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...