Engineering
How I'd rescue an AI-generated codebase
Getting prototype code into a state your team can maintain and improve.
Understanding the existing codebase
I start by mapping the existing codebase e.g. entry points, data flow, duplicated patterns, and what runs versus what only looks finished. AI-generated code often repeats the same logic in several files with small variations.
This gives everyone a shared understanding of the current state, and a starting point for discussion.
Find duplication and establish boundaries
Repeated fetch logic, copy-pasted components, and inline config are common so I pull these into individual, reusable functional components.
UI, domain logic, and infrastructure are kept separate so you can efficiently test and replace each part.
Introduce standards
Linting, formatting, type checking, and a sensible folder structure come early. They help immediately when you start refactoring.
I add tests around the important paths: auth, payments, data changes.
Document and hand over
I produce a short README on how to run, deploy, and extend the app and notes on known debt and what I'd do next.
The aim is to leave you with well written, maintainable software your team can continue to use and improve for the long term.