Engineering Legacy Code Code Review

Legacy Code Review Prompt

Mentoring-style maintainability review: what makes the next change expensive, explained with corrected examples — teach, don't just judge.

Overview

Legacy code review has a different goal: not gatekeeping a merge, but building a map for gradual cleanup — and teaching the developer doing it. This setup runs the maintainability focus (duplication that drifts, intent-hiding names, cohesion, coupling, dead code, test coverage of what changes) under Mentoring style: every finding explains WHY it matters, CRITICAL and MAJOR findings come with short corrected examples, and the review ends with the three most important things to learn — not a verdict to fear.

How to use this resource

  1. Review before you change anything

    The maintainability map tells you where changes will be expensive — before you're mid-change and finding out.

  2. Use the corrected examples as patterns

    Mentoring style shows the fix shape for major findings — apply the pattern, not just the instance.

  3. Hand the top-three learnings to the team

    The closing learnings generalize beyond this module — that's the compounding value.

Why This Works

  • Maintainability focus prices the NEXT change — the metric legacy code actually fails on
  • Mentoring style converts findings into transferable knowledge
  • A map-not-gate framing makes the review usable on code that would fail any gate

Best for

  • Modules everyone fears and nobody owns
  • Onboarding developers into old codebases
  • Cleanup work that needs a defensible priority order

Not for

  • Actually performing the refactor — that's the Refactor Prompt Builder, with behavior-preserving constraints
  • Blocking a release — mentoring style deliberately doesn't gate

Use cases

  • Mapping a legacy module before touching it
  • Teaching newer developers what good looks like, in context
  • Prioritizing cleanup by what makes changes expensive

FAQ

Does this legacy review prompt refactor the old code for me?

It reviews only. The REVIEW OBJECTIVE states "Review only — report findings; do not rewrite the code," so the generated prompt asks your assistant for maintainability findings and, for CRITICAL or MAJOR items, a short corrected example to learn from — not an applied refactor. You still run the prompt and act on the findings yourself.

Why does the legacy review prompt end with learnings instead of a pass or fail verdict?

By design the FINAL VERDICT asks for "the three most important things to learn from this review" rather than a gate. The Mentoring framing treats old code as a cleanup map, so it deliberately doesn't block a merge — every finding explains why it matters instead of issuing a verdict to fear.

How do the severity tags decide what to fix first in a legacy module?

Every finding gets exactly one of [CRITICAL], [MAJOR], [MINOR], or [NIT], and the SEVERITY RULES state severity reflects impact, not effort to fix. Findings group by severity with CRITICAL first, giving a defensible priority order — but the tags are the model's judgment in the prompt output, which you confirm against the actual code.

More resources from Code Review Prompt Generator

Resources that pair well

Related tools

Workflows that use this resource

Tip: Save time by exploring related resources and tools that integrate with this resource.