Steering an AI assistant to write small code
I use AI coding assistants every day, and they make me faster. They also have a strong default: ask for "a WhatsApp blur extension" and you get a React template, a bundler, a couple of npm packages and event listeners everywhere. It works, and it is far heavier than it needs to be.
When I built Blur Your WhatsApp, the interesting part was not the code. It was steering the assistant away from that default. I treat it like a capable junior developer: it writes quickly, but it needs explicit constraints.
Set the constraints before the first prompt
These were the rules I gave it, and I repeated them whenever a draft drifted:
- No frameworks and no dependencies. Plain JavaScript only.
- If CSS can do it, CSS does it. Blur, hover and transitions belong in a stylesheet.
- No event listeners on individual elements.
- Never select by class name on a site you don’t control.
- No polling. React to changes with observers.
Review for weight, not just correctness
A draft that works can still be wrong for the job. I read every change asking two questions: does this add something that runs on every frame or scroll, and could the browser already do this for free? Most of my edits were deletions.
Fundamentals are the steering wheel
The assistant sped up implementation a lot. But knowing about the compositor thread, list virtualisation and why obfuscated class names break is what let me say no to its first answer. AI amplifies whatever judgement you bring to it, so the judgement still has to be yours.