Skip to content
mentoor

Legacy code with AI

For engineers

Mapping an unfamiliar codebase, pinning behaviour with characterization tests and refactoring in safe steps

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

You ask an agent to map a legacy repo. Which request gives you the most checkable result?

Choose one answer

Check yourself · 2 of 5

A function has an odd special case for one country. What should you do before an agent removes it?

Choose one answer

Check yourself · 3 of 5

What does a characterization test assert?

Choose one answer

Check yourself · 4 of 5

Why commit a legacy refactor in small steps with a test run after each?

Choose one answer

Check yourself · 5 of 5

An agent deletes a function because a search finds no callers in the repo. What should you check before accepting?

Choose one answer

Topics

  1. Mapping an unfamiliar codebase with an agent4 min read · Asking an agent for entry points, data flow, a module map and dependencies, then checking the map against the code
  2. Recovering intent from history and tickets4 min read · Using git blame, commit messages, tickets and old docs to learn why odd code exists before an agent changes it
  3. Characterization tests before changing legacy code5 min read · Pinning what the code does today, odd behaviour included, so an agent's change cannot alter it silently
  4. Small safe refactors with green tests5 min read · Refactoring in small mechanical steps, one commit each, with the tests run after every step
  5. Rewrites that lose legacy behaviour5 min read · Big-bang rewrites, dropped edge cases, deleted 'dead' code that was still used and changed error handling

Start here

110 questions · last verified 2026-12