/refactor:split [<file, function, or class>]from refactor
Breaks monolithic files, functions, or classes into smaller modules without changing behavior. Guides on choosing cut lines by shared state and data, placement, and preserving exported names.
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.
None: SKILL.md is the whole skill.
Split $ARGUMENTS, or the code the user named, into modules with one responsibility apiece. Every caller sees the same behavior and the same exported names as before. The deliverable is a set of moves a reviewer can verify as moves.
Group code by the state and data it shares and by who calls it. Code that reads and writes the same fields belongs together. Code that only shares a file does not. Line count and kind of code (types, helpers, handlers) are weak signals.
These rules also place a shared version that replaces duplicate copies.
utils, helpers, or common means the cut is not settled.Propose the cut to the user as a list of new modules, each with a one-line purpose and the names it takes, before moving code when the split creates more than three modules or changes any import path outside the file. With nobody present to answer, take the cut and lead the report with it.
When the same split repeats across many files, split one to three by hand and follow port's scale method for the rest.
Commit pure moves separately from edits. A move commit relocates code and adjusts imports, nothing else, so git diff --color-moved shows it as moved lines. Renames, signature changes, and cleanup go in later commits.
break and continue, exceptions, closures over mutated locals, and this.madge, import-linter, go vet, the compiler). A cycle between two new modules means they share state and belong together.The split is done when:
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
/candidatesUse when asked to find, survey, or rank refactoring targets in a codebase, such as hand-rolled code a library or runtime built-in should replace, large modules with several responsibilities, or duplicated logic. Produces a ranked report with run-verified behavior differences and changes no code. To carry out a pick, use port or split./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.Other plugins' skills for the same job