DEV Community

Cover image for Claude paid our code debt
Joel del Pilar
Joel del Pilar

Posted on

Claude paid our code debt

Let me give you some background

Code dept, we all know it's there and we all have once or twice (multiplied with X) contributed to it. As developers we all are working towards some kind of deadline where feature X must be done at a certain point. Often the code we write is needed by someone else in the team and vice versa. Over the years this has somehow created a kind of tolerance towards code debt. "We fix that later, it's not critical" - heard that one before?

In the recent years I have been involved in a in-house project at my work. Time has been a factor where we needed to ship new features kind of quickly, so that we could get feedback fast from users while also attract new users to the platform.

I started working on this project as an intern and had very good guidance for senior devs. Later I became one who took on new interns and as I grew in my role and got a better understanding of the code I soon realised that we had quite a lot of debt in our code.

Same same but different

In one specific area we noticed that our code was inconsistent and that a huge debt was left for the future. That was in our error handling.

I think that the project started of in a good way and that there was a thought around how to handle this but along the way and with several people doing their on take on it, it all got a bit messy. We had unclear error messages presented to our users, unclear crashes, success in client but error on server - yeah it was messy.

How to paid code debt in 2026

I took it upon myself to start investigating and since this project nowadays has a AI first policy I invited my buddy Claude to the table.

My IDE of choice is Cursor and I use Claude Code within my Cursor environment. And this is how I went about making our first repayment:

Plan mode
In this mode you can create a solid work plan for the AI to follow. Since our project is a respectable size I started to prompt Claude to analyze the code base in steps.

I started to ask Claude to analyze how errors where handled through out the app, analyze the code for the client and for the backend, api, interfaces and so on.

In every iteration I asked Claude to document the findings and the final result was a comprehensive analyze of error handling for the entire app.

Next step, action plan. Still in plan mode I asked Claude to create an action plan for the report, all suggestions needed to be documented in a action plan file so that I could easily review it.

I must say that I was a solid plan but I hade some ideas that I wanted to incorporate in the plan. One of those ideas was custom errors. I wanted a good way to send specific error messages to the user that where meaningful.

Action
With this info we created a 8 phase action plan and started working, or should I say Cluade started working (haha). For each phase I hade Claude make a todo-list and after each phase I reviewed the changes and made a commit.

Through out the process Claude made a impressive job, and that's not easy to admit! In a few cases I had to remind to format, typecheck and in one case he forgot to use the custom error - here is where your review as a developer is important! Our knowledge and vision is not always clear to the AI and it's our job to make sure good quality and clean code is provided.

Paying code debt is easier than ever

My conclusion of this experience is that paying code debt is easier than ever today! You just need to take it step by step, clear instructions and validate the results one by one.

If I should estimate how many hours this work would have taken me if I did it manually my guess is somewhere around 40-60h - with Claude code it took me 4h!! That to me, is crazy.

Some thoughts

Agents and models today has gotten so far and so good that we can be so much more efficient. What ever tool you prefer, let it do the tedious work that you put of for so long. Let is get you started on the amazing idéas you have, be creative and build awesome stuff.

Top comments (0)