Two months. That was my estimate.
My manager came to me asking if I could rewrite our internal legacy system on a new stack, using AI. I said yes before he finished the question. I knew the system. I used it every day to log my hours. How hard could it be.
Getting repo access took a few weeks to clear formally. When I finally got it and managed to build the thing on my laptop, which was its own small war, I opened the module list.
I didn't recognize most of it.
The "internal time tracking tool" I'd been using every day for four years turned out to be a full company-wide budget management and project profitability platform. I'd been walking through the front door and ignoring fourteen other rooms I never knew existed. As a user I logged hours. As a developer I was now staring at the machinery that runs the finances of the entire firm.
I didn't panic. I laughed.
This was going to be the best AI workflow testing ground I could have asked for.
The argument everyone is having is wrong
One camp says AI will replace developers in eighteen months. The other camp points at people like Leo Jr. (@leojr94_), a non-technical indie hacker who vibecoded a SaaS called EnrichLead entirely through Cursor and publicly told other developers they could "continue to whine about it or start building."
Days later, hackers drained his API keys, bypassed his subscription, and filled his database with garbage. His credentials had been baked into the frontend. He wrote: "I'm not technical, so this is taking me longer that usual to figure out." A few days after that, he shut the product down.
His story became the archetype. A warning shot for every founder who thinks AI removes the need to understand the code underneath it.
Both camps are wrong. The model is not the bottleneck.
I've been rewriting this legacy system solo for three months now. I'm roughly 30 to 40 percent of the way through. I ship at the pace of a small full-stack team. This post is how.
Why I can even try this
I'm not a cowboy. That's worth saying first. Six years of commercial Java, more years of writing code for myself, training in DDD, security, and testing. I've sat through reviews on systems handling real money. This codebase is not beyond my cognitive reach. I know how to build this kind of system from scratch. It would just take me much longer.
The second thing is three years of obsessing over LLMs. Since GPT-3.5 came out and I started replacing Stack Overflow with "ask the model." Three years ago AI answered my syntax questions. Two years ago it wrote about half the code in my personal projects. A year ago, around 90%. This year, 100%.
I make AI write code even when I could type it in thirty seconds myself. Not because I'm lazy. Every prompt is reps. I want to find the places where it fails and learn how to stop that from happening next time.
If I only had the engineering background, my prompts would be bad. If I only had the LLM mileage, my reviews would be bad. Neither half alone is enough.
The first version was trash
When I started, Claude Code produced garbage.
Frontend first. I'm a backend engineer. I'd never set up a production frontend for a project this size. The first version looked fine to me. I brought in an actual frontend developer to eyeball it, and within an hour he was pointing at a dozen decisions that were wrong, half-wrong, or setting up a maintenance nightmare six months out. I threw the frontend out and started over.
Backend wasn't better. One of the early modules had a report endpoint that could return several thousand rows. The code looked clean. It worked in testing.
Then I read the SQL.
The backend was returning the entire dataset to the browser on every call. Filtering, sorting, and pagination were all happening in JavaScript. In production this would have killed the database on day one.
That was the moment I stopped treating AI output as "almost there." The model is a very fast, very confident junior engineer. If you don't correct its output with senior-level judgment, you don't get senior-level output. You just get a scalable way to ship junior mistakes.
Garbage in, garbage out: the living context
A good model with no context produces bad output. A good model with precise, project-specific context produces output you can ship.
That means the prompt files are where the actual engineering happens.
I have three CLAUDE.md files in this project. One for the repo overall, one for the backend, one for the frontend. Each is 200 to 300 lines. Each one contains:
- The architectural decisions we've made and why
- Short code examples of how we solve specific recurring problems
- A full description of the target architecture
- A list of mistakes Claude has made that are now banned
That last list is why this project works. Every time AI makes a mistake I have to correct more than once, I add a rule. Four real entries from my current banned-patterns list:
- B10: Magic strings instead of enums
- B13: Circular dependencies between modules
- B16: Missing DB operation documentation in legacy analysis
- B17: Fake server-side pagination, slice in RAM. DARK PATTERN.
B17 is the pagination story from earlier. It happened. I wrote the rule. It stopped happening. That is the loop. AI makes a mistake, I codify the correction, the rule becomes part of every future prompt in this repo.
The CLAUDE.md files six months from now will not be the same documents. That is the point.
This isn't static prompt engineering. This is a living codification of everything I've learned about making this specific AI work on this specific codebase.
No domain expert? Use invariants.
The textbook move for this kind of migration is to sit with a domain expert, run DDD sessions, extract bounded contexts, then build.
I don't have a domain expert. The people who understood the original logic have mostly moved on. The one colleague who still knows parts of it is rarely available.
What I do have:
- The legacy code. Its behavior is the invariant.
- The database schema. Its structure is the invariant.
We had a long discussion early about whether to rewrite the database too. The old schema carries real technical debt, and the new system inherits that debt the moment we keep it. But rewriting the DB without a domain expert would mean months of guessing what data mattered, and getting it wrong in ways we'd only discover when users screamed.
Decision: keep the schema, write the new code in hexagonal architecture. That lets us untangle the database later without rewriting the business logic. One battle at a time.
"We" there is doing some work. I'm the only engineer on execution. But I'm in regular contact with management on the hard calls. The architecture decisions are mine. The scoping decisions are shared.
The process
Once the context layer was in place, the work became repeatable. I extracted every stage of a module rewrite into a Claude Code slash command. One module now looks like this:
/analyze-legacyreads the old module, maps inputs, outputs, rules, edge cases. 8 to 30 minutes./gen-unit-test-scenarios,/gen-it-test-scenarios,/gen-manual-test-scenariosrun in parallel. They don't depend on each other and they don't see each other's output. 15 to 30 minutes./implement-moduleuses the scenarios and the legacy analysis as input. 20 to 40 minutes./implement-unit-testsand/implement-it-testsrun in parallel. 15 to 30 minutes.- I test manually against the legacy system while the test implementation runs.
- Code review at the end. Not before. You don't review code that doesn't work yet.
Two things worth noticing.
The test scenarios are generated independently. Three separate passes, no cross-pollination. If AI analyzes the same thing three times without seeing its own previous output, an edge case missed on one pass has two more chances to get caught. If I let the later passes see the earlier ones, they anchor on the first analysis and rubber-stamp it.
The code review happens last. On a module that generated 18,000 lines of code and documentation in two days, a careful line-by-line review is the bottleneck that kills the velocity gain. Management and I agreed on the tradeoff. I supervise the process, not every line. I own the architecture, the prompts, the scenarios, the banned patterns, the invariants, and the comparison against legacy. If those are right, the floor on the generated output is high.
Is this acceptable everywhere? No. For an internal tool where the legacy system's behavior is our ground truth? Yes. Manual and security testing across the full system are scheduled before cutover.
The numbers
Three months in. About 30 to 40 percent of the application rewritten.
Current velocity: 2 small modules per day, or 1 medium per day, or 1 large every two days. The 18k-line days come from that last category. The pace estimate is mine, based on six years of watching similar work happen in teams. There is an error bar on it. Could be off either way.
Every 8 to 10k lines of production code produce roughly 4k lines of documentation and tests around them. The legacy system had zero documentation. Now every module I touch produces its own spec, its own test suite, its own analysis document. I planned for this from the start. I knew the documentation would be necessary to do the rewrite right, and I knew it would outlive the migration as a real asset for the team. What I didn't expect was the volume.
My Claude Code plan is the $100 a month max tier. I'm burning through it faster than I'd like. Conversations are underway about moving to a higher plan. Solo or not, velocity has a price, and it is not 100 dollars a month.
Between runs there is a lot of waiting. 8 minutes for an analysis, 20 to 40 for an implementation. I use it to read ahead in the codebase, set up infrastructure, prepare the internal AI training I run for 23 other engineers, work on other projects, or write this post. Cognitive load still gets heavy. I have a lot of threads in flight. I step away from the keyboard more than I used to. This is not a ten-hour grind. It is short, sharp focus stretches with intentional breaks.
What could still break
I want to be honest about what I haven't solved.
I don't have full domain knowledge. I'm extracting it from the legacy code, from Claude's analyses, and from rare meetings with the last remaining expert. That is not the same as understanding the business.
I don't do line-by-line review on everything. If the banned-patterns list misses something, it can land in the new code without me catching it outside of targeted testing.
Manual and security testing across the full system are still ahead. It all works on dev. That is not the same as working in production, under real users with real data. The real test is still in front of me.
I'd rather this post be honest than impressive. I haven't pulled off a miracle. I've pulled off the first 30 to 40 percent of a hard rewrite, at a velocity I could not reach without AI, using a process I'm still iterating on. If one of the later modules breaks the pattern, I'll write that post too.
Back to Leo
Leo Jr.'s system got destroyed. Not because AI wrote bad code. Because he had no process. No invariants. No banned-patterns list. No senior review gate. No understanding of what belongs in a frontend and what doesn't.
The model produced what it always produces: fast, confident, average-case code. He shipped it without the layer that turns average-case code into production code.
That layer is everything I've been describing in this entire post. The CLAUDE.md files. The parallel scenario generation. The invariants in place of a domain expert. The hexagonal architecture. The decision to skip line-by-line CR in exchange for process oversight. The three years of learning which specific things AI gets wrong on my stack.
If you're a senior engineer worrying whether AI is coming for your job: for developers who only typed code, it already has. For the ones who know architecture, security, testing, and process, the ceiling just went up. The question stopped being "can AI write code." It is now do you know when the code it wrote is wrong.
Three months in. Thirty percent through. Solo.
The model is not the bottleneck.
You are. 🦆