Refactoring
Refactor code safely to improve structure and readability without changing behavior. Use when the user asks to refactor, clean up, reduce duplication, or pay down tech debt.From its SKILL.md
npx -y skills add minagayid/Agents --skill refactoringAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.6 KB, as published. Nobody here has run it
Refactoring
Improve internal structure while keeping external behavior identical.
Golden rule
Refactoring never changes behavior. If you're also fixing a bug or adding a feature, do it as a separate, clearly labeled step — never mix behavior changes into a refactor.
Process
- Establish a safety net. Ensure tests cover the code; add characterization tests if coverage is thin.
- Make small, reversible steps. One transformation at a time; run tests after each.
- Commit frequently with messages that say what was refactored (and that behavior is unchanged).
Common moves
- Extract function/method; give it an intention-revealing name.
- Remove duplication (DRY) — but only genuine duplication, not coincidental similarity.
- Replace magic numbers/strings with named constants.
- Simplify conditionals (guard clauses, early returns); flatten nesting.
- Split large functions/classes by responsibility; narrow interfaces.
- Replace comments-that-explain-what with clearer code; keep comments that explain why.
- Delete dead code.
Guidelines
- Match the surrounding style and conventions.
- Don't gold-plate: refactor what you're touching or what's demonstrably painful, not everything.
- Watch for behavior you might accidentally change — error handling, edge cases, side effects, ordering.
- If tests are missing and can't be added cheaply, refactor extra conservatively and verify by hand.