Getting the chores done

Published on by

I've got this CLI tool I created a while ago and hardly changed in years. Nothing fancy - a todo manager that grew organically as I needed. Started with a quick bash script, added a feature here, bolted on another there, and before I knew it I've got a codebase that works but makes me wince when I look inside.

It had accumulated the usual cruft. Duplicate functions, redundant dependencies, the function I'd written at some ungodly hour that somehow works. Classic side project evolution.

Instead of doing what I usually do (add it to my mental TODO list and quietly forget about it), I thought I'd try something different. Fired up Claude and asked it for suggestions to reduce some technical debt.

What came back wasn't some hand-wavy guidance. It was a proper breakdown: here's what's broken, here's the complexity, here's what you get for fixing it.

Top of the list: "You're using two search CLI commands that are doing the same job, perhaps you should only be using one."

Right. I'd wired in both ripgrep (rg) and the silver searcher (ag) at different points because... reasons? Probably because I was learning both tools and couldn't be bothered to pick one. A "Just get it working" that turns into "why is my dependency tree so weird?"

Why I'd been ignoring the obvious

Both ripgrep and the silver searcher are solid tools, but having wrapper code for both when they do the same thing? That's just noise. Plus the silver searcher hasn't seen much love lately whilst ripgrep has become stronger over time.

Claude said "high impact, medium effort". Obviously a useful change, but it's in that category of fix that's never going to get done.

When your assistant actually assists

So, it's on my mind, not a bad suggestion, and I said, OK, go for it

I didn't touch a single file - well I did fix one file, but only because old habits die hard.

More importantly, Claude proceeded to rip out the silver searcher code paths, update the CLI flags, ensure the tests still passed, and update the README. Did a decent job - no shortcuts, no "we'll fix this later" comments.

Twenty minutes total. I've spent longer trying to remember the syntax for sed substitutions. And, yep, I've spent longer writing this blog.

Just grunt work

This wasn't the AI cracking some algorithmic puzzle. This was grunt work. The boring stuff that makes codebases better but doesn't find the space in the day. However, now if this kind of thing fits, if this kind of work is cheaper to deliver, that's different. Finally I'm getting the robots to do the chores.

Deleting code is deeply satisfying though. Fewer moving parts, smaller binary, less stuff that can break. Wasn't a skill issue. I just kept finding other stuff to do instead. "I'll refactor this next week" (spoiler: I didn't).

Donald Knuth said premature optimisation is the root of all evil, but honestly? Chronic procrastination might be worse.

Developer behaviour

So this is what I learned from this experiment, and it's both exciting and humbling.

We're good at identifying funky code. Show us any codebase and we'll spot the code smells, the architectural issues, the bits that make you go "hmm, that's not ideal." We'll even write proper tickets about it, maybe argue about the best approach in Slack.

Actually fixing it? That's where we may lean towards higher value features. We may not get round to clearing up and dealing with those piles of boxes in the garage. Yeah, we called such a collection of Jira tickets "the garage" on a project way-back when.

AI doesn't have this problem. No rabbit holes, no sudden urge to reorganise the desktop, no "oh that's an interesting shiny tool." Just methodical execution until the job's done, whilst we can think about what's next.

What actually happened

Cleaner codebase, smaller binary, one less thing to maintain.

The workflow that emerged is interesting: we can make the architectural calls, AI does the grunt work. It didn't just steamroll ahead - it shows us the options, explained the trade-offs, then executes whatever we picked with the thoroughness we ask.

If AI can handle the tedious refactoring whilst I drink coffee, I'm not complaining. I can handle not being the one who manually deleted 200 lines of redundant code.

You can see the actual changes in this PR if you're curious about the specifics.