Michael Feathers defined legacy code in a way that has outlived the book it came from: "Legacy Code is code without tests" (Understand Legacy Code). Erik Dietrich, discussing the same book, offers a second definition that fits just as well: "Legacy code is any code that you don't want to touch because it's fragile" (DaedTech).
Coding agents are at their best on fresh, well-tested code, and at their weakest on exactly this kind. Driver's co-founder calls it the migration paradox: migrations are "the highest-leverage use case for AI coding agents," and also "where agents need the most context and have the least." The legacy system "is the thing nobody fully understands. That's why you're migrating in the first place" (Driver).
A group of engineers who compared notes on using AI tools in older codebases named four recurring problems (The Friday Deploy):
- Missing conventions. The tool misses the library of business-specific helpers or the shared component library "and just reinvented everything for you."
- Unsafe changes. Database migrations and API changes in a production system must stay backward compatible, which "requires far more careful review of generated code."
- Old dependencies. Tools may assume functions from newer library versions "that you don't yet have access to."
- Long feedback loops. Slow builds, tests that need many services, or features that can only be tested in staging leave the agent unsure which checks to run.
None of these are reasons to keep agents away from legacy code. They are a list of things to set up before the agent starts editing.



