/refactor:candidates [--mode upstream|split|dedupe] [<repo or path>...]from refactor
Surveys a codebase for refactoring targets: hand-rolled code replaceable by libraries, large modules needing splitting, or duplicated logic. Produces a ranked, verified report without changing code.
Ships in refactor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Survey $ARGUMENTS, or the repositories the user named, for refactors worth doing, and rank them. Someone reads the report, picks rows, and hands each to the skill that executes it. A row earns its place with facts checked against the code: where it is, what the replacement does differently when run, what it removes, and what a port must prove. A list of smells is not a report.
The work ends at the report. Leave source, tests, manifests, and lockfiles unchanged. Put probe scripts in a temp directory outside the repository.
--mode: survey one mode. Default: all three.| Mode | Target | Executed by |
|---|---|---|
| upstream | Hand-rolled code that the standard library, a runtime built-in, or a maintained package should replace | port, through its references/upstream.md |
| split | A large module holding several responsibilities | split |
| dedupe | The same logic copied into several places | port, through its references/dedupe.md |
When duplicated copies reimplement a solved problem such as escaping, parsing, or retries, file the row under upstream. Once every copy calls the library, nothing is left to share.
Read references/search.md before searching. It holds the per-mode searches.
tsconfig lib, target, requires-python, go.mod). A replacement already used elsewhere in the repository is the strongest and lowest-risk candidate. A built-in absent from one directory's target keeps that directory's copy.For each row you rank, run the hand-rolled code and its replacement on the same probe inputs and record every difference. Write each difference as a finding: the input, what the old code returns, what the new code returns. Mark it verified with the runtime and version it ran on. A difference that was not run is labeled unverified, never stated as fact.
Order rows by what they remove against what they risk.
For each ranked row, name the parity harness its port needs: the probe inputs, what to compare, and which tests pin the old behavior. The executing skill builds that harness first.
Put every candidate you examined and did not rank on a rejected list with its reason. Apply the keep criteria in port's upstream.md. Reasons past surveys used:
* stop at /.Write the report in the shape references/layout.md gives. When the user names a path, write it there. Otherwise put it in the reply. Each ranked row carries:
path:line;Close with the rejected list, then the top picks as hand-offs, one line each, naming the executing skill and its target.
The survey is done when:
git status in each repository shows no change from the survey.Stop at the report. Start a port or split only when the user picks a row.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bendrucker/claude --plugin refactor3 skills in this plugin
/portLoad before changing code in any port, migration, or cutover, even when the request never says "port", and whenever an existing script, service, or module is being retired, deleted, or switched off because a newer implementation now does its job, in any language. That covers rewriting code in another language or as TypeScript, switching code from one library, engine, or module to another, implementing a framework's interface in place of a handwritten class, replacing homegrown code with the standard library or a package, merging duplicate copies, and finishing a port or cutting callers over to it. Inputs and callers that worked before must keep working. Not for a deliberate behavior change such as a bug fix or a new option, and not for a database schema./splitBreak a monolithic file, function, or class into smaller modules without changing behavior. Use when splitting, breaking up, or extracting from a large file, god class, or long function, or when a module has grown several unrelated responsibilities.Other plugins' skills for the same job