aliteq.

Every new feature breaks something else? Fix the technical debt in your AI-built app

Your app worked last week. Now each change breaks two other things. That's technical debt, a term its inventor says people often misread. What he meant, what two studies found about AI-written code, and a seven-step cleanup order.

Aliteq TeamUpdated Oct 39 min read
Flat vector illustration of a person kneeling to slide one block out of a leaning tower of stacked blocks, with a single coral block balanced on top, on an indigo background
Share

You ask the AI for one small change. It works. Then the login page breaks, or a price shows the wrong number. You ask for a fix and something else moves. Every maker recognizes this moment. The tool isn't broken. The pile has gotten too tangled to touch safely. Programmers have a name for that pile: technical debt. This page explains the term, what the research says about AI and it, and what order to clean up in.

What technical debt means, in its inventor's words

Answer first: technical debt is a money metaphor for code. Shipping quickly is like borrowing. You get something working sooner, then pay interest, in extra effort, until you tidy it up. Ward Cunningham coined it in 1992. His point was never "write bad code on purpose." It was about code that lags behind your understanding.

Here is Cunningham in his 1992 OOPSLA report on a financial software product: "Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite." He added: "The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt."

In a 2009 video he cleared up a common mistake. Many people, he said, confused the idea "with the idea that you could write code poorly with the intention of doing a good job later." His own position: "I'm never in favor of writing code poorly, but I am in favor of writing code to reflect your current understanding of a problem even if that understanding is partial."

That second quote matters for you. You build by describing what you want, learning from what appears, and describing again. Your understanding of your own app changes every day. Debt builds when the code keeps adding features and never gets reorganized around what you learned. Cunningham's words: the program "simply does not contain any understanding and all efforts to work on it take longer and longer."

Martin Fowler, a well-known software writer, gives the clearest arithmetic. A feature takes four days in clear code and six in tangled code. "The two day difference is the interest on the debt." Cleaning up first takes five days. For one feature, that loses: nine days against six. "But if I have two more similar features coming up, then I'll end up faster by removing the cruft first." By our sum, three features cost 18 days in the mess and 17 tidying first.

Worked example of technical debt in days of work. One feature: building in messy code takes 6 days, tidying first then building takes 9 days. Three similar features: messy code takes 18 days, tidy first takes 17 days. Tidying costs 5 days up front and each feature then takes 4 days instead of 6. Figures from Martin Fowler; the totals are aliteq arithmetic.
Fowler's 4, 5, 6 and 9 days are printed on his page. The 17 and 18 day totals are our arithmetic. · aliteq research

How AI-built apps can pile it up

Answer first: AI tools add code fast and rarely stop to reorganize unless you ask. Repeated logic, leftover pieces and unclear structure then build up, and each makes the next change riskier. No study measures this for non-coders. What follows are signs you can see, and the one dataset that looks at code changes at scale.

These are warning signs an owner can spot without reading code. We list them as symptoms, not as measured rates, because no source we read gives a frequency for any of them.

A fix breaks a neighbor

What you see
Changing the cart breaks the header
What to ask your AI
"Which files does this change touch, and why those?"

The same thing built twice

What you see
Two different date formats, two login checks
What to ask your AI
"Find logic that exists in more than one place."

Code nobody uses

What you see
Old pages, unused packages, half-finished features
What to ask your AI
"List files and packages nothing imports or calls."

No safety net

What you see
You can't tell if a change broke something until you click around
What to ask your AI
"Write tests for what the app does today."

The AI contradicts itself

What you see
It re-adds code it removed last session
What to ask your AI
"Summarize what this app does and how it's organized."

Now the data. GitClear, a company that sells developer-analytics software, looked at "211 million changed lines of code, authored between January 2020 and December 2024," from repositories it says are owned by Google, Microsoft, Meta and enterprise companies. Its abstract says "the percentage of changed code lines (associated with refactoring) sunk from 25% of changed lines in 2021, to less than 10% in 2024, while lines classified as "copy/pasted" (cloned) rose from 8.3% to 12.3% in the same period."

Read that carefully. Refactoring means restructuring code without changing what it does. Less of it, and more copy-paste, is the pattern of debt growing. But this is a vendor's report, and the full report sits behind a contact form, so we read only the abstract. It compares years in which AI assistants spread. It does not, in the abstract, say which lines an AI wrote. It shows an association, not proof of cause.

Google's DORA research gives a second angle. Its 2024 report comes from an annual survey; "nearly 3,000 working professionals" answered. For each 25% increase in AI adoption, it estimates documentation quality up 7.5% and code quality, as developers rate it, up 3.4%. It also estimates delivery throughput down 1.5% and delivery stability down 7.2%. In DORA's words, stability "measures the likelihood deployments unintentionally lead to immediate, additional work."

That's a mixed picture, and we'd rather show it than pick a side. DORA's code quality figure is satisfaction, not a code measurement. Its "technical debt" figure, a self-reported measure of how much debt hindered work, moved just 0.8% (down). The survey covers teams at organizations, not solo builders. The authors' own advice: "small batch sizes and robust testing mechanisms." DORA's 2025 page adds that AI's primary role "is as an amplifier, magnifying an organization's existing strengths and weaknesses." For you, that reads: tidy habits get faster, and messy habits get messier, faster.

