agentleFS
chiruu12chiruu12/claude-skills-template/.claude/skills/request-refactor-plan/SKILL.md

request-refactor-plan

Skill0 starsChanged 7 months agoMITView on GitHub

Create a detailed refactor plan with tiny commits via user interview, then file as a GitHub issue. Interviews about the problem, explores alternatives, verifies test coverage, and breaks implementation into Martin Fowler-style small steps. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

54 other projects use a version of this, 46 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use batch-grill-me, prd-to-plan and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • boyingliu01Skill

    batch-grill-me

    A relentless interview that asks every frontier question at once, round by round. Thin alias of `grilling` (#540) — upstream mattpocock/skills absorbed this protocol into grilling; XP-Gate keeps this name as the sprint-flow Phase 2 entry point so orchestration docs stay stable.

    Also in 5 projects that use this

  • HK-hubSkill

    prd-to-plan

    Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in ./plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

    Also in 8 projects that use this

  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 4 projects that use this

  • LesaniSkill

    writing-beats

    Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.

    Also in 23 projects that use this

  • LesaniSkill

    writing-shape

    Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.

    Also in 23 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 14 projects that use this

  • +1 more from Lesani

The file

We split this skill into the rules it gives an agent

9 rules. 1 is common, 6 are distinctive, and 2 are very specific to this project.

  • 1

    Common

    Most of the 52 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a detailed, safe refactor plan through interview, then file it as a GitHub issue.

    line 12
  2. Very specific:

    NOT: when adding new functionality — use to-prd

    line 19
  3. Distinctive:

    NOT: when the change is a single rename — just do it

    line 20
  4. Very specific:

    NOT: when exploring whether a refactor is needed — use improve-codebase-architecture first

    line 21
  5. Common:

    Ask the user for a detailed description of the problem and any potential solutions.

    line 27
  6. Distinctive:

    Verify their assertions. Look at the actual code — don't take claims at face value.

    line 31
  7. Distinctive:

    Ask whether they've considered other options.

    line 35
  8. Distinctive:

    Check existing tests. If insufficient, ask the user their testing plans.

    line 47
  9. Distinctive:

    No tests exist and user says "we'll add them later" — tests come first

    line 91

“Common” is measured: kept by at least 6 in 10 of the 52 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.

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

Request Refactor Plan

Create a detailed, safe refactor plan through interview, then file it as a GitHub issue. Refactors modify working code without changing behavior — the risk isn't in the code, it's in the plan. This skill ensures every step leaves the codebase working.

When to Use

  • User wants to plan a refactor before starting it
  • User says "refactor plan", "I want to restructure this", or "this needs cleaning up"
  • User wants to create an RFC for a refactor someone else will implement
  • NOT when adding new functionality — use to-prd
  • NOT when the change is a single rename — just do it
  • NOT when exploring whether a refactor is needed — use improve-codebase-architecture first

Process

1. Gather the problem

Ask the user for a detailed description of the problem and any potential solutions.

2. Explore the repo

Verify their assertions. Look at the actual code — don't take claims at face value.

3. Present alternatives

Ask whether they've considered other options. Present alternatives including "do nothing" if the status quo is tolerable.

4. Interview about implementation

Be extremely detailed. Cover: what changes, how callers are affected, intermediate states, how you verify each step.

5. Scope the work

Hammer out what you plan to change and what you plan NOT to change. Explicit exclusions prevent scope creep.

6. Assess test coverage

Check existing tests. If insufficient, ask the user their testing plans. Refactoring without tests is refactoring without a safety net.

7. Break into tiny commits

Each commit must: leave the codebase working, be independently reviewable, have a clear single purpose.

Martin Fowler: "make each refactoring step as small as possible."

8. File as GitHub issue

Create with gh issue create:

## Problem Statement
[Developer's problem, from their perspective]

## Solution
[The proposed restructuring]

## Commits
[Detailed plan — tiny commits, each leaving codebase working]

## Decision Document
[WHY decisions were made — modules, interfaces, architecture. No file paths.]

## Testing Decisions
[What gets tested, how, prior art in codebase]

## Out of Scope
[Explicit exclusions]

Common Rationalizations

ShortcutWhy It Fails
"I'll just refactor as I go, no plan needed"Unplanned refactors expand scope silently. You start with "rename this" and end with "rewrite the data layer."
"Each commit doesn't need to be independently working"It does. Broken intermediate states mean you can't bisect, can't revert one step, can't pause halfway.
"We don't have tests, but I'll be careful"You won't be careful enough. Add tests FIRST as a separate commit, then refactor.
"This is too interconnected for small steps"Break it into phases: extract, then restructure, then clean up. Each phase is tiny commits.
"Let's skip alternatives, I know what I want""Do nothing" is always an option. Sometimes the refactor costs more than living with the debt.

Red Flags

  • No tests exist and user says "we'll add them later" — tests come first
  • A single planned commit touches 5+ files — too large, split further
  • Out of Scope is empty — every refactor has boundaries
  • User can't articulate WHY the current code is a problem

Verification Checklist

  • Problem clearly stated from developer's perspective
  • Alternatives explored (including "do nothing")
  • Scope explicit — what changes AND what does not
  • Test coverage assessed — gaps addressed in plan
  • Every commit leaves codebase working
  • Commits small enough to be independently reviewable
  • Out of Scope has explicit exclusions
  • GitHub issue filed successfully

Anti-patterns

  • DO NOT skip alternatives — "do nothing" is always worth evaluating
  • DO NOT plan commits that leave codebase broken
  • DO NOT include file paths in the GitHub issue — they go stale
  • DO NOT plan refactors in untested areas without addressing the test gap first
  • DO NOT let scope expand during interview — new scope goes to "Out of Scope" or a separate plan

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.