refactor

Solid

Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

Code & Development 34,233 stars 4188 forks Updated today MIT

Install

View on GitHub

Quality Score: 96/100

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

Skill Content

# Refactor ## Overview Improve code structure and readability without changing external behavior. Refactoring is gradual evolution, not revolution. Use this for improving existing code, not rewriting from scratch. ## When to Use Use this skill when: - Code is hard to understand or maintain - Functions/classes are too large - Code smells need addressing - Adding features is difficult due to code structure - User asks "clean up this code", "refactor this", "improve this" --- ## Refactoring Principles ### The Golden Rules 1. **Behavior is preserved** - Refactoring doesn't change what the code does, only how 2. **Small steps** - Make tiny changes, test after each 3. **Version control is your friend** - Commit before and after each safe state 4. **Tests are essential** - Without tests, you're not refactoring, you're editing 5. **One thing at a time** - Don't mix refactoring with feature changes ### When NOT to Refactor ``` - Code that works and won't change again (if it ain't broke...) - Critical production code without tests (add tests first) - When you're under a tight deadline - "Just because" - need a clear purpose ``` --- ## Common Code Smells & Fixes ### 1. Long Method/Function ```diff # BAD: 200-line function that does everything - async function processOrder(orderId) { - // 50 lines: fetch order - // 30 lines: validate order - // 40 lines: calculate pricing - // 30 lines: update inventory - // 20 lines: create shipment - // 30 lines: send notific...

Details

Author
github
Repository
github/awesome-copilot
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Listed

refactor

Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

335 Updated today
aiskillstore
Code & Development Listed

code-refactoring

Simplify and refactor code while preserving behavior, improving clarity, and reducing complexity. Use when simplifying complex code, removing duplication, or applying design patterns. Handles Extract Method, DRY principle, SOLID principles, behavior validation, and refactoring patterns.

335 Updated today
aiskillstore
Code & Development Listed

refactoring

Use when refactoring code, identifying refactor candidates, or improving design after tests are green.

4 Updated 2 days ago
juanibiapina
Code & Development Listed

refactoring-patterns

Safe refactoring workflow and common patterns. Invoke when extracting methods, renaming, moving code, or addressing code smells.

43 Updated 3 months ago
diegosouzapw
AI & Automation Listed

refactor-master

Restructure messy code into smaller, more focused pieces — without changing observable behavior. Knows when to extract a function, split a module, replace a conditional with a strategy, pull pure logic out of side-effect-heavy code, and when to do nothing. Use when the user says "refactor this", "clean this up", "this file is too big", "split this module", "make this readable", or hands over a god-class and asks for a rescue plan.

0 Updated 3 days ago
ashishkumar14