← FIELD NOTESOctober 24, 2026 · 4 min

Technical debt in AI-generated code: how to spot it and fix it

An app built with AI rarely breaks. It stiffens, and every feature costs more than the last. Three signals you can read in git in ten minutes, and how to fix it without a rewrite.

Technical debt in AI-generated code rarely shows up as a crash. It shows up as stiffness: each new feature takes longer than the one before, until you hesitate before opening your own files. You can measure it early from your git history, and you can fix it without rewriting the app.

Fragile or stiff

When a founder tells us what worries them about an app built with Claude Code or Cursor, it is almost always a crash. A security hole, a database that falls over, payments that stop going through.

Those problems are real, but they are loud. A user complains, an alert fires, someone fixes it. Loud problems get fixed.

Stiffness doesn't warn anyone. Nothing breaks and your users don't notice. You are the only one who feels it, and you feel it late.

Feature #3 took you a day. Feature #15 took three. Feature #30 took three weeks and broke two other things on the way. None of those moments looked like an incident. The structure just wore down, one PR at a time.

Why AI produces this kind of debt

AI-generated code isn't bad code. It is local code. Claude solves the problem you give it very well, inside the files it can see. It doesn't know an almost identical function already exists three folders away. It doesn't know this module was never supposed to talk to that one.

So every PR makes sense on its own. The problem is the sum.

In the repos we open, it nearly always takes the same three forms.

Duplicated logic. The same business rule written four times with small variations. The day the rule changes, you fix three of them. The fourth keeps running.

No boundaries. UI components query the database directly. The billing module imports functions from onboarding. Everything depends on everything, so every change spreads.

A schema that grows by itself. One column per feature, and nobody asks whether it belongs in that table. Six months in, the users table also holds the payment status, plus a few test fields nobody dares to delete.

How to spot it in your repo

The most reliable signal is human: there are files you would rather not open. But you can also read it in git in about ten minutes.

1. The files that change all the time. This lists the twenty most-edited files of the last three months:

git log --since="3 months ago" --format= --name-only | sort | uniq -c | sort -rn | head -20

A feature file near the top is normal. A config file, a data model or a shared helper near the top is a coupling point. Everyone goes through it, so everyone edits it.

2. Files touched per feature. Look at your last ten feature PRs. If the average size keeps growing while the features stay the same size, the code is stiffening. A simple feature that touches fifteen files means the structure forces you to go everywhere.

3. The pricing question. We ask it in every audit: how many files do you need to open to change one pricing rule? In a healthy repo, the answer is one.

How to fix it without a rewrite

When founders find the problem, the first instinct is to start over. That is almost always a mistake. A rewrite freezes the product for weeks, and if nothing changes in how you work, it rebuilds the same problems.

We do it in three steps instead.

Decide what has to stay solid. That is what we call the Expandable Core: the data model, auth, API contracts, integrations, deployment. We write it down in a registry that lives in the repo. Feature code can stay imperfect because it will get replaced. The core can't, because everything else sits on top of it.

Remove coupling points one at a time, starting with the ones that touch the core. A duplicated rule becomes one pure function, tested once and called everywhere. A component that queries the database goes through a proper data layer. Each fix is a normal PR, small enough to ship in a day, and it doesn't block the features in progress.

Stop it from coming back. That is the job of a two-pass review. An agent reads every PR first and flags when it touches the core, so an architect looks at it. A senior engineer then reviews the rest. Duplication and cross-module dependencies are much easier to catch in the PR than six months later.

It isn't a talent problem

Founders who find this in their code often think they did something wrong. They didn't. Stiffness is what normally happens to code written fast, in small pieces, with nobody looking at the whole thing. It is a structure problem, and structure can be fixed.

The earlier, the cheaper. At feature #10, it is about a week of work spread through your normal flow. At feature #50, it is a project.

French version: Dette technique du code généré par IA.


The Bunker Test, free. Give us read-only access to your repo. Within 5 business days we come back with a Solidity and Structure score out of 100, your top 3 risks and one fix you can ship the same day. A 15-minute walkthrough is included, no commitment.

Request your Bunker Test →

KONSTRUKT STUDIO

Want to see this approach running on your repo? Send us access and we'll come back with at least 5 concrete risks within 5 business days.

Book an intro call →