refactor-module

refactor-module is a skill for Claude Code, Codex from eric861129/SKILLS_All-in-one. It costs 28 tokens per session (3,464 once invoked), scanned A, a copy of refactor-module, MIT.

A refactoring guide for turning one large Terraform configuration into smaller, reusable modules. Terraform is a tool for describing and managing cloud infrastructure with code.

In plain words
What is it for?
Use it to split Terraform files into modules, define their inputs and outputs, plan state-compatible migrations, and add documentation and tests.
Why use it?
It helps reduce tangled configuration and makes infrastructure easier to reuse, update, document, and migrate without losing track of existing state.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to split Terraform files into modules, define their inputs and outputs, plan state-compatible migrations, and add documentation and tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/eric861129/skills_all-in-one/refactor-module
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add eric861129/SKILLS_All-in-one --skill refactor-module
Clone the repo
git clone --depth 1 https://github.com/eric861129/SKILLS_All-in-one

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-module

README.md
[![agentmods](https://agentmods.dev/badge/skills/eric861129/skills_all-in-one/refactor-module/github.svg)](https://agentmods.dev/skills/eric861129/skills_all-in-one/refactor-module)
Your own site
<a href="https://agentmods.dev/skills/eric861129/skills_all-in-one/refactor-module"><img src="https://agentmods.dev/badge/skills/eric861129/skills_all-in-one/refactor-module/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-module

Your own site · 80×15
<a href="https://agentmods.dev/skills/eric861129/skills_all-in-one/refactor-module"><img src="https://agentmods.dev/badge/skills/eric861129/skills_all-in-one/refactor-module.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,464 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.03464
Opus 5 $0.00014 $0.01732
Sonnet 5 $0.00006 $0.00693
Haiku 4.5 $0.00003 $0.00346

Measured 9d ago against content hash 51357bb86eb4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

refactor-module scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to refactor-module — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

public/SKILLS/Infrastructure & Cloud/refactor-module/SKILL.md · 539 lines

How it starts

The opening of the file, as written. The whole thing — 539 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 current state file (for migration planning)
  • Knowledge of module registry patterns

Input Parameters

Parameter Type Required Description
source_directory string Yes Path to existing Terraform configuration
module_name string Yes Name for the new module
abstraction_level string No "simple", "intermediate", "advanced" (default: intermediate)
preserve_state boolean Yes Whether to maintain state compatibility
target_registry string No Target module registry (local, private, public)

Execution Steps

1. Analysis Phase

**Identify Refactoring Candidates**
- Group resources by logical function
- Identify repeated patterns
- Map resource dependencies
- Detect configuration coupling
- Analyze variable usage patterns

**Complexity Assessment**
- Count resource relationships
- Measure variable propagation depth
- Identify cross-resource references
- Evaluate state migration complexity

2. Module Design

Interface Design
# Define clear input contract
variable "network_config" {
  description = "Network configuration parameters"
  type = object({
    cidr_block         = string
    availability_zones = list(string)
    enable_nat         = bool
  })
  
  validation {
    condition     = can(cidrhost(var.network_config.cidr_block, 0))
    error_message = "CIDR block must be valid IPv4 CIDR."
  }
}

# Define output contract
output "vpc_id" {
  description = "ID of the created VPC"
  value       = aws_vpc.main.id
}

output "private_subnet_ids" {
  description = "List of private subnet IDs"
  value       = { for k, v in aws_subnet.private : k => v.id }
}

Read the full file on GitHub · 539 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 539 lines · 28 tokens per session scan A 51357bb86eb4

Subscribe to this mod's changes

refactor-module is a skill published in the GitHub repository eric861129/SKILLS_All-in-one (52 stars, last pushed 4mo ago), licensed MIT. It adds 28 tokens to every session and 3,464 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to refactor-module, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

operate-pi-dispatch

How to operate a pi-dispatch deployment through its tools, and how to use the operator-confirm gates on the write tools (changing limits, adding/editing/deleting triggers).

edgehero/pi-dispatch · 41 tokens

deno-knowledge-patch

Use this skill when choosing current Deno runtime APIs, CLI options, configuration, dependency behavior, Node compatibility, or deployment workflows. Open the topic reference before changing a project because several commands, flags, APIs, and defaults changed more than once.

Nevaberry/nevaberry-plugins · 9 tokens

aws-cdk-knowledge-patch

Load this skill when changing, reviewing, debugging, or upgrading AWS CDK applications, construct libraries, CLI integrations, or synthesized CloudFormation templates.

Nevaberry/nevaberry-plugins · 11 tokens

aws-sdk-knowledge-patch

Use this skill when upgrading an AWS SDK or CLI, changing a supported runtime, configuring shared SDK behavior, or implementing one of the service APIs in the reference index. Identify the language, SDK major version, runtime, service, and deployment environment before applying the guidance.

Nevaberry/nevaberry-plugins · 9 tokens

azure-knowledge-patch

Use this skill for Azure infrastructure, Azure CLI, Azure PowerShell, Terraform AzureRM or AzAPI, Bicep, identity SDK, Microsoft Entra, networking, compute, containers, data services, storage, Key Vault, governance, and service lifecycle work.

Nevaberry/nevaberry-plugins · 8 tokens

chrony-knowledge-patch

Skill "chrony-knowledge-patch" from Nevaberry/nevaberry-plugins, covering chrony 4.7–4.8 knowledge patch, reference index, using this patch, breaking changes and upgrade checks and configuration and build compatibility.

Nevaberry/nevaberry-plugins · 9 tokens