From Claude Setup
Single-context refactor: audit → plan → approve → implement. Verifies tests still pass; optionally commits and offers a code review pass. Use by default instead of sub-agent fan-out.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-setup:refactor-lite <file, directory, or description of what to improve><file, directory, or description of what to improve>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Single-context refactor: **audit → plan → approve → implement**, all in this Opus session with **no sub-agent fan-out, no intermediate task files**. Behavior preservation is the primary success criterion. Verifies tests still pass, optionally commits. Review is a separate pass — offered at the end via `/code-review`.
Single-context refactor: audit → plan → approve → implement, all in this Opus session with no sub-agent fan-out, no intermediate task files. Behavior preservation is the primary success criterion. Verifies tests still pass, optionally commits. Review is a separate pass — offered at the end via /code-review.
Use this by default. Reach for the heavier /claude-setup:refactor only when the cleanup spans many independent files that can be parallelized, or genuinely exceeds one context.
$ARGUMENTS — a file, directory, or description of what to improve.
file:line specifics: duplication, complexity, dead code, poor naming, missing abstractions.Present a concise plan:
Ask via AskUserQuestion: "Proceed?" → Proceed / Revise (loop) / Cancel. Never edit before approval.
If the plan calls for it, write characterization tests for the current behavior first and confirm they pass against the unmodified code. This is your regression guard.
Apply the refactor incrementally in this session. Preserve public APIs unless a breaking change was explicitly approved. No feature changes — refactor only. Keep context warm; no task files, no sub-agents.
git restore / git checkout --).Ask: "Commit these changes?"
main/master, branch to refactor/<3-5-word-slug> first; git add -A && git commit -m "refactor: <summary>"; then optionally push + open a PR (git push -u origin <branch> + gh pr create, or print the manual command).End with AskUserQuestion: "Run an independent /code-review pass?"
code-review skill, scoped to the diff./code-review when you want an independent pass." and stop./claude-setup:refactor.npx claudepluginhub nickmaglowsch/claude-setup --plugin claude-setupSafely refactors code test-first: verifies/writes tests, one structural change at a time, preserves behavior. Use for 'refactor this', 'clean this up', reorganization.
Orchestrates a multi-step refactoring pipeline: analyzes code quality, plans improvements, optionally writes tests, implements changes, and reviews results. Routes simple refactors to a lighter workflow.
Safely refactors code with test coverage: writes tests first if absent, plans changes, applies small testable steps, verifies tests/lint/typecheck pass without behavior changes.