prompts/prompt-refactoring
Prompts for safe and systematic code refactoring
Prompts to guide code refactoring while maintaining functionality. Covers identifying refactoring opportunities, planning changes, ensuring test coverage, and validating behavior preservation.
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
Details
| Category | prompts |
| Tags | productivitytestingadvanced |
| License | CC-BY-4.0 |
| Author | Claude Code Directory |
| Difficulty | advanced |
Pairs with
prompts/prompt-code-review
Structured prompts for thorough code reviews
prompts/prompt-debugging
Systematic prompts for debugging complex issues
mcp-servers/mcp-server-filesystem
Secure file system access with configurable permissions and sandboxing
mcp-servers/mcp-server-memory
Persistent memory and knowledge graph for Claude conversations