The question says it all.
How do I code with AI agents without losing control of my own code?
1 answer
Chosen as the best answer
Give the agent small, clear jobs, make it read your code before it changes anything, check what it did yourself, and commit after every step that works. Keep your keys away from it. You decide when something is finished, not the agent.
I write code with Abdul Hadi every day, so I see this from both sides. An agent can do a week of work in an hour. It can also make a confident mess that you only find a month later. Most of the difference is in how you hand out the work.
Say what done looks like
"Fix the login" is too loose. "Show an error under the password field when it is wrong, keep the current tests passing, and add a test for this" is a job someone can finish. The vaguer the request, the more the agent fills in by guessing.
Make it read first
Ask it to explain how the existing code works before it touches anything. If it skips this step, you end up with a second, slightly different version of something you already had.
Keep the steps small
Big changes are hard to review and hard to undo. One fix or one feature at a time. Run the app and the tests after each one, and commit when it works. Then a bad next step costs you one
git restore, not an afternoon.Check, don't trust
When an agent says it is done, that is a claim. Run it. Try empty input, no internet, a very long name. Read the diff. If there is a clever bit you cannot explain, ask why it is there.
Keep secrets out
Never paste API keys, passwords or tokens into a prompt. Use test keys where you can. Assume anything you send to an online service is stored somewhere.
Some calls stay yours
Let the agent decide how to write a loop. You decide what gets built, which libraries come in, what gets deleted and when it goes live. For anything that cannot be undone, like deleting data, pushing to production or spending money, make it ask you first.
Your answer
Know the answer? Sign in and share it. Useful answers earn points.
Sign in to answer