terraform-refactor-module

terraform-refactor-module is a skill for Claude Code, Codex from jenreh/appkit. It costs 29 tokens per session (3,457 once invoked), scanned A, a copy of refactor-module, MIT.

A guide for splitting one large Terraform configuration into reusable modules. Terraform is a tool for defining and managing cloud infrastructure with code.

In plain words
What is it for?
Use it to refactor an existing Terraform project into modules and plan how current infrastructure state will move to the new structure.
Why use it?
It helps organize tangled infrastructure code into clearer parts with defined inputs, outputs, documentation, tests, and a plan for preserving existing state.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/jenreh/appkit/terraform-refactor-module
Any agent
npx skills add jenreh/appkit --skill terraform-refactor-module
Clone the repo
git clone --depth 1 https://github.com/jenreh/appkit

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 terraform-refactor-module

README.md
[![agentmods](https://agentmods.dev/badge/skills/jenreh/appkit/terraform-refactor-module.svg)](https://agentmods.dev/skills/jenreh/appkit/terraform-refactor-module)
Your own site
<a href="https://agentmods.dev/skills/jenreh/appkit/terraform-refactor-module"><img src="https://agentmods.dev/badge/skills/jenreh/appkit/terraform-refactor-module.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,457 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 97% 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 $0.00029 $0.03457
Opus 5 $0.00015 $0.01729
Sonnet 5 $0.00006 $0.00691
Haiku 4.5 $0.00003 $0.00346

Measured 3d ago against content hash 6a03e3a721f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

terraform-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 3d 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

97% identical to refactor-module — 32 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.

.claude/skills/terraform-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. 3d ago First seen · 539 lines · 29 tokens per session scan A 6a03e3a721f7

Subscribe to this mod's changes

terraform-refactor-module is a skill published in the GitHub repository jenreh/appkit (4 stars, last pushed 8d ago), licensed MIT. It adds 29 tokens to every session and 3,457 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to refactor-module, differing in 32 lines, and is treated as a copy.

Related

Other skills, from other repositories

dce-edge

DCE-safe require() patterns and edge runtime constraints. Use when writing conditional require() calls, guarding Node-only imports (node:stream etc.), or editing define-env-plugin.ts / app-render / stream-utils for edge builds. Covers if/else branching for webpack DCE, TypeScript definite assignment, the NEXTRUNTIME…

vercel/next.js · 84 tokens

lumina-infra-deploy

Work on Lumina deployment and infrastructure assets. Use when editing terraform/, aws/, docker-compose.yml, DEPLOYMENT.md, ADVANCEDDEPLOYMENTS.md, agenticai/deployments/, or other files related to Docker, Terraform, AWS or Azure rollout behavior, environment wiring, and release automation.

hoangsonww/AI-RAG-Assistant-Chatbot · 68 tokens

ai-studio-image

Geracao de imagens humanizadas via Google AI Studio (Gemini). Fotos realistas estilo influencer ou educacional com iluminacao natural e imperfeicoes sutis.

pinkpixel-dev/skills-collection-1 · 38 tokens

v8-jit

V8 JIT optimization patterns for writing high-performance JavaScript in Next.js server internals. Use when writing or reviewing hot-path code in app-render, stream-utils, routing, caching, or any per-request code path. Covers hidden classes / shapes, monomorphic call sites, inline caches, megamorphic deopt, closure…

vercel/next.js · 88 tokens

cloud-architect

Designs cloud architectures, creates migration plans, generates cost optimization recommendations, and produces disaster recovery strategies across AWS, Azure, and GCP. Use when designing cloud architectures, planning migrations, or optimizing multi-cloud deployments. Invoke for Well-Architected Framework, cost…

Jeffallan/claude-skills · 71 tokens

rule

Skill "rule" from x-cmd/x-cmd, covering rule — rules to rule, 核心命令, 规则文件格式, 示例 and 验证规则文件格式.

x-cmd/x-cmd · 0 tokens