Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Plan a safe, incremental refactor of messy code without changing behavior. Use when code needs restructuring, is hard to change, has grown tangled, or you want to clean it up before adding a feature. Produces a sequenced plan of small behavior-preserving steps, the safety net (tests/characterization) to add first, and the target structure — refactoring as a series of green commits, not a risky big-bang rewrite.
.claude/skills/mohitagw15856-refactoring-plan/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -43% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -18% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -18% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -22% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -20% | 0% |
Refactoring means improving structure without changing behavior — and the danger is doing it in one big risky sweep. This skill plans the opposite: a safety net first, then a sequence of small, behavior-preserving steps, each leaving the code green and committable. It separates refactoring from feature work, so you're never doing both at once.
Ask for these only if they aren't already provided:
Why & goal — the current pain in one line, and what "better" enables.
Safety net (do first) — the tests that must exist before touching anything. If coverage is thin, add characterization tests that pin current behavior (even bugs) so you'd notice any change. Don't refactor untested code blind.
Target structure — a short sketch of where you're going (the shape, the seams, the names).
Steps (small & sequenced) — each step is behavior-preserving and independently committable:
| # | Step | Refactoring move | Stays green by | Commit after | |---|---|---|---|---| | 1 | … | (extract function / rename / introduce interface / move) | run tests | ✅ |
Order them so risk drops early and each step is reversible.
Definition of done — behavior identical (tests still green), the goal structure reached, no feature changes smuggled in.
Refactoring discipline (Martin Fowler): behavior-preserving transformations, characterization tests, small steps.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 75,649 | 18,577 | -75% | 1 | 1 | 0% | 6,967 | 2,918 | -58% | 0 | 0 | — |
case-02 | fail→pass | 77,090 | 21,951 | -72% | 1 | 1 | 0% | 5,069 | 2,891 | -43% | 0 | 0 | — |
case-03 | fail→fail | 25,422 | 22,416 | -12% | 1 | 1 | 0% | 4,069 | 2,972 | -27% | 0 | 0 | — |
case-04 | fail→pass | 27,068 | 23,237 | -14% | 1 | 1 | 0% | 3,934 | 3,207 | -18% | 0 | 0 | — |
case-05 | fail→pass | 22,792 | 15,993 | -30% | 1 | 1 | 0% | 3,362 | 2,771 | -18% | 0 | 0 | — |
case-06 | fail→pass | 20,394 | 12,953 | -36% | 1 | 1 | 0% | 3,208 | 2,513 | -22% | 0 | 0 | — |
case-07 | fail→pass | 25,979 | 12,871 | -50% | 1 | 1 | 0% | 3,800 | 3,026 | -20% | 0 | 0 | — |
case-08 | fail→pass | 15,446 | 4,420 | -71% | 1 | 1 | 0% | 2,005 | 1,142 | -43% | 0 | 0 | — |
case-09 | pass→fail | 9,991 | 28,518 | +185% | 1 | 1 | 0% | 1,773 | 3,637 | +105% | 0 | 0 | — |
case-10 | pass→pass | 26,504 | 15,430 | -42% | 1 | 1 | 0% | 2,843 | 3,624 | +27% | 0 | 0 | — |
case-11 | pass→fail | 23,122 | 18,146 | -22% | 1 | 1 | 0% | 3,159 | 3,700 | +17% | 0 | 0 | — |
case-12 | fail→pass | 16,608 | 11,038 | -34% | 1 | 1 | 0% | 3,047 | 2,615 | -14% | 0 | 0 | — |
case-13 | fail→fail | 24,682 | 11,214 | -55% | 1 | 1 | 0% | 3,416 | 2,661 | -22% | 0 | 0 | — |
case-14 | fail→pass | 15,108 | 12,813 | -15% | 1 | 1 | 0% | 2,507 | 2,656 | +6% | 0 | 0 | — |
case-15 | fail→pass | 22,694 | 10,680 | -53% | 1 | 1 | 0% | 3,123 | 2,505 | -20% | 0 | 0 | — |
case-16 | fail→pass | 21,309 | 12,452 | -42% | 1 | 1 | 0% | 2,836 | 2,753 | -3% | 0 | 0 | — |
case-17 | fail→pass | 21,655 | 14,705 | -32% | 1 | 1 | 0% | 3,281 | 3,134 | -4% | 0 | 0 | — |
case-18 | fail→pass | 22,948 | 13,963 | -39% | 1 | 1 | 0% | 4,052 | 2,528 | -38% | 0 | 0 | — |
case-19 | fail→pass | 18,781 | 15,250 | -19% | 1 | 1 | 0% | 3,223 | 2,511 | -22% | 0 | 0 | — |
case-20 | fail→fail | 21,613 | 14,291 | -34% | 1 | 1 | 0% | 2,927 | 3,133 | +7% | 0 | 0 | — |
case-21 | fail→pass | 22,104 | 14,059 | -36% | 1 | 1 | 0% | 4,006 | 2,953 | -26% | 0 | 0 | — |
case-22 | fail→fail | 18,806 | 13,189 | -30% | 1 | 1 | 0% | 3,550 | 2,451 | -31% | 0 | 0 | — |
case-23 | fail→pass | 35,517 | 14,924 | -58% | 1 | 1 | 0% | 3,339 | 2,544 | -24% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +57 percentage points is the difference between those two pass rates over the 23 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.