Want to learn more about Faros AI?

Fill out this form to speak to a product expert.

I'm interested in...
Loading calendar...
An illustration of a lighthouse in the sea

Thank you!

A Faros AI expert will reach out to schedule a time to talk.
P.S. If you don't see it within one business day, please check your spam folder.
Oops! Something went wrong while submitting the form.
Submitting...
An illustration of a lighthouse in the sea

Thank you!

A Faros AI expert will reach out to schedule a time to talk.
P.S. If you don't see it within one business day, please check your spam folder.
Oops! Something went wrong while submitting the form.

Tackling Tech Debt with AI: A Case Study Using Claude Code

See how AI agents like Claude Code can tackle tedious tech debt, from cleaning test utilities to reducing Docker image size by 50%.

Yandry Perez Clemente
Yandry Perez Clemente
On the left, text: Tackling tech debt with AI, and on the right the Claude Code logo, on a blue gradient background
6
min read
Browse Chapters
Share
June 16, 2025

Can AI agents help with tech debt?

Yes. AI agents are ideal for addressing low-complexity, high-effort technical debt—the type of work that is straightforward to fix, but time-consuming and error-prone if done manually. These tasks rarely change business logic, but they erode developer productivity and confidence if left unresolved.

What is tech debt and why does it happen?

Technical debt often arises when teams opt for speed over structure. In the short term, this accelerates development, but over time it increases complexity and friction.

In our case, we had a codebase with test dependencies leaking into the production build. Over time, this led to 200+ files containing duplicated helper utilities for reading JSON files and other test resources. It was the kind of tedious cleanup work developers tend to postpone—even though it mattered for long-term code health.

How can Claude Code fix tech debt?

Claude Code, an AI coding agent, turned out to be a perfect fit for this job. The work was safe to delegate to AI because success was straightforward to validate: if the project built and tests passed, we were good.

The tech debt in our use case involved two steps: Removing the test dependencies and reducing the Docker image size.

Cleaning up test dependencies

I split the cleanup task into two pull requests for Claude Code:

  1. Source utilities: Moved test utilities into a separate package and updated imports. → 105 files changed by Claude Code instead of a human engineer
  2. Destination utilities: Repeated the process for destination utilities. → about 200 files fixed by Claude Code in total

Normally, this would have been a boring, error-prone process, but with AI, it became fast and accurate.

Reducing Docker image size

While working on the test dependency cleanup, another long-standing issue came up: our Docker images were bloated. Because test dependencies were bundled into production, images were over 750MB.

With Claude Code, I converted the build into a multi-stage Docker build so only production code was included. The result? A 50% reduction in image size, down to 376MB.

Why AI works for this kind of task

AI agents excel at low-complexity, high-effort engineering work:

  • Tasks are easily verifiable (tests, builds, CI pipelines)
  • The risk is low since business logic isn’t touched
  • The effort savings are high, freeing developers to focus on meaningful, higher-value work

This case shows how Claude Code can handle repetitive, time-consuming debt—improving both code quality and developer happiness.

<iframe width="791" height="791" src="https://www.youtube.com/embed/PWpsKdHtsFA" title="How I Tackled Tech Debt with Claude Code - Experience Report" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

Full transcript: How I used Claude Code to tackle tedious tech debt

“One of the greatest use cases that I've found for AI agents is to help with technical debt, especially technical debt that is easily fixable, but it just takes a long time to solve. This is the kind of thing that doesn't let you as a developer sleep well at night.

We had in this code base a bunch of test dependencies that were leaking into the production build. And slowly over time, it had grown to about 200 different files with duplicated helper utilities to read JSON files from test resources and that kind of stuff.

And when I started testing AI tools for development, this sounded like the perfect task for it, because it's very easily verifiable, since I'm not touching any logic in the actual code here, I'm just moving test utilities around. As long as my project still builds and passes the tests, we know that we are fine.

So I separated that task into two different PRs. In this first one, I moved only the test utilities for the sources into a separate package and then imported those functions where they were previously used. That resulted in a pretty boring but very accurate PR with 105 files changed. So I did the same thing for the destination utilities in a second PR-–[which was] in total around 200 files that I needed to fix—but of course it was a lot easier with AI.

And the cool thing about this is that it unlocked another thing that was in the back of my head for the longest time, that since we had all of these testing dependencies in the production build, we were including all of that in our Docker images unnecessarily.

So after finishing with the first two, I again use Claude Code to turn my Docker image build process into a multi-stage and as usual, run the dependencies to only include the production code. So that resulted in, as you can see here, in my image when I was testing, around a 50% size reduction in the image. Our images were about 752 megabytes. And after the change, they turned into 376 megabytes.

It was the perfect task for AI because as long as the build and test commands were passing, we know we are good. And for the second task, same thing. And as long as you're done with the Docker build successfully, there is nothing to fear. Everything is fine.”

Tackle tech debt with Claude Code: Your AI-powered development partner

Ready to reclaim your development time? This case study shows exactly how AI coding agents like Claude Code can transform those lingering tech debt tasks from overwhelming projects into quick wins. 

By eliminating 200 tedious file changes in minutes rather than days, we didn't just clean up our codebase—we freed up precious developer hours for the creative, high-impact work that actually moves the needle.

The lesson here isn't that AI will replace developers, but that it can handle the repetitive, time-consuming tasks that keep us from our best work. 

Whether it's dependency cleanup, refactoring legacy code, or optimizing build processes, Claude Code turns tech debt from a burden into an opportunity. 

The next time you're staring at a backlog of "someday" improvements, consider whether an AI agent might be the perfect tool to finally tackle them—and get back to building what matters.

I publish my thoughts on AI and experience with AI coding tools frequently. Follow me on LinkedIn to stay in touch.

Yandry Perez Clemente

Yandry Perez Clemente

Yandry Perez is a senior software engineer at Faros AI.

Connect
AI Is Everywhere. Impact Isn’t.
75% of engineers use AI tools—yet most organizations see no measurable performance gains.

Read the report to uncover what’s holding teams back—and how to fix it fast.
AI Productivity Paradox Report 2025
Discover the Engineering Productivity Handbook
How to build a high-impact program that drives real results.

What to measure and why it matters.

And the 5 critical practices that turn data into impact.
The cover of The Engineering Productivity Handbook on a turquoise background
Want to learn more about Faros AI?

Fill out this form and an expert will reach out to schedule time to talk.

Loading calendar...
An illustration of a lighthouse in the sea

Thank you!

A Faros AI expert will reach out to schedule a time to talk.
P.S. If you don't see it within one business day, please check your spam folder.
Oops! Something went wrong while submitting the form.

More articles for you

Editor's Pick
AI
News
7
MIN READ

Translating AI-powered Developer Velocity into Business Outcomes that Matter

Discover the three systemic barriers that undermine AI coding assistant impact and learn how top-performing enterprises are overcoming them.
August 6, 2025
Editor's Pick
News
AI
DevProd
4
MIN READ

Faros AI Hubble Release: Measure, Unblock, and Accelerate AI Engineering Impact

Explore the Faros AI Hubble release, featuring GAINS™, documentation insights, and a 100x faster event processing engine, built to turn AI engineering potential into measurable outcomes.
July 31, 2025
Editor's Pick
AI
DevProd
5
MIN READ

Lab vs. Reality: What METR's Study Can’t Tell You About AI Productivity in the Wild

METR's study found AI tooling slowed developers down. We found something more consequential: Developers are completing a lot more tasks with AI, but organizations aren't delivering any faster.
July 28, 2025