Install any skill in seconds. Free to start, no credit card required.
Get Started Free →wondelai/refactoring-patterns
Apply named refactoring transformations to improve code structure without changing behavior.
Passed 19 of 23 test cases with the skill, and 19 of 23 without it.
2 fixed17 passed either way2 still failing2 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
I am refactoring a 30-line TypeScript function that processes user registrations. In the middle of the function, there is a comment `// validate email format and domain whitelist` followed by 8 lines of regex checks and domain lookup. How should this block be refactored?
| Checked | Without skill | With skill |
|---|---|---|
| recommends applying Extract Method to convert the commented code block into a helper function | Passed | Passed |
| uses the comment text to name the extracted method | Missed | Passed |
The instructions your model reads when the skill loads.
A disciplined approach to improving the internal structure of existing code without changing its observable behavior. Every refactoring follows the same loop: verify tests pass, apply one small structural change, verify tests still pass.
Refactoring is not rewriting. It is a sequence of small, behavior-preserving transformations, each backed by tests. You never change what the code does — only how it is organized. Big-bang rewrites fail because they combine structural change with behavioral change, making it impossible to know which broke things.
The foundation: Bad code is a natural consequence of delivering under time pressure, not a character flaw. Code smells are objective signals of degraded structure; the smell catalog tells you where to look, and the refactoring catalog tells you what to do.
Goal: 10/10. Score structural quality by how many of the eight Quick Diagnostic rows pass — score = round(passed / 8 × 10), adjusting down when a single smell is severe. Bands:
Always state the current score, name the smells driving it down, and list the specific refactorings needed to reach 10/10.
Six areas of focus for systematically improving code structure:
Core concept: Code smells are surface indicators of deeper structural problems — not bugs, but signals that the design makes code harder to understand, extend, or maintain. Each smell maps to named refactorings that fix it.
Why it works: Named smells give teams objective criteria instead of subjective "I don't like this" — "This is Feature Envy" points directly at the fix.
Key insights:
Code applications:
| Context | Pattern | Example |
|---|
test cases passed, vs 19 / 23 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.