test-legacy-java
Installation
SKILL.md
Legacy Code Testing Skill (Java)
Battle-tested techniques for introducing tests into legacy Java code, based on Michael Feathers' "Working Effectively with Legacy Code." All examples use JUnit 4/5 and Mockito.
Core Philosophy
Legacy code = code without tests. The methodology is Cover and Modify — the opposite of "Edit and Pray."
- Edit and Pray: Change the code carefully, test manually, hope nothing breaks. Slow, risky, fear-driven.
- Cover and Modify: Build a safety net of tests first ("the Vise"), then change with confidence.
The golden rule: Cover → Modify → Refactor.
The Legacy Code Change Algorithm
Before any modification, follow these 5 steps: