
Refactor Module
hashicorp/agent-skillsOfficial
Transforms monolithic Terraform configurations into reusable modules with state migration and validation.
- CCM score
- 71 of 100
- skills.sh installs
- 6.9K
- GitHub stars
- 941
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers the full refactor flow: resource analysis, interface design, code transformation, and state migration
- Defines input and output contracts with
variablevalidation blocks and typedoutputvalues - Generates
movedblocks and inspects state viaterraform state listandterraform show -json - Designed for teams splitting large Terraform configurations into maintainable, versioned modules
Install
$ npx -y skills add hashicorp/agent-skills --skill refactor-module -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Skill: Refactor Module
Overview
This skill guides AI agents in transforming monolithic Terraform configurations into reusable, maintainable modules following HashiCorp's module design principles and community best practices.
Capability Statement
The agent will analyze existing Terraform code and systematically refactor it into well-structured modules with:
- Clear interface contracts (variables and outputs)
- Proper encapsulation and abstraction
- Versioning and documentation
- Testing frameworks
- Migration path for existing state
Prerequisites
- Existing Terraform configuration to refactor
- Understanding of resource dependencies
- Access to inspect current state via
terraform state list/terraform show -json(for migration planning) - Knowledge of module registry patterns
Input Parameters
Details
- Repository
- github.com/hashicorp/agent-skills
- Category
- DevOps & Cloud
More from hashicorp/agent-skills
All 16- Terraform Stacks5.9K
- Terraform Search Import5.2K
- Provider Resources4.3K
- New Terraform Provider4.1K
- Provider Actions4.1K
- Run Acceptance Tests3.9K
- Azure Verified Modules3.5K
- Provider Test Patterns3.5K
- Provider Docs3.4K
- Aws Ami Builder3.4K
- Push To Registry3.2K
- Azure Image Builder2.9K
- Windows Builder2.9K
- Terraform Style Guide13.8K
- Terraform Test9.5K
Similar to Refactor Module
More DevOps & Cloud
terraform-style-guidehashicorp/agent-skills13.8K installsStyle guide that generates and reviews Terraform HCL following HashiCorp's official conventions and best practices.
terraformbobmatnyc/claude-mpm-skills343 installsInfrastructure-as-code workflow patterns for Terraform covering state, module design, and safe plan and apply.
terraform-engineerjeffallan/claude-skills5.9K installsTerraform skill with validation, plan-review, and apply-approval workflow for AWS, Azure, and GCP infrastructure.
terraform-skillantonbabenko/terraform-skill8.3K installsDiagnose-first Terraform and OpenTofu guidance covering identity churn, secrets, blast radius, CI drift, and state corruption.