Coding

Code Refactoring Assistant

Paste messy or complex code and get a clean, modular, well-named refactored version that follows language best practices.

By The Prompt Black Magic Team

Paste the prompt into any LLM along with the code you want refactored. Specify the programming language.

Refactor the following code to be more readable, modular, and aligned with best practices.

Your refactoring should:
1. Break complex functions into smaller, reusable pieces
2. Improve variable and function naming to be self-documenting
3. Remove redundant code and unnecessary complexity
4. Add appropriate error handling where missing
5. Follow the language's style guide and conventions
6. Preserve all existing functionality

Provide:
- The refactored code with clear comments
- A summary of every change you made and why
- Any additional suggestions you held back on

Language: [LANGUAGE]
Here is the code:
[paste your code here]