IT leaders know they must eventually deal with technical debt, but because addressing it doesn’t always directly result in increased revenue or new capabilities, it can be difficult to get business management to take it seriously.
But technical debt can undercut an organization’s ability to innovate long term, and the shortcuts taken during initial development likely resulted in a codebase that’s convoluted, slow, or difficult for devs to understand. Add outdated components or frameworks to the mix, and the difficulty to maintain the code compounds.
Just as generative AI tools are fundamentally changing the ways developers write code, they’re being used to refactor code as well. And that has significant implications for how IT shops can approach technical debt.
[ Related: 7 types of tech debt that could cripple your business ]
Developers we spoke with said gen AI tools are being used to fight tech debt in several niches — some small in scale and opportunistic, others systematic and focused on the big picture. Some developers are more enthusiastic than others about gen AI’s ability to rein in tech debt, and just about everyone agreed that humans aren’t going to be taken out of the picture anytime soon. But overall, the use case for AI is promising.
Taking the drudgery out of code cleanup
One of the reasons tech debt persists is that cleaning it up involves irritating grunt work — exactly the sort of tasks forward-thinking developers are turning to gen AI tools to assist with in their fight against tech debt.
Adding clarity to obscure code. Old and poorly documented codebases are particularly daunting to refactor because they need to be understood before they can be disentangled. Dan Yelle, chief data and analytics officer at Credibly, suggests bringing “more transparency into the codebase by having gen AI conduct a review and insert comments to make obscure programs more understandable by engineers.”
Sniffing out ‘code smells.’ AI tools can be adept at spotting code that technically works but is poorly designed and could give rise to future problems — exactly the sort of code you need to eliminate to pay down tech debt.
“In one particularly challenging implementation, we confronted a legacy system encumbered with millions of lines of convoluted code and redundant modules,” says Adnan Masood, chief AI architect at UST. “Manual remediation would have been prohibitively resource-intensive. By deploying AI-powered code analysis, we systematically identified deteriorating modules exhibiting code smells, duplication patterns, excessive dependencies, and architectural brittleness — enabling precise prioritization of refactoring efforts.”
Enhanced linting. “Linting tools are purely mechanical processes which evaluate your code and flag instances where, for example, the code has too many if/then/else branches, or if a class or method body has grown too long,” says Qwoted CTO Kevin Trowbridge. “Fixing these problems is quite a bit of work, and so codebases are often littered with manual overrides — comments in the code such as ‘rubocop:disable’ or ‘rubocop:todo’ which tell the linter to ignore these issues.”
Such comments represent a classic form of tech debt: a realization by developers at the end of feature development that the code they just wrote will ultimately need to be deeply refactored. “This is where LLMs can really shine,” says Trowbridge. “The linters can often be configured to annotate the violations directly within the code, with comments such as rubocop:todo and the specific problem identified. The file can be passed directly to the LLM with simple instructions like, ‘Please resolve the rubocop:todos.’”
Tracking down outdated dependencies. Sometimes tech debt arises not because your code is bad, but because code it depends on has changed or gone sour. “AI coding assistants can identify how out of date all of the libraries and dependencies of the codebase are,” says Pete Whiting, one of the founders of the Gnar Company, a web and mobile development firm. He notes that AI can recognize such links as a problem even if it hasn’t been specifically tasked with hunting down tech debt: “These areas of the codebase are also highlighted by the AI coding assistant when prompted with some improvement requests (e.g., improve performance, apply consistent patterns, or follow best practices.)”
Smarter testing snuffs out debt — hopefully before it starts
Some developers are thinking bigger when it comes to applying AI tools to tech debt tasks. Take unit testing, for instance: an important tool for producing high-quality code that doesn’t add tech debt but is often neglected in the race to deliver a minimum viable product. That means production code will need to have tests written later as part of a cleanup operation — a daunting task that generative AI tools can speed up.
“AI coding assistants have been helpful in adding test coverage for existing functionality that previously had not had tests,” says Gnar’s Whiting.
[ Related: Aware of what tech debt costs them, CIOs still can’t make it an IT priority ]
Of course, when it comes to tech debt, the best prevention is avoiding it in the first place. Justin Ramos, CEO of Compai, says that AI tools are “super helpful at easily creating unit tests, which prevents the buildup of tech debt. This used to be an arduous yet valuable task, but tools like Claude are making that easier.”
In fact, AI tools can help improve testing coverage in specialized scenarios that had previously resisted testing altogether. “Testing has historically been a challenge for ML/AI models due to their nondeterministic outputs, often leading teams to undertest complex systems,” says Jarrod Vawdrey, field chief data scientist at Domino Data Lab. “AI is changing this by automatically generating comprehensive test suites that account for the probabilistic behavior of models and can validate outputs across a spectrum of scenarios.”
Turning debt into strategy
Many companies are starting to use AI tools as an infrastructural ecosystem that supports quantifying n and correcting tech debt. QueryPal’s Nag says that AI can go beyond just surfacing code smells to creating entire dashboards, “with hotspots, churn rates, entropy metrics, and even predicted cost-of-change per module. That makes technical debt legible to the business.”
[ Related: How to talk to your board about tech debt ]
AI tools can identify at-risk components based on patterns such as bug density, frequent changes, and dependency sprawl — insights that allow teams to plan their attack on debt. “If you know where the rot is and can fix it fast, it’s not scary. It’s strategic,” says Rob Whiteley, CEO of Coder.
Credibly’s Yelle advocates for a “framework-driven approach” for that attack, which should incorporate quantitative definitions of code complexity and performance. “Gen AI can be used to offer up suggestions on how to define complexity,” he says, “though organization leaders would have the most context to determine which metrics are most relevant.” But these suggestions can allow teams to move from gut-feel triage to systematic remediation.
“If people blindly use code generated by AI because it worked, then they will quickly learn everything they ever wanted to know about technical debt.”
— Yvette Schmitter, co-founder and CEO, Fusion Collective
Once frameworks are in place, generative AI tools can automate large swaths of the cleanup process. Kevin Beaugrand, director and consulting expert at CGI, describes using AI to migrate a legacy application, with nearly 70% of the new code generated and reused. “At the same time,” he says, “we observed a significant reduction in the application’s overall technical debt — around 50%.”
Context is king — and AI doesn’t have it
Despite the promise that AI tools hold for tackling tech debt, most of the practitioners we spoke to emphasize the need to keep humans in the loop.
“AI tools are quite good at pointing to code that looks messy, over-complex, or suspiciously hard to maintain,” says QueryPal’s Nag, but “what they struggle with is knowing why that code ended up that way, and whether it’s truly debt or just a quirk of business context. A loop that looks redundant in one repo might be a critical work-around for a flaky vendor API in another.”
The problem is that “technical debt, at its core, is rarely just structural — it’s cultural and contextual,” he says.
“The AI doesn’t see the internal politics that delayed a rewrite, or the launch deadline that forced a shortcut, or the fragile contract with a partner system that made abstraction impossible,” Nag says. “Without access to those stories — and they’re never in the repo — AI can’t tell whether to delete or defend that code. Without that contextual knowledge, AI can’t reliably determine whether to delete or defend certain pieces of code.”
Then there’s the question of whether using AI in coding from the start simply piles up more tech debt to begin with. UST’s Masood calls this “the paradoxical challenge” of AI development. “The capacity to generate code at unprecedented velocity can compound architectural inconsistencies without proper governance frameworks, he says. “This tension requires sophisticated orchestration of AI capabilities within disciplined development practices.”
Yvette Schmitter, co-founder and CEO of Fusion Collective, puts it much more bluntly. Talking about shops without AI guardrails, she says, “If people blindly use code generated by AI because it worked, then they will quickly learn everything they ever wanted to know about technical debt. You still need an engineer with judgment to determine what is appropriate and not appropriate for your enterprise.”
How to prevent tomorrow’s tech debt today
Still, everyone we spoke to saw a role for AI in dealing with tech debt. If used correctly — a big caveat — AI can provide forward-looking guidance to nip tech debt in the bud before it starts. “AI frameworks can now forecast debt accumulation trajectories with remarkable accuracy,” says UST’s Masood.
These predictive models allow teams to embed real-time debt assessments into code reviews — catching problems before they scale. As Coder’s Whiteley puts it, these projections “turn tech debt from an annual fire drill into an ongoing, visible backlog that engineering leaders can prioritize.”
And faster and more efficient reduction of tech debt means developers get to do more of what they’d rather be doing. “There’s a lot of talk about agentic AI replacing developers,” Whiteley says. “But in reality, it frees up developers to focus on creating value and not paying down tech debt.”
Read More from This Article: Can AI solve your technical debt problem?
Source: News