refactor
The behavior-preserving restructure gate. Routed to by /refactor for a rename, extract, inline, move, dedup, or internal-implementation swap. Six gated phases prove behavioral parity through unmodified pre-existing tests; any diff that classifies as `feat` is not a refactor and is routed to tdd. A modified pre-existing test is rejected as evidence — it is a behavior change in disguise.
npx skills add arbiterForge/codeArbiter --skill refactor --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# refactor Restructure, do not rewrite. Externally observable behavior before equals after — proven by mechanism, not inspection. Routed to by `/refactor`. ## Pre-flight Read these, or STOP and surface the gap — never guess a command or a threshold: - `{{PROJECT_DIR}}/.codearbiter/CONTEXT.md` — the `stage:` frontmatter (the maturity value) and project context. - `{{PROJECT_DIR}}/.codearbiter/tech-stack.md` — the test, coverage, lint, and type-check invocations; file layout. - `{{PROJECT_DIR}}/.codearbiter/coding-standards.md` — style, structure, naming. Required for Phase 4. The working tree MUST be clean over the named surface before Phase 1. A dirty surface conflates the refactor diff with unrelated edits and breaks parity verification — STOP and surface it. ## Phase 1 — Surface identification · gate: BLOCK Enumerate the exact blast radius before any other work. Restate the planned refactor in one sentence and confirm it back to the user, then record a surface table: - Files (repo-relative paths). - Top-level symbols touched — function, class, and exported member names. - Public method signatures within those symbols. - External consumers — call sites in other modules. Reject vag
- Pre-flight
- Phase 1 — Surface identification · gate: BLOCK
- Phase 2 — Behavioral parity coverage proof · gate: BLOCK
- Phase 3 — Red parity tests (conditional) · gate: BLOCK
- Phase 4 — Implementation · gate: BLOCK
- Phase 5 — Parity verification · gate: BLOCK
- Phase 6 — Lint and coverage · gate: BLOCK
- Hard rules
What does the refactor skill do?
The behavior-preserving restructure gate. Routed to by /refactor for a rename, extract, inline, move, dedup, or internal-implementation swap. Six gated phases prove behavioral parity through unmodified pre-existing tests; any diff that classifies as `feat` is not a refactor and is routed to tdd. A modified pre-existing test is rejected as evidence — it is a behavior change in disguise.
How do I install it?
Run `npx skills add arbiterForge/codeArbiter --skill refactor --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From arbiterForge/codeArbiter, a repository with 138 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
