Refactoring Guide Prompts

Prompts for safe and systematic code refactoring

Category:prompts
Type:prompt
Difficulty:advanced
productivity
testing
advanced

Description

Prompts to guide code refactoring while maintaining functionality. Covers identifying refactoring opportunities, planning changes, ensuring test coverage, and validating behavior preservation.

Content

Resource Content
# Refactoring Guide Prompt

Help me refactor this code:

```
[Paste code to refactor]
```

**Goals:**
- [ ] Improve readability
- [ ] Reduce complexity
- [ ] Better separation of concerns
- [ ] Improve testability
- [ ] Remove duplication

**Constraints:**
- Must maintain existing API/interface
- Tests must continue to pass
- No new dependencies without justification

Please provide:
1. Analysis of current issues
2. Step-by-step refactoring plan
3. Refactored code
4. Explanation of changes
5. Potential risks and mitigations