create-module
Skill1 starsChanged 46 days agoApache-2.0View on GitHub
Build a reusable Terraform module, or turn existing Terraform into one, without destroying a single resource: inventory the code, design a typed interface, write MODULE-PLAN.md with a moved block for every address and the expected plan for every caller, then hand each chunk to terraform-author and check it. Four modes: new (a module from a description), extract (lift resources out of a root into a module call), dedupe (converge copies across environments or roots onto one module) and refactor (rework a module's variables and outputs while every caller plans clean).
10 other projects use a version of this.
Adopted by
Most recently taken up by
- maru-audio/maru-skilltheir own version, first seen Nov 29, 2026
- mx-space/coretheir own version, first seen Nov 14, 2026
- lecluse-net/galaristheir own version, first seen Oct 30, 2026
- VelimirMueller/ai-development-skillstheir own version, first seen Oct 25, 2026
- faparicior/sdlc-skillstheir own version, first seen Oct 20, 2026
- VelimirMueller/claude-skillstheir own version, first seen Oct 11, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- OpenCTI-Platform/opencti★ 10ksame name
- cartography-cncf/cartography★ 4.2ksame name
- mx-space/core★ 569same name
- castacks/AirStack★ 93same name
- vobase/vobase★ 60same name
- VelimirMueller/ai-development-skills★ 7same name
- VelimirMueller/claude-skills★ 7same name
- faparicior/sdlc-skills★ 2same name
- lecluse-net/galaris★ 1same name
- maru-audio/maru-skill★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- check-moduleSkill
- explain-planSkill
- fix-review-findingsSkill
- look-up-schemaSkill
- onboard-toolchainSkill
- review-moduleSkill
- trace-change-impactSkill
- writing-terraformSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 68
If python3 is not available, do each script's check by hand from its docstring and say so in the hand-off.
- Very specific: line 72
Read the section of references/modes.md for the mode, and follow its inventory list.
- Very specific: line 75
Call describe on each source root and on the module if it exists.
- Very specific: line 76
Read each root's .terraform.lock.hcl and required_version, so the module's constraints admit what the callers already lock.
- Very specific: line 97
When every chunk is done, call change_impact on the module and confirm that every root it reports is in callers with an expected-plan line.
- Distinctive: line 107
Assumptions and open questions: every decision made without the user.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a Terraform module
A module is done when every caller plans exactly what MODULE-PLAN.md said it would, usually 0 to destroy, and the module could be called by a root that does not exist yet. You plan; terraform-author writes. Every HCL line follows the writing-terraform skill, so this skill adds the module-level decisions it does not make: the boundary, the interface, the moved map, the order of the work and the gates between chunks.
Standing rules
These hold from the first read to the hand-off.
- No HCL before an approved plan. Nothing under the module or a caller root changes until MODULE-PLAN.md passes
validate_plan.py --require-approved. Approval comes from the user through AskUserQuestion. When you cannot ask (a headless run), the prompt's explicit go-ahead counts, recorded asapproved_by: prompt; without one, stop after writing the plan. - State never moves by accident. Every resource or module address that leaves a root gets a
movedblock in that root'smoved.tf, because a module can only move its own objects and the caller owns the state. A module called withfor_eachtakes one block per key per resource. A chunk is not done untilmoved_coverage.pyis clean for every root it touched. Keep the blocks after apply; deleting one later turns the move back into a destroy for anyone who has not applied. - Live identity is kept. A name-like argument (
bucket,identifier,name,cidr_block) must evaluate in each caller to the value it has today. If a naming scheme in the module would change one, the caller passes the full live value instead. A change that would replace a stateful resource (writing-terraform rule 06) stops the run and goes to the user. - The interface is what differs between callers. Values that differ, or that are decisions (sizing, retention, CIDRs), are required variables with a type and a description and no default. Dependencies come in as inputs (
vpc_id,kms_key_arn) instead of being created or looked up inside. Every attribute a caller reads today becomes an output. - A module is reusable on its own. No
provider,backendorcloudblock;required_providerswith a version constraint;required_versionat least the newest feature used (moved1.1,optional()1.3,terraform test1.6,mock_providerandremoved1.7, cross-variable validation 1.9); a README; tests withcommand = plan.module_lint.pychecks these. - You never change real infrastructure or state. No
apply,import,statesubcommand,taint, orplanagainst a real backend. You hand the plan commands to the user.
Arguments
$mode is new, extract, dedupe or refactor; $path is the module or root it starts from. When either is missing, infer it (a directory with callers is refactor, a root with the resources is extract, several roots with the same blocks is dedupe, nothing yet is new) and confirm it with AskUserQuestion along with the other open questions in step 2.
Procedure
Scripts used below (scripts/validate_plan.py checks MODULE-PLAN.md, scripts/module_lint.py checks the module is reusable, scripts/moved_coverage.py checks every removed address has a move), each printing path:line: CODE message and exiting 0 when clean, 1 on findings and 2 on a usage error:
python3 ${CLAUDE_SKILL_DIR}/scripts/validate_plan.py MODULE-PLAN.md [--require-approved]
python3 ${CLAUDE_SKILL_DIR}/scripts/module_lint.py MODULE_DIR
python3 ${CLAUDE_SKILL_DIR}/scripts/moved_coverage.py --base REF ROOT [ROOT ...]
python3 ${CLAUDE_PLUGIN_ROOT}/skills/writing-terraform/scripts/smell_grep.py DIR [DIR ...]If python3 is not available, do each script's check by hand from its docstring and say so in the hand-off.
1. Inventory
Read the section of references/modes.md for the mode, and follow its inventory list. In every mode:
- Record the base ref:
git rev-parse HEAD. moved_coverage compares against it, so uncommitted changes in the source roots must be committed or stashed first; ask when there are any. - Call
describeon each source root and on the module if it exists;change_impacton an existing module for its callers. - Read each root's
.terraform.lock.hclandrequired_version, so the module's constraints admit what the callers already lock. - Find every reader of every address that will move (
LSPfindReferences, orrgwhen terraform-ls is absent).
2. Design
Draft the interface and the moved map following the mode's section. Check the doc-verified facts in references/module-refactoring.md before writing any moved, removed or optional() construct you have not used in this repository. Collect every decision you could not source (a value no caller states, a structural difference between roots, a thin single-resource module) and ask them in one AskUserQuestion call; in a headless run take the safe choice (a required variable, the resource left outside the module) and list it under open questions.
3. Write and approve the plan
Copy assets/MODULE-PLAN.template.md (${CLAUDE_SKILL_DIR}/assets/MODULE-PLAN.template.md) to MODULE-PLAN.md at the repository root and fill it: inventory, interface, moved map, chunks from the mode's default table, and one expected-plan line per caller. A chunk's outcome is the plan of the root it touches; a chunk that touches only the module is no-changes. Run validate_plan.py and fix every finding.
Then ask once with AskUserQuestion: approve, edit (say what), or stop. On approve set status: approved and approved_by: user, and run validate_plan.py --require-approved.
4. Build, one chunk at a time
For each chunk in order:
- Set its status to
in-progressand fill assets/author-dispatch.template.md (${CLAUDE_SKILL_DIR}/assets/author-dispatch.template.md) from the plan: owned files, change, interface rows, moved rows, live values, outcome. Dispatch the terraform-author subagent with it. One author at a time, because each chunk builds on the last. - When it reports done, read its diff, then run the gate on what the chunk touched:
diagnosticson the module and on each caller root it changed;module_lint.pyon the module;moved_coverage.py --base REFon each caller root it changed;smell_grep.pyon every directory it changed. A module-only chunk in refactor mode leaves callers broken until their chunk lands, so check callers at their own chunk. - Clean gate: set the chunk to
done. Failed gate: dispatch the author once more with the exact failing output. If it fails again, set the chunk tofailedand ask with AskUserQuestion: fix it by hand, revise the plan, or stop. Never edit a check or a moved block just to make the gate pass.
When every chunk is done, call change_impact on the module and confirm that every root it reports is in callers with an expected-plan line. Set status: done.
5. Hand off
End with these sections, in this order:
- Module: the path, what it manages, its inputs and outputs.
- Changed: each file and what the change in it does.
- Expected plan: per caller root, one line per address (move from and to, create, update), then "N to add, N to change, N to destroy". A refactor states "no changes" per root outright.
- Required inputs: variables with no default and who supplies each.
- Assumptions and open questions: every decision made without the user.
- Not verified: anything a gate could not check, such as a schema lookup that failed or a plan never run.
- Next: in each caller root,
terraform plan -out=tfplanand the explain-plan skill on it; apply only when the plan matches. Keep eachmoved.tfafter apply. MODULE-PLAN.md holds the moved map and can be deleted once every root has applied.
References
references/modes.md: inventory, interface, moved-map and chunk steps for each mode. Read the one section for the mode in use.references/module-refactoring.md: HashiCorp-cited facts onmoved,removed,import, module layout, variable types, sources andterraform test, each marked doc-verified or inferred. Treat an inferred line as a lead, not a fact.${CLAUDE_PLUGIN_ROOT}/skills/writing-terraform/SKILL.md: the HCL rules terraform-author follows; its module skeleton (path in the new section ofreferences/modes.md) is the starting point for a new module, andassets/examples-basic/main.tfhere is the example caller.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

