Skip to content
Mert Yılmaz
CVTürkçeContact
All posts

Working effectively with AI coding agents: a practical guide

Published

Short answer

To get good results from a coding agent, give it small, clear tasks, make the goal verifiable (tests, a build, a type check), write the project's rules in an instructions file, read every change as a diff, and keep secrets where the agent can't reach them. The agent speeds you up, but responsibility stays with you.

1. Make the task small and clear

Instead of "improve the site", write "add a phone field to the contact form, make it optional and update the existing validation schema". Small, clear tasks give more accurate results and are easy to review. For a big job, have the agent plan first, then split it into parts.

2. Give it a way to verify

Give the agent a way to check its own work: runnable tests, a build command, a type check, a linter. Being able to say "keep working until these commands pass" is the biggest lever for quality. Having it write a failing test first and then make it pass also works well.

3. Write down the project rules

Many tools read an instructions file in the project root (for example AGENTS.md). Put the commands you use, the folder structure, the code style and what not to do in it. Keep it short and current; a long, outdated file does more harm than good.

4. Read every change

  • Read the diff line by line. Code that runs is not necessarily correct.
  • Watch for unexpected file changes, deleted tests and added dependencies.
  • Review security-related code (authentication, payments, input validation) with extra care.

5. Protect secrets and permissions

  • Never commit secrets or .env files, and keep them out of the agent's reach.
  • Allow the agent to run only the commands it needs, and put deleting and pushing behind approval.
  • Don't give it direct access to production.

When to be careful

If the requirement is vague, the agent guesses and neatly builds the wrong thing. Have it ask questions first or approve the plan. Don't merge security-critical code without review.

Questions

Do I really need to test code an agent wrote?
Yes. Looking like it works doesn't show it's right. Tests, a build and a type check also give the agent a way to verify its own work.
What should go in the instructions file?
The commands to run and test the project, the folder structure, the code style and what not to do. Keep it short and current.
Should secrets be exposed to the agent?
No. Keep keys where the agent can't read them and never commit them.

Written by Mert Yılmaz, freelance fullstack developer.