refactor

Featured

Expert code refactoring based on Martin Fowler's catalog — improve maintainability without changing behavior. Covers code smells, composing methods, moving features, organizing data, simplifying conditionals, method calls, and generalization. Triggers on: refactor, 重构, clean up, improve code, code smell, extract method, rename, simplify.

Code & Development 235 stars 32 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
79
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Refactor — Expert Code Restructuring Surgical code refactoring based on Martin Fowler's <Refactoring> (2nd Edition) catalog. Improve structure, readability, and maintainability without changing external behavior. Gradual evolution, not revolution. --- ## When to Use This skill activates when: - Code is hard to understand or maintain - Functions/classes have grown too large - Code smells are detected - Adding features is difficult due to poor structure - User explicitly requests refactoring, cleanup, or improvement - User says: refactor, 重构, clean up, improve code, code smell, extract method, rename, simplify --- ## The Golden Rules These five rules are non-negotiable. Violating any of them turns refactoring into reckless editing. ### 1. Behavior is Preserved Only *how* the code works changes, never *what* it does. If tests existed before, they must pass after. If the refactoring introduces a behavioral change, it's not refactoring — it's rewriting. ### 2. Small Steps Each change should be the smallest possible transformation that compiles and passes tests. If a step breaks, you know exactly which change caused it. Refactoring is a series of tiny, safe transformations, not one big rewrite. ### 3. Version Control is Your Friend Commit before starting. Commit after each successful step. This gives you infinite undo. Branch from a clean state so you can abandon the refactoring without consequences. ### 4. Tests are Essential "Without tests, you're not refactoring...

Details

Author
smallnest
Repository
smallnest/goal-workflow
Created
3 months ago
Last Updated
5 days ago
Language
HTML
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category