Skip to content
>devspeak
← glossary
level 8Advanced AI-Assisted Development

Legacy code

also: legacy codebase, legacy system

Older code that still runs but that nobody fully understands anymore, often with no tests showing what it's supposed to do. People are afraid to touch it.

a bit more technical

Existing code inherited from earlier developers or earlier versions, typically poorly documented, lacking automated tests, and built on older patterns or dependencies. Changing it is risky because its intended behavior is unclear and side effects are hard to predict.

picture it

The wiring in an old house. The lights work, but nobody knows which switch controls what, and there's no diagram. Cut the wrong wire and the fridge in another room goes off.

why it matters

Agents are fast and confident, which is dangerous in code nobody understands. Telling your agent it's working in legacy code signals it to read first, change little, and protect current behavior.

what your agent might say
agent
This is legacy code with no tests. Before changing the tax calculation, I'll write tests that capture what it does today, so we'll notice if anything shifts.
how you might use it
you → your agent
The invoicing module is legacy code nobody fully understands. Explain what it does before changing anything, and add tests that capture its current behavior first.
common mistake

Thinking legacy code just means old or bad code. Much of it is valuable and works. The problem is that nobody knows exactly why it works, so changes are risky.

builds on