From ctx
Safely refactors code test-first: verifies/writes tests, one structural change at a time, preserves behavior. Use for 'refactor this', 'clean this up', reorganization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ctx:ctx-refactorThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Refactor the specified code following strict safety rules.
Refactor the specified code following strict safety rules. Refactoring changes structure, not outcomes.
/gitnexus-refactoring if GitNexus is available; otherwise
use grep-based search to find all references before renaming)Follow these in order. Do not skip steps.
.context/CONVENTIONS.md
to ensure the refactored code follows established patterns..context/CONVENTIONS.md to load project patternsmake lint && make testBefore starting, present the plan:
## Refactoring Plan: <target>
1. <step>: why
2. <step>: why
...
Tests to verify: <list>
After each step, report: what changed, tests still passing.
npx claudepluginhub activememory/ctx --plugin ctxSafely refactors code with test coverage: writes tests first if absent, plans changes, applies small testable steps, verifies tests/lint/typecheck pass without behavior changes.
Safely restructure code in an isolated git worktree with test-preserved, incremental transformations
Safe, test-gated refactoring methodology: behavior-preserving transformations (extract, inline, rename, move, simplify, delete) enforced with full test runs before, during, and after each change.