terraform-stacks — Claude Code skill: what it does, how to install
Guides AI coding assistants through HashiCorp Terraform Stacks syntax, component definitions, and multi-environment deployment configs.
npx skills add hashicorp/agent-skills --skill terraform-stacks -a claude-codeWhat terraform-stacks does
This skill teaches coding assistants how to write HashiCorp Stacks configurations properly. Traditional Terraform modules sit beneath Stacks, which use their own HCL files named .tfcomponent.hcl and .tfdeploy.hcl. All configurations belong at the repository root. The skill clarifies how to wire components together from Git repositories, registry sources, or local module paths.
Stack syntax brings noticeable differences from standard Terraform. Providers accept a for_each argument and hold settings inside a config block, while block headers carry aliases. Variable definitions require a strict type attribute. Setting ephemeral = true prevents credentials from landing in state files.
Workload identity via OIDC is the recommended path for cloud access. Stacks CLI features fail on engines older than Terraform 1.13.x, which makes the root .terraform-version file mandatory before testing CLI runs.
What it helps with
- write component declarations inside .tfcomponent.hcl files
- configure multi-region deployments with .tfdeploy.hcl
- set up ephemeral variables for cloud identity tokens
- reference module sources across registries and Git repositories
Example prompts for the agent
- Create a components.tfcomponent.hcl file referencing our VPC module in a private registry
- Show how to configure an AWS provider with for_each and assume_role_with_web_identity
- Validate this .tfdeploy.hcl setup for staging and production deployments
How to install terraform-stacks
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-stacks -a claude-code2Manually: put the files in place
~/.claude/skills/terraform-stacks/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/terraform-stacks/
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-stacks -a codex2Manually: put the files in place
.agents/skills/terraform-stacks/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-stacks -a cursor2Manually: put the files in place
.cursor/skills/terraform-stacks/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hashicorp/agent-skills terraform-stacks2Manually: put the files in place
.github/skills/terraform-stacks/SKILL.md1Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-stacks -a gemini-cli2Platform CLI
gemini skills install https://github.com/hashicorp/agent-skills --path plugins/terraform/skills/terraform-stacksManually: put the files in place
.devin/skills/terraform-stacks/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hashicorp/agent-skills --skill terraform-stacks -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about terraform-stacks
How do I install terraform-stacks in Claude Code?
Run npx skills add hashicorp/agent-skills --skill terraform-stacks -a claude-code. The skill is placed in ~/.claude/skills/terraform-stacks/SKILL.md.
What does terraform-stacks do?
It equips AI agents with syntax rules and file patterns for HashiCorp Terraform Stacks. The assistant can generate and review .tfcomponent.hcl and .tfdeploy.hcl definitions accurately.
Which Terraform release is required for Stacks?
You need Terraform 1.13.x or newer to run the Stacks CLI plugin. Set this version in your repository root inside a .terraform-version file.