same-results-less-code
Installation
SKILL.md
Community Refactoring Best Practices: Same Results, Less Code
Code-review and refactoring guide focused on the parts of code volume that come from judgment and modelling gaps — wrong abstraction choices, hidden semantic duplication, defensive habits, premature generality. This skill deliberately skips what linters and tools like knip, eslint, ruff, tsc --noUnusedLocals, or formatters already catch. It is the second pass: after the mechanical cleanup, what remains?
Core Principles
- Preserve behaviour. Every transformation must produce identical observable behaviour — same outputs, same errors, same side effects, same API surface.
- Earlier mistakes cascade. A wrong frame multiplies into wrong shapes, which multiply into duplicate logic. Optimise from the top of the lifecycle.
- Explain why, not just what. Each rule explains the cost of the anti-pattern so judgment can transfer to novel cases.
- Quantify where possible. Prefer "eliminates N lines / prevents X bug class" over "cleaner."
- Don't over-refactor. Rule of three: extract abstractions when duplication has actually appeared three times, not in anticipation.
When to Apply
Use this skill when: