agentleFS
JeroenGarJeroenGar/skills/finishing-mid-refactor/SKILL.md

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".

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
  1. Distinctive:

    Read git status, the relevant diff, and the files the user touched or has open.

    line 15
  2. Distinctive:

    Do not revert user edits unless explicitly asked.

    line 17
  3. Distinctive:

    If the direction is ambiguous or could change public behavior, ask the smallest useful question before editing.

    line 21
  4. Distinctive:

    If the direction is clear, proceed without a long plan.

    line 22
  5. Distinctive:

    Prefer the user's simpler shape over restoring the previous architecture.

    line 25
  6. Distinctive:

    Remove compatibility scaffolding, stale tests, and old call sites that contradict the new shape.

    line 27
  7. Distinctive:

    Keep changes narrow; do not add defensive abstractions, broad error handling, or configurability unless the user asked.

    line 28
  8. Distinctive:

    Update or add focused tests for the new invariant.

    line 31
  9. Distinctive:

    Run the narrowest useful check first, then broader checks once the tree compiles.

    line 32
  10. Distinctive:

    Use failure output to find stale assumptions, not as a reason to undo the user's direction.

    line 33
  11. Distinctive:

    Ask before editing when:

    line 42

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.