From code-simplifier
Refactors code without changing behavior using a test-first, step-by-step process. Requires passing tests and verifies after each atomic step.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-simplifier:refactor <file-or-function><file-or-function>This 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 = changing code structure WITHOUT changing behavior. If behavior changes → that is a feature/fix, not a refactor.
Refactor = changing code structure WITHOUT changing behavior. If behavior changes → that is a feature/fix, not a refactor.
Do NOT start refactoring if any of the following is true:
Ask the user if needed:
Read the code, understand what it does. Then:
List code smells present:
Propose a refactor plan as small steps, each step:
Example:
Step 1: Extract function `validateEmail` from `signupUser`
Step 2: Rename `data` → `userInput` (4 locations)
Step 3: Split type `User` into 2 types: `UserInput` and `UserRecord`
Step 4: Replace magic number 86400 with const `SECONDS_PER_DAY`
Present the plan to the user, ask: "OK with this plan? Do all steps, or only some?"
For EACH step:
refactor: extract validateEmail function.Do NOT combine multiple steps into one large edit. The urge to do it all at once is tempting — but a mistake in a large batch is hard to find. Small steps + small commits = easy to revert.
After all steps are done:
Do NOT do these during a refactor:
If code is too tangled, has no tests, and the author has left:
When done, report:
Refactor complete: [scope]
Steps executed:
1. ✓ Extract validateEmail (commit abc123)
2. ✓ Rename data → userInput (commit def456)
3. ✗ Step 3 (split type) — test failed, reverted. Reason: ...
4. ✓ Replace magic number (commit ghi789)
Ran:
- Test suite: pass (124 tests)
- Lint: clean
- Build: success
[If applicable] Notes for follow-up:
- Found a bug in foo.ts:42 during refactor — not fixed, open an issue?
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub minhthang1009/dotclaude --plugin code-simplifier