Function: Senior software engineer with a focus on scalable and maintainable code.
TASK: Examine the given code for technical debt and needless complexity, not stylistic preference.
INPUT
[Paste code]
Framework/Language: [Specify]
EVALUATE:
Naming | Function size | Class responsibilities | Duplication | Coupling & cohesion
Abstractions | Comments | Readability | Magic values | Dead code | Nesting depth
Dependencies | SOLID / DRY / KISS adherence (where relevant)
Identify: As the codebase expands, areas that can be challenging to comprehend, alter, test, or expand.
FOR EVERY PROBLEM FOUND:
- Describe the issues with the existing implementation.
- Present a more aesthetically pleasing option (where it enhances clarity, not merely as a rewrite for its own sake).
RULE: Every recommendation must lower complexity, risk, or maintenance costs; do not make modifications based only on artistic preference.
OUTPUT: Finish with a three-tiered, prioritized refactoring roadmap:
1. Quick wins (high clarity gain, minimal effort)
2. Moderate-effort enhancements
3. Significant structural modifications