terraform-style-guide

Generates Terraform HCL code following HashiCorp style and conventions.

Updated Oct 16, 2025
One-click install
npx skills add https://github.com/Axeloooo/TheDataBay --skill terraform-style-guide-axeloooo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-style-guide
Source: https://github.com/Axeloooo/TheDataBay/tree/main/.agents/skills/terraform-style-guide
Command: npx skills add https://github.com/Axeloooo/TheDataBay --skill terraform-style-guide-axeloooo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents inconsistent, fragile Terraform code by guiding you toward HashiCorp-style conventions that improve readability, maintainability, and safety.

Core Features & Use Cases

  • Code generation strategy: Orders provider constraints, data sources, resources, and outputs so plans are easier to review and less likely to break due to dependency mistakes.
  • Consistent file organization: Encourages a standard split across terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf to reduce cognitive load and merge conflicts.
  • Team-ready conventions: Applies naming rules, variable/output requirements, formatting standards, and security best practices (e.g., sensitive outputs and no hardcoded credentials).
  • Use cases: Ideal for writing new Terraform modules, refactoring existing stacks, onboarding teammates, or generating Terraform snippets that conform to a shared style guide.

Quick Start

Ask an AI to generate Terraform HCL for your target infrastructure while following the HashiCorp Terraform style guide and producing variables and outputs with descriptions in the standard file layout.

Frequently Asked Questions about terraform-style-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Terraform HCL that follows HashiCorp style conventions?

Standard HashiCorp Terraform style requires splitting code across providers.tf, variables.tf, main.tf, and outputs.tf, while ordering provider constraints, data sources, resources, and outputs to prevent dependency errors and improve maintainability.

What are the best practices for organizing Terraform files in production?

Terraform file organization best practices involve separating infrastructure code into terraform.tf, providers.tf, main.tf, variables.tf, outputs.tf, and locals.tf to reduce cognitive load, simplify reviews, and minimize merge conflicts.

How do I secure sensitive values and outputs in Terraform configurations?

Securing sensitive values in Terraform requires marking outputs as sensitive, avoiding hardcoded credentials, and applying security best practices to protect infrastructure code from exposing secrets during plans and state operations.

Can I use this style guide to refactor existing Terraform stacks?

Yes, the style guide is ideal for refactoring existing Terraform stacks by applying standardized naming conventions, explicit variable and output documentation, and dependency-aware structure for safer and more maintainable configurations.

What naming conventions should I apply when generating Terraform modules?

Terraform modules should use safe naming conventions that ensure consistency across providers, variables, locals, resources, and outputs, making infrastructure code easier to read and less likely to break.

Why does my Terraform plan break due to dependency mistakes?

Terraform plans break when resources lack a dependency-aware structure, meaning providers, data sources, resources, and outputs are incorrectly ordered, causing fragile infrastructure code that fails during execution.