Taming the Code Gremlin

by | Sep 14, 2026

AI coding agents can be gloriously useful little code gremlins: they will explore your repository, suggest fixes, run tests, and occasionally redecorate the attic. The secret is not to ask them for more code, but to teach them manners. A good workflow gets better code, not a landfill of lines.
I once watched a cheerful junior teammate summon an agent with the request, ‘Make login more secure.’ The agent, bless its deterministic heart, added two dependencies, rewrote the session model, and introduced a bug that made everyone log out during lunch. We laughed, rolled back, and learned that vague commands are like throwing spaghetti at a wall: the agent will helpfully cook the wall. The problem wasn’t the AI; the problem was asking a robot to be a genius without giving it a map.
Context matters more than poetry. An agent without repository context is like a GPS in a country that just invented roads. It can calculate routes, but it may route you into a lake. A good prompt is not a sonnet; it is a flashlight. Point it at the right directory, README, failing test, or API contract. Project-level instructions and documentation become the agent’s shared memory. If your codebase has a weird style, tell it. If it must not touch migrations, say so. If the deadline is lunch, tell it too. Before changing anything, ask the agent to inspect. ‘Read the tests, explain the current auth flow, and list risky files.’ Then plan. Then implement. Then test. This loop keeps the octopus from changing fifteen files because it misunderstood your fourth sentence.
Relatable confession: I have definitely trusted an agent a little too much. Once, I asked it to rename a user variable and only noticed it had also refactored my entire component tree when the diff looked like a small rebellion. Now I start small: one function, one test, one tidy change. Small tasks are easier to review, and when something breaks, you know roughly where the gremlin sneezed.
Agents shine when a task needs multiple moves: find why integration tests fail, compare behavior across branches, fix the root cause, rerun targeted tests. They are less useful for a one-line question that could be answered by a human with a mug. Good requests include the goal, files to touch, constraints, success criteria, and tests to run. Also, let tests be the agent’s playground. Tests are not just proof for humans anymore; they are guardrails for machines. Treat the agent like a brilliant intern who never sleeps: generous with changes, allergic to assumptions, and happiest with clear boundaries.
Still, the developer remains the adult in the room. An agent can make tests green and architecture gray. Review for design, hidden assumptions, dependencies, odd inputs, maintainability, and security. Code is cheap now; understanding is expensive. The best programmers in this era won’t necessarily write the most code. They will know which problems to hand to the machine, how to frame them, and when not to trust the answer.