/aref:applying-refactorsfrom aref
Executes a multi-phase refactor plan on a dedicated branch with per-phase commits and mandatory reviewer checkpoints between phases.
Ships in aref. 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.
Applying refactors IS executing each phase as a green, bounded-size commit with an adversarial review between phases.
One branch. One commit per phase. One reviewer pass per phase. Zero silent advances. Zero phase >400 LOC unless explicitly acknowledged.
Core principle: Rollback is a first-class path, not an exception.
Pattern: Chain
Handoff: user-confirmation per phase
Next: verifying-refactors (after last phase green)
[applying-refactors] Task N: <action>Tasks:
Run git status --porcelain. Non-empty → abort: "Uncommitted changes exist. Commit or stash, then rerun."
Read plan metadata for branch_name. Run:
git checkout -b <branch_name>
Already exists → abort: "Branch exists. Delete or rename, then rerun."
For each Phase N in plan (ascending):
Apply changes per phase files and description. Edit only the listed files. Do not touch adjacent files even if tempting.
Run the phase's verification.command. Non-zero exit → stop; do not commit; diagnose. Options: rollback phase, adjust plan, abort run.
Invoke refactor-phase-reviewer agent with:
git diff)test_result: stdout + exit code from the verification command (Check 4 of the reviewer requires this)Reviewer returns APPROVED or CHANGES_REQUESTED.
CHANGES_REQUESTED → address feedback in-place, rerun verification, re-invoke reviewer. Max 2 retries → escalate to user.
Per references/phase-commit-protocol.md format.
Print phase N summary: files changed, LOC, verification result, reviewer outcome. Ask user:
continue → next phaserollback phase → git reset --hard HEAD~1, retry phaseabort run → stop, leave branchAfter last phase's user continue, print run summary and hand off to verifying-refactors.
git commit --amend during phase loopgit rebase / git reset --hard outside rollback path--no-verify)CHANGES_REQUESTED without addressing feedback| Thought | Reality |
|---|---|
| "Test runner is slow — skip verification" | Green at every commit is the contract. No skip. |
| "Reviewer is picky, override" | Reviewer enforces the 400 LOC cap and test discipline. Overriding invalidates the plan. |
| "Merge plan phases for speed" | Phase boundary = rollback unit. Merging = losing rollback. |
| "amend to fix a typo" | Amend post-review = review bypass. New commit instead. |
references/phase-commit-protocol.mdWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/analyzing-codebasesDetects project languages and monorepo state, runs language-appropriate static analysis (dependency graph, complexity, duplication, semantic patterns), and produces a refactor map ranking hotspots. Use when user invokes /aref or explicitly asks to analyze a codebase for refactoring./finalizing-refactorsWrites AGENTS.md per subproject, archives run artifacts, and suggests rcc handoff conditionally. Use when verifying-refactors passes (PASS or PASS-WITH-WEAK-TESTS)./planning-refactorsConverts a refactor map into a phased plan using parallel-change, branch-by-abstraction, or strangler fig patterns. Use when user has approved the refactor map from analyzing-codebases.npx claudepluginhub wayne930242/reflexive-claude-code --plugin arefOther plugins' skills for the same job