Generate a Code Refactoring Plan
Review [codebase/project] and create a refactoring roadmap. Identify technical debt, duplicated logic, and maintainability issues. Prioritize quick wins.
Technical debt compounds similarly to financial debt over time.
If you're struggling with code that's become hard to maintain or you're worried about technical debt piling up in your projects, this ChatGPT prompt helps you create a structured plan to fix it. This prompt is designed for developers and engineering teams who want to understand exactly where their code needs improvement and how to tackle those improvements systematically. Whether you're maintaining a legacy application or trying to prevent future problems in a growing codebase, this prompt cuts through the noise and gives you actionable priorities.
Using this prompt is straightforward. You simply replace the [codebase/project] placeholder with specific information about what you're working on. For example, you might write something like: "Review my Django e-commerce application that handles user authentication, product listings, and payment processing, which currently spans 15,000 lines of Python code across 8 modules." The more specific you are about your codebase, its size, and its main functions, the better results you'll get from ChatGPT.
When you run this prompt, expect ChatGPT to return a comprehensive refactoring roadmap that identifies technical debt issues, highlights duplicated logic patterns, and pinpoints maintainability problems in your code. The response will typically include prioritized recommendations, with quick wins separated from longer-term improvements. You'll get explanations for why each issue matters and how fixing it will improve your codebase.
Here's a pro tip that significantly improves your results: after getting the initial roadmap, follow up by asking ChatGPT to explain the highest-priority items in more detail, including specific code examples if possible. Include relevant code snippets from your actual project in your follow-up questions. This helps ChatGPT provide refactoring suggestions that are tailored to your exact implementation rather than generic advice. You can also ask it to estimate the effort required for each refactoring task, which helps with project planning.