Two studies on AI and code. GitClear, 211 million changed lines 2020 to 2024: refactoring-related share fell from 25 percent in 2021 to under 10 percent in 2024, copy/pasted share rose from 8.3 to 12.3 percent.
GitClear is a vendor and its figures cover 2020 to 2024. DORA is a 2024 survey of professionals. Both show association, not cause. · aliteq research

The cleanup order that keeps your app working

Answer first: clean up in small steps, and keep the app working after each one. Fowler defines refactoring as altering "its internal structure without changing its external behavior," and says "the system is kept fully working after each refactoring." Our order puts the safety steps first, the deletions next, and the reshuffling last.

This order is our advice, built on Fowler's and Cunningham's ideas. It isn't from a study. Do one step, check the app, then move on.

Save a working copy. Commit to Git so you can always go back. If you've never done this, ask your AI tool to do it and explain what it did.

Write down what the app should do. Ten plain sentences, such as 'A visitor can sign up with an email.' This is your reference when you check the AI's work.

Add tests for what works today. Ask the AI to write tests of current behavior, run them, and tell you which pass. Tests are your alarm for the later steps.

Delete what nothing uses. Unused files, packages and half-built features. Remove a little, run the tests, repeat.

Merge the duplicates. Keep one place for each rule, such as how a price is calculated or who may log in.

Rename and tidy. Names that say what a thing does, and one folder per idea.

Then build the next feature. Fowler's habit: look at the code you're about to change and, if it's in the way, tidy it first.

Seven-step cleanup order for an AI-built app: 1 save a working copy in Git; 2 write down what the app should do; 3 add tests for what works today; 4 delete what nothing uses; 5 merge duplicates; 6 rename and tidy; 7 build the next feature, tidying the area first.
aliteq's suggested order, based on Fowler's refactoring and Cunningham's debt metaphor. It's advice, not a study result. · aliteq research

Why step two comes before the code

Answer first: a written description of what the app should do is what lets you, and the AI, tell a cleanup from a break. Without it, "the app still works" means whatever you happen to click. Cunningham's idea is that code should reflect your understanding, so write the understanding down first.

Keep that note in your project. When you ask for a cleanup, paste it in and say: "Don't change anything this note says the app does." The method has a name, and it's covered in spec-driven development for vibe coders. If you aren't sure how to tell whether the AI changed more than you asked, see how to read an AI diff without coding.

One more habit helps. Long chats lose track of earlier decisions, which is one way an AI re-adds code it removed. Context engineering explains how to give the tool the right background each time. For the bigger picture of getting an app live and keeping it running, read how to ship a vibe-coded app.

When not to clean up yet

Answer first: skip the cleanup if the app is a throwaway prototype, or if you're about to rebuild it anyway. Debt only matters if you keep paying interest. Cunningham's own idea of "a little debt" is borrowing on purpose. The trouble starts when you borrow and never repay.

Use Fowler's math. If you'll touch an area only once, tidying it first loses, as his six days against nine shows. If you'll keep adding to it, tidying wins. A page you plan to change every week is worth cleaning. A one-off landing page isn't. Fowler also notes the debt idea works well for talking to people who don't write code, so use it with a partner or client when you explain why a "small" change takes longer than expected.

Quick answers

What is technical debt in simple terms?
It's the extra work every change costs because the code is messy or no longer matches what you know about the app. Ward Cunningham compared shipping unpolished code to borrowing money: you move faster now and pay interest, in effort, until you clean it up.
Does AI-generated code create more technical debt?
The evidence is mixed. GitClear's abstract reports less refactoring and more copy-pasted lines from 2021 to 2024. DORA's 2024 survey estimates higher developer-rated code quality but lower delivery stability as AI use grows. Both show association, not proof of cause, and neither studied non-coders.
Is technical debt the same as bad code?
Not in Cunningham's sense. He said he's "never in favor of writing code poorly." Debt is code that no longer reflects what you understand, often because features were added without reorganizing. Fowler's quadrant page calls a plain mess a reckless debt.
What is refactoring?
Fowler defines it as restructuring code "without changing its external behavior," in small steps, keeping the system working after each one. The app should look and act the same afterward, with a cleaner inside.
Can I ask the AI to clean up its own code?
Yes, in small requests. Save a copy first, give it your written description of what the app does, ask for one change at a time, and run tests after each. Avoid "clean up everything," which invites changes you can't check.
When should I start paying the debt down?
Before you add a feature to a tangled area. Fowler's habit is to tidy the code in the way first. If you won't touch that area again, leave it.

Found this useful? Share it

Share

Aliteq

Aliteq Team

Aliteq started in 2019 as a PC hardware shop and is now a US-based publication. We build the VRAM and cost calculators on this site, track live cloud-GPU prices, and write guides with AI-assisted drafting that we check against primary sources before publishing.

The Aliteq brief

The tech worth knowing — hardware, AI, gaming, deals. No spam, unsubscribe anytime.

Keep reading