LaunchKit · 2026

Setup & Installation

npx skills add https://github.com/hashicorp/agent-skills --skill refactor-module
or paste the link and ask your coding assistant to install it
https://github.com/hashicorp/agent-skills/tree/main/terraform/code-generation
View on GitHub

What This Skill Does

Transforms monolithic Terraform configurations into reusable modules following HashiCorp's module design principles. Handles interface design, encapsulation, state migration, documentation, and test scaffolding. Works with local, private, and public module registries.

Manually refactoring Terraform state is error-prone and requires careful ordering of moved blocks, plan verification, and dependency mapping that this skill handles systematically.

When to use it

  • Splitting a 500-line main.tf into separate VPC, compute, and data modules
  • Migrating state references after extracting resources into a module
  • Adding typed variable validation to a module that previously used untyped strings
  • Generating moved blocks to relocate state without destroying and recreating resources
  • Structuring module outputs so downstream modules can reference VPC IDs and subnet maps