master-refactor
Skill15 starsChanged 4 months agoMITView on GitHub
Plan and execute safe behavior-preserving refactors for authorized local projects. Use for Master-Refactor, repo or feature cleanup, code simplification, periodic maintenance sweeps, optimization candidates, or refactor planning. Starts with measured analysis and a ranked candidate report, requires approval before code, then uses isolated slices, characterization tests, execution receipts, and regression deltas.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- auto-copySkill
- auto-docSkill
- auto-manageSkill
- auto-pilotSkill
- auto-planSkill
- auto-qaSkill
- auto-reflectSkill
- auto-researchSkill
- master-docsSkill
- master-optimizeSkill
- master-qaSkill
- master-release-reviewSkill
- master-sanitizeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 6 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Start analysis-only. Stop after the ranked candidate report and wait for the user to select scope.
- Distinctive: line 14
Read the refactor log first.
- Distinctive: line 16
Add characterization tests before moving weakly covered behavior.
- Distinctive: line 17
If implementation changes behavior, eject it into a separate Auto proposal with RED -> GREEN acceptance proof.
- Very specific: line 20
Run auto-qa per slice and at the end.
- Very specific: line 28
Research: - use auto-research or a lean inline map.
- Very specific: line 31
Plan: - use auto-plan on the approved set.
- Distinctive: line 32
Isolate: - create the approved dedicated branch/worktree.
- Very specific: line 33
Execute: - use auto-pilot, one bounded slice at a time.
- Very specific: line 34
Verify: - use auto-qa per slice and a full integrated pass.
- Distinctive: line 35
Merge: - only after completion, clean QA, and explicit user approval.
- Very specific: line 42
Read references/workflow.md before starting.
- Very specific: line 43
Read references/candidate-report.md before presenting options.
- Very specific: line 44
Read references/baselines-and-metrics.md before measurement.
- Very specific: line 45
Read references/isolation-and-qa.md before implementation.
- Very specific: line 46
Read references/refactor-log.md before log access.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Master-Refactor
Find, approve, implement, and verify refactors that make code leaner without changing observable behavior.
Core Rules
- Start analysis-only. Stop after the ranked candidate report and wait for the user to select scope; no planning or code skips this gate.
- In maintenance mode, rank a bounded top set by value/risk and record the rest in the log. Never automatically delete, rewrite, or "clean everything."
- Read the refactor log first. Do not re-propose rejected work without new evidence.
- Capture the baseline commit, dirty state, relevant metrics, existing gates, and UI screenshots before implementation.
- Add characterization tests before moving weakly covered behavior. They must pass before and after a behavior-preserving refactor; do not manufacture RED for structural-only work.
- If implementation changes behavior, eject it into a separate Auto proposal with RED -> GREEN acceptance proof.
- Implement only in an isolated owned branch/worktree; never on main/master.
- Require execution receipts and a regression delta for each slice and the final set.
- Run
auto-qaper slice and at the end; every UI-visible slice requires the Frontend Gate. - Merge only after the entire approved set is complete, QA-clean, and explicitly approved.
- Store reports under
~/.auto-master/artifacts/<project-slug>/refactor/. - Preserve unrelated work; do not destructively clean or print secrets.
Pipeline
- Startup - confirm repo/branch/worktree; read the log; define scope and expected audit outputs.
- Research - use
auto-researchor a lean inline map; trace dependents, coverage, hot paths, and existing conventions. - Baseline - capture git, metrics, gates, and UI state.
- Candidate report + STOP - rank recommended/optional/not-recommended candidates and wait for selection.
- Plan - use
auto-planon the approved set; classify slices Micro/Small/Full. - Isolate - create the approved dedicated branch/worktree.
- Execute - use
auto-pilot, one bounded slice at a time. Keep characterization tests green before/after and receipts current. - Verify - use
auto-qaper slice and a full integrated pass; compare every after-signal with baseline. - Merge - only after completion, clean QA, and explicit user approval.
- Log - append outcomes, regression deltas, confirmed failures, rejected ideas, and do-not-retry evidence.
For multi-phase refactors, auto-manage owns the queue. Honor its five-attempt circuit breaker: after the same failure twice, diagnose or shrink the slice; never continue blind retries.
References
- Read
references/workflow.mdbefore starting. - Read
references/candidate-report.mdbefore presenting options. - Read
references/baselines-and-metrics.mdbefore measurement. - Read
references/isolation-and-qa.mdbefore implementation. - Read
references/refactor-log.mdbefore log access.
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.

