D·B
Notes · October 2026 · Dragan Basta · 4 min read

Rules I give AI agents in every repo

Most of the code in my 2026 projects was typed by an AI agent. All of it was shaped by a short file at the root of each repo. I write that file the way I'd write onboarding notes for a new engineer: what this system is, what must never break, and how we work.

1. Say what “worse” means

In a property-valuation backend I wrote: silent data corruption is worse than a visible error. That one sentence changes a hundred small decisions. The agent fails loudly, validates at the edges, and stops “helpfully” defaulting a missing value.

2. Read before you write

Read the target code and every caller. Check the database constraints in the migrations, not in the model. Look for existing tests. Say which files you plan to change before changing them. It's the same thing I'd ask of a new teammate in their first month.

3. Bugs start as failing tests

Reproduce the bug in a test, confirm it fails for the right reason, then fix it. Agents are fast at writing code that looks plausible. A failing test is what turns plausible into correct.

4. Small batches, a different reviewer

On a large refactor of a hiking portal, one agent did the hands-on work in batches of about three files. A second, stronger model and I reviewed every PR before merging. It's slower than one big change, but every step can be reviewed and reverted.

5. Mark what needs a human

Schema contracts, prompt and model versions, data-residency settings, anything involving money or patients. These are change-controlled and need a person to sign off. The rules file says so explicitly, so the agent asks instead of guessing.

What this means for a team

Using AI well is mostly an engineering-management problem: clear expectations, good review habits and fast feedback loops. The teams that get the most from it are the ones that were already good at writing things down.

Back to home