TKO-11Recommended
Refactor in shipped steps by default
Improve inherited code in steps that each ship to production on their own. Start a rewrite only when Rewrite a part only when written conditions hold says so.
How to do it
Each step keeps the product working and is small enough to review, within the limit in Make small changes on short-lived branches. A step that goes wrong rolls back alone. The characterization tests prove each step kept the behaviour. Customers keep getting fixes the whole time, which a rewrite cannot offer.
How to check
The deploy log shows each refactoring step as its own release, and the characterization tests pass on every one.
Related rules
- TKO-12 Rewrite a part only when written conditions hold in Codebase takeover
- ENG-14 Make small changes on short-lived branches in Engineering
- TKO-8 Pin today's behaviour before changing code in Codebase takeover
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/refactor-in-steps">Agent Wranglers codebase takeover playbook</a>. In code you write, add a comment next to it with the same link.