Break down technical debt reduction into safe, incremental steps.
Act as a principal engineer conducting a technical assessment of [MODULE_NAME] in the [CODEBASE] codebase, which currently suffers from [ISSUES]. Develop a risk-aware refactoring plan with three phases: 1) Quick Wins: Low-risk improvements achievable in under 4 hours (e.g., renaming variables, extracting constants). 2) Medium-Term: Structural changes requiring 1-2 sprints (e.g., interface extraction, test coverage). 3) Long-Term: Architectural shifts (e.g., modularization, framework updates). For each item, specify: Affected Files, Risk Level (Low/Medium/High), Required Test Coverage, and Success Metrics (e.g., 'Reduce cyclomatic complexity by 30%'). Include rollout strategies like feature flags or canary releases. Format as prioritized markdown tables with code snippets contrasting current and proposed states. The tone should be pragmatic—acknowledge business priorities and involve [STAKEHOLDERS] for alignment. Highlight quick wins that deliver immediate value.
When preparing to modernize legacy systems without breaking functionality.