finishing-mid-refactor
Skill2 starsChanged 2 months agoMITView on GitHub
Use when the user asks Codex to finish an intentionally unfinished refactor after they edited code to show the desired direction, left notes, simplified APIs, or knowingly broke compilation/tests as a hint. Especially relevant for requests like "finish this rework", "complete my mid-refactor changes", or "I simplified some files; make it compile".
In this repository5 other files it gives its agents.
- checkpoint-commitSkill
- fix-ciSkill
- handoff-reviewSkill
- jeroens-rustSkill
- profile-guided-optimizationSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
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
Read git status, the relevant diff, and the files the user touched or has open.
- Distinctive: line 17
Do not revert user edits unless explicitly asked.
- Distinctive: line 21
If the direction is ambiguous or could change public behavior, ask the smallest useful question before editing.
- Distinctive: line 22
If the direction is clear, proceed without a long plan.
- Distinctive: line 25
Prefer the user's simpler shape over restoring the previous architecture.
- Distinctive: line 27
Remove compatibility scaffolding, stale tests, and old call sites that contradict the new shape.
- Distinctive: line 28
Keep changes narrow; do not add defensive abstractions, broad error handling, or configurability unless the user asked.
- Distinctive: line 31
Update or add focused tests for the new invariant.
- Distinctive: line 32
Run the narrowest useful check first, then broader checks once the tree compiles.
- Distinctive: line 33
Use failure output to find stale assumptions, not as a reason to undo the user's direction.
- Distinctive: line 42
Ask before editing when:
≈ “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
Finishing Mid-Refactor
Overview
The user's edits are design intent, not noise. Treat the broken tree as a partially applied refactor to complete, while preserving the user's simplification direction.
Workflow
- Inspect the current worktree before changing files.
- Read
git status, the relevant diff, and the files the user touched or has open. - Identify which changes are user-authored hints versus ordinary breakage.
- Do not revert user edits unless explicitly asked.
- Read
- State the intended rework in one or two sentences.
- Name the boundary, invariant, or simplification the user appears to want.
- If the direction is ambiguous or could change public behavior, ask the smallest useful question before editing.
- If the direction is clear, proceed without a long plan.
- Complete the refactor in focused passes.
- Prefer the user's simpler shape over restoring the previous architecture.
- Move responsibilities to the boundary implied by the user's edits.
- Remove compatibility scaffolding, stale tests, and old call sites that contradict the new shape.
- Keep changes narrow; do not add defensive abstractions, broad error handling, or configurability unless the user asked.
- Repair the verification surface.
- Update or add focused tests for the new invariant.
- Run the narrowest useful check first, then broader checks once the tree compiles.
- Use failure output to find stale assumptions, not as a reason to undo the user's direction.
- Report the result by invariant.
- Say what design boundary now holds.
- List any remaining ambiguity or follow-up separately.
- Include the verification commands that actually ran.
Decision Rules
Ask before editing when:
- Multiple plausible designs fit the user's hints.
- The requested finish would alter product behavior, public APIs, data migrations, or persisted formats.
- The user left contradictory notes.
- Completing the refactor requires deleting substantial code whose replacement is not clear.
Proceed when:
- The user's notes and edits point to one coherent direction.
- Breakages are stale call sites, imports, types, or tests from the old shape.
- The work is local to the refactor boundary already touched.
Common Mistakes
- Treating compile errors as evidence the user's edits are wrong.
- Reintroducing old indirection just to make tests pass quickly.
- Expanding scope into nearby cleanup that was not part of the refactor.
- Asking broad design questions when a specific invariant is already visible.
- Leaving the tree in a "mostly done" state after claiming the rework is finished.
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.

