refactor-extract
Skill2 starsChanged 5 months agoMITView on GitHub
Walk the 4-phase refactor extraction protocol when a mechanical signal fires (duplication cluster, file-size warn or fail) or an authoring-time near-match surfaces. Tier 1.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- build-featureSkill
- doc-consistencySkill
- refactor-extractSkill
- refresh-vendorSkill
- build-featureSkill
- doc-consistencySkill
- refresh-vendorSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Execute: Write the helper / land the split + test pin first.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/refactor-extract
Substance lives in markdowns/protocols/refactor-extraction.md.
Steps:
- Discriminate kickoff vs iteration per
auto-trigger-discriminator.md. If iteration / polish / investigation, exit silently. Explicit/refactor-extractinvocation bypasses; mechanical signals (duplication / file-size) and authoring-time near-match are kickoff by definition. - Detect. Cite the mechanical signal (duplication cluster
file:line ↔ file:linefromjscpdor similar, file-size LOC warn or fail). No mechanical signal, no advance — the duplication policy is the gate. - Decide. Produce a structured rationale (the 4+ duplicates that justify extraction, the proposed helper signature, the ≥70% applicability check, the FCPSS coverage). Run cross-vendor
plan-reviewagainst the rationale markdown viascripts/cross-vendor-review.sh. Iterate to a clean pass (Tier 1: no decline path). - Execute. Write the helper / land the split + test pin first. Migrate callers one at a time with the suite green between each. Verify the signal cleared (re-run the duplication checker, re-count file size). No half-migration.
- Prevent regression. The test pin is the durable guard; the duplication checker + file-size hook keep watching the surface; the duplication policy in root
AGENTS.mdDefinition of Done is the steady-state authoring rule.
Execution diff goes through standard cross-vendor code review at PR time per cross-vendor-review.md. Supervision pattern per supervision.md.
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.

