Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

request-refactor-plan

БесплатноБез исполняемых скриптовНе проверен

Produces a refactor plan and files it as a GitHub issue for review: interviews the user about the pain and the constraints, checks every claim against the…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Request Refactor Plan

Overview

A refactor changes the structure of code without changing what it does, and it goes wrong in predictable ways: the goal is vague, behaviour shifts unnoticed, or the work lands as one unreviewable diff. This skill prevents all three before any code moves. It turns a developer's "this module is a mess" into a written request that reviewers can approve or reject: evidence for the problem, the chosen approach and the ones rejected, the behaviour that is frozen, the tests that guard it, and an ordered list of commits small enough to review and revert one at a time. The result is filed as a GitHub issue.

Instructions

1. Interview

Ask in one message, and skip what the user has already said:

  1. What hurts today, and what does it cost? (bugs of a recurring kind, time to make a typical change, onboarding, incidents)
  2. Why now? What upcoming work does this unblock?
  3. What must stay exactly as it is? (public API, stored data, output formats, performance)
  4. What is the constraint? (deadline, release cadence, who reviews, code other teams own)
  5. What solution do you have in mind, and what have you already ruled out?

2. Check the claims against the code

Read the area before believing either the complaint or the proposed cure. Collect numbers the issue can cite:

wc -l src/orders/order-service.ts
grep -rl "order-service" src --exclude='*.test.ts' | wc -l      # files that depend on it
git log --since="12 months ago" --format= --name-only -- src/orders \
  | grep . | sort | uniq -c | sort -rn | head -5               # most-changed files
npx vitest run src/orders --coverage                           # the project's own test command

Note who calls the code, what it calls, where state is shared, and which behaviour is covered by tests. If the evidence does not support the complaint (the file is large but rarely changes and rarely breaks), say so; "leave it alone" is a valid outcome.

3. Weigh the options

Lay out at least three, with what each costs and what it leaves unsolved: do nothing; the smallest change that removes the stated pain; the structural change the user proposed; a rewrite, if anyone is considering one. Recommend one. Prefer the option that removes the pain soonest and can be stopped halfway with the code still better than before.

4. Fix the scope and the invariants

Write down what is in scope, what is explicitly out, and the observable behaviour that must be identical before and after: responses, persisted data, emitted events, error messages others depend on, timing budgets. A refactor ships no behaviour change. Bugs found along the way are recorded and fixed in separate commits or separate issues, so that a reviewer can trust that a structural commit is only structural.

5. Build the safety net first

Compare the invariants with existing tests. Where behaviour is unguarded, the first commits of the plan add tests, written against the code as it behaves today (characterization tests), through the public interface so they survive the restructuring. For output-heavy code, pin representative inputs and their current outputs. If the user declines to add tests, record that as an accepted risk in the issue.

6. Choose how the change is rolled in

Situation Technique
Reshaping code inside one module Small in-place steps: extract, move, rename, inline, one per commit
Changing a signature, schema or API that has many users Parallel change: add the new form beside the old (expand), move callers over (migrate), delete the old (contract)
Swapping a library or an internal component Branch by abstraction: put an interface in front of the old one, build the new one behind it, switch, remove
Replacing a subsystem Strangler fig: route one slice of traffic or one use case at a time to the new code
A risky runtime difference A flag that selects old or new path, removed in the final commits

7. Write the commit sequence

Rules for every commit in the plan:

  • The build and the whole test suite pass after it; it can be deployed alone.
  • It does one kind of thing. Moves and renames are separate from edits, so the diff of a move is empty of logic and history stays traceable.
  • It can be reverted without reverting its successors, or the plan says which commits form a unit.

Usual order: tests that pin behaviour → preparatory tidying that makes the change easy → introduce the new structure unused → move callers in batches → delete the old structure → clean up names and docs. For each commit give an imperative title, what changes, and how it is verified. Mark checkpoints, after which work could stop with the codebase better off, and any point of no return, such as a destructive migration, with what has to be true before crossing it.

8. Review, then file

Show the user the full draft and ask specifically: is the frozen behaviour complete, is any commit too big, where wo

Полный SKILL.md на GitHub

Установить request-refactor-plan в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл request-refactor-plan?

Produces a refactor plan and files it as a GitHub issue for review: interviews the user about the pain and the constraints, checks every claim against the code, weighs alternatives, pins down behaviour that must not change, and lays the work out as a sequence of small commits that each keep the build and tests passing. Use when the user says "plan this refactor", "write a refactoring RFC", "I want to restructure this module safely", "break this refactor into small steps", or "open an issue proposing a refactor".

Как установить скилл request-refactor-plan?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл request-refactor-plan запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить request-refactor-plan с