Refactoring Suggestions
AI can spot opportunities to improve code readability, maintainability, and performance. Use it as a pair programmer for refactoring decisions.
Asking for Readability Improvements
Loading Prompt Playground...
Simplification Requests
When code feels complex, ask:
Loading Prompt Playground...
Before/After Patterns
Great refactoring prompts ask for comparison:
- "Show the before and after code"
- "Explain why the refactored version is better"
- "What does this change improve?"
- "Are there any tradeoffs?"
Common Refactoring Opportunities
AI excels at suggesting:
| Pattern | Improvement |
|---|---|
| Long functions | Extract into smaller functions |
| Nested conditionals | Early returns, guard clauses |
| Magic numbers | Named constants |
| Repeated code | DRY with helper functions |
| Callback hell | async/await |
| Imperative loops | Functional methods (map, filter) |
Key Takeaway
Don't just ask "is this code good?" Ask specific questions: "How can I make this more readable?" or "Is there a simpler way to express this logic?" Specific questions get better refactoring suggestions.

