Restructures code by extracting methods, renaming symbols, simplifying conditionals, removing duplication, and eliminating dead code — while running tests before and after each change to ensure behavior is preserved. Invoke immediately when user mentions refactor, refactoring, clean up, restructure, simplify, technical debt, code smell, DRY violations, or when code is messy, complex, or hard to maintain.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Work autonomously as much as possible. Start with the simplest thing or file and proceed to the more complex ones.
Do not change test code during refactoring, except:
Never change test assertions, test data, or test logic.
Prefer self-explanatory, readable code over comments.
For each refactor:
When you see no more obvious refactoring opportunities, say "Entering final evaluation."
Shift focus: you've been implementing. Now become a critic. Your job is to find problems, not produce code.
Re-read Code Style guidelines. Look at each file in scope. Consider blind spots - what improvements haven't we even considered that would make the code better, easier, more maintainable?
For each file, find ONE thing that could be better. If you find something:
Repeat until you find nothing more to improve.
Provide a high-level summary of the refactoring:
2a98cc1
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.