For decades, the standard wisdom for senior software engineers has been anchored in the Joel Spolsky school of thought: never rewrite working code from scratch. Working production software is an irreplaceable ledger of scar tissue—a record of subtle race conditions, quirky timeouts, and hard-won edge cases that engineers painstakingly discovered and patched over years of real-world traffic. Tossing out legacy code simply because it looks archaic or unfamiliar usually serves developer ego and aesthetic preference rather than business value, and it almost guarantees you will re-introduce old bugs to the same users all over again.
I have spent most of my career firmly in that camp, viewing wholesale rewrites with healthy skepticism. But the emergence of AI coding agents fundamentally shifts the economic equation. While typing syntax was never the main bottleneck of software engineering, AI drastically accelerates the synthesis, translation, modularization, and test generation required to modernize a system. More importantly, modern AI assistants thrive on clean boundaries, consistent type safety, and modular architectures. When a legacy codebase becomes an active drag—choking release cycles and preventing your team from leveraging modern AI tools—the cost-benefit balance tilts in favor of modernization.
The justification for a rewrite today comes down to a single question: will it meaningfully increase your velocity of change moving forward?
This is not a blank check to rebuild a service just because you dislike the syntax or want to try a shiny new framework. If you cannot put a concrete number on the pain—measured in stagnant feature velocity, unpatchable security vulnerabilities, or an architecture that cannot support critical business requirements—then the code doesn’t need a rewrite; your patience does. But when legacy debt acts as an anchor on your ability to ship rapidly, using AI to intentionally modernize your architecture is no longer an irresponsible indulgence—it is a calculated investment in future development speed.
Original Article: Most rewrites serve the engineer, not the business by Anatoliy Babushka