---
name: legacy-rescue
description: Safely modernize or replace legacy systems without breaking existing functionality.
tags: [refactoring, migration, methodology]
---

# Legacy Rescue

## Principle

Legacy code works. Respect it. Understand it before changing it. Replace behavior-for-behavior.

## Workflow

1. Characterize the existing behavior with tests
2. Understand the original intent from docs and git history
3. Build a strangler fig: new code alongside old, routing gradually
4. Migrate consumers one at a time
5. Delete old code only when nothing depends on it

## Rules

- Never delete old code without a replacement that passes the same tests
- Run the old and new systems side-by-side when possible
- Document migration progress visibly
- Celebrate when the old code is finally removed
