/refactor:port [<what is being ported>]from refactor
Guides porting, migration, or cutover of code while preserving behavior. Uses a differential harness to compare old vs new outputs on real inputs and maintains a ledger of divergences.
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; scripts run unread.
Port $ARGUMENTS, or the implementation the user named, so that every caller sees the same behavior from the new code as from the old. The old implementation is the oracle: while both exist, the old code defines correct, ahead of the spec, the docs, and the test suite. A ported test suite often runs green while real inputs diverge, so treat green tests as necessary, never as proof of parity.
Before porting, find every caller and gather the inputs they pass: scripts, cron and CI jobs, the README and docs, config files the code reads, tests, and logged invocations. A caller outside the files being edited breaks only at cutover. Count the match rate over these real inputs, and report which set it counts.
Run old and new on the same inputs and diff the results before declaring done. When both run as commands over input files, use the bundled runner:
bun ${CLAUDE_PLUGIN_ROOT}/skills/port/scripts/diff-run.ts --old '<old command> {}' --new '<new command> {}' --out tmp/<task> <inputs...>
It compares exit code, then stdout, then stderr, and writes ledger.json and ledger.md under --out. {} becomes the quoted input path, or pass --stdin. --normalize <regex> masks a field in both outputs, and each normalization is an exemption. Record nondeterministic or side-effecting calls once and replay them to both sides. For checkpoints, generated inputs, wrappers, fingerprints, and a pre-merge review, read references/harness.md.
Keep one row per distinct divergence in the ledger file, with its inputs and status: open, fixed, or exempt with who signed off. An intended change needs the user's sign-off. With nobody present to sign off, mark the row proposed, finish the other rows, and lead the report with the proposals. Fix each row in the general code path, never with a special case for one input.
The port is done when every ledger row is closed or signed off and the harness matches on every real input gathered. Report the match rate, input count, and exemptions in the PR body. Keep the old implementation and the harness until the user approves cutover, then delete both in the cutover change.
When the target is an interface someone else defines, such as a framework's store or client protocol, read references/interface.md.
When the new implementation is a library replacing code the project wrote itself, read references/upstream.md.
When several copies of the same logic become one shared version, read references/dedupe.md.
When the port repeats across many units, such as scripts, call sites, or modules, read references/scale.md before the second unit.
For a production service with live traffic, private payloads, or a long dual-run period, read references/production.md.
references/dedupe.md (opens in a new tab)references/harness.md (opens in a new tab)references/interface.md (opens in a new tab)references/patterns.md (opens in a new tab)references/production.md (opens in a new tab)references/scale.md (opens in a new tab)references/upstream.md (opens in a new tab)scripts/diff-run.test.ts (opens in a new tab)scripts/diff-run.ts (opens in a new tab)scripts/fingerprint.ts (opens in a new tab)scripts/ledger.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
porting, migration, cutover, behavioral-parity, differential-testing
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./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