Refactoring Guide
Analyzes specified code to detect code smells such as duplicated code, long functions, and complex conditionals. Provides step-by-step refactoring methods and expected improvements for each issue.
/refactor [file]Inheriting legacy code with no idea where to start? Run /refactor to get priorities + a step-by-step plan
How It Works
Skill Code
Copy and paste into your CLAUDE.md to start using immediately.
How Refactoring Guide Works
Refactor Guide scans the target file for code smells — long functions, deep nesting, duplicated logic, god objects — then creates a step-by-step refactoring plan with before/after examples and risk assessment for each change.
When to Use Refactoring Guide
Best deployed on legacy codebases where you need to improve structure without breaking existing behavior, especially when the code lacks tests and each refactoring step needs to be safe and reversible.
Key Strengths
- Detects multiple code smell categories automatically
- Generates safe, incremental refactoring steps
- Includes risk assessment for each proposed change
- Provides before/after examples for clarity