How I used AI to increase my library’s performance by 5x !

How I used AI to increase my library’s performance by 5x !
A tale of using AI to highlight your blind spots.
SPOILER: AI didn’t deliver the performance improvement itself, but it got me looking at the right places. Hey, I know, clickbait title- but while you’re here why not stay and enjoy my tale.
In the beginning…
I was looking for a new project to work on in my spare time. I have always loved toying with the HTML canvas and sockets, sharing them on JS1K, JS13kGames and others. I got really inspired by a recent project by Nolan Royalty: One Million Chessboards.
I set out to build a similarly large-scale online web game, and I knew I had the perfect tool in my belt: Kalm, a socket management library I had built a decade ago to facilitate congestion control in real-time applications. But I decided to also give myself another challenge for this project… co-develop it with this junior developer called “Claude”. (Gotta give this “vibe-coding” stuff a try, apparently it’s all the craze)
The (first) project…
Claude could understand basic instructions pretty well, and was very polite- always asking before performing any commands. Though however, he would often get lost whenever a CLI program required extra input.
I ended up setting the project structure myself, just so it wouldn’t need to improvise too much. This limitation would become very clear in future steps.
I now had a basic Svelte app. Claude had given me a canvas element, a render loop and a few other basic functionalities. It was now time to build a socket server, so I gave Claude a prompt that, even myself, found perhaps too daring: “Build a node.js websocket server that uses the Kalm framework”.
Surprisingly, it delivered… kinda. There was now a folder with the node.js server. It had installed Kalm as a dependency and there was code that- at first glance- looked promising. I gave it a spin.
Immediately, I was met with strange errors. A few were my junior’s fault, not keeping track of certain variables, hallucinating others… but something wasn’t right. Namely, Claude had installed an *ancient* version of my library.
Understanding AI…
The code was modern, but the version installed was old?
Without thinking too much about it, I prompted Claude to “use the latest version of Kalm”. It apologized profusely (not really, but it’s fun to imagine) and installed the latest version available at the time: v7.0.0.
The code remained unchanged, but now the app compiled.
Why did it install this old version in the first place?
- Was my repo still publishing some old examples?
- Did it pick up on an article on “how to use kalm” ?
This all got me thinking… if AI gets confused, maybe devs (and their AI co-pilots) could get confused as well!
I panicked and cloned my library’s repo to end this madness at once!
The second project…
Right off the bat, it was clear I needed to update a few things, as most OSS developers painstakingly do on a regular basis.
- Update LICENSE date
- Bump engine requirements as Node versions go end-of-life
- Bump dependency versions
- Update toolchain when packages decide to deprecate certain functionalities
- Re-test everything
Once those tasks were done, I had new missions:
- Add code comments in areas where the logic isn’t immediately obvious
- Add more code examples with detailed READMEs
- Make sure that old examples and references are updated
These steps were what kicked off one of the largest overhauls my library had seen in many, many years. Standardizing variables names, documenting flows and refactoring when unclear. Building many example apps, highlighting bugs and inconsistencies. Not least of which two bugs that caused a major performance degradation!
I was happy… but not quite done. I still hadn’t found out why it installed that old version.
That was, until I went to fix a typo on the library’s static website page and noticed this:

Do you see it?
This static page, last updated 7 years ago, was sending everyone to an ancient version of kalm’s example folder.
A majestic facepalm ensued.
In conclusion…
AI co-pilots are very much like junior developers in that they lack instincts and reflexes. They simply follow links and obey.
If you are an app or OSS developer and you want your projects to be approachable by both organic and non-organic lifeforms, make everything dead clear and update your docs :)
Oh, and check out Kalm!