Every rule in my project file came from a mistake

Every time I started work with an AI agent, I said the same things first. What the project is, how to run it, the house rules, what not to touch. Every single day. So I wrote them down once, in one file in the repo.
And here is the funny part. Which lines in that file are the most useful? Not the clever ones. The mistakes! Every rule in it came from something that went wrong once. One line each, and each one saves an hour.
It is my most valuable file that is not code. Then I held my long agent prompts to the same standard, and wow. A third of their lines could not say why they were there. I deleted them. Nothing broke.
What goes in
So what actually goes in? 4 kinds of line.
The commands. How to run it, test it, fill it with test data, put it live. Exact lines you can paste. This is the most useful part. And it is the one most people skip, because it feels obvious.
The house rules the code does not show. Where new code goes. What to do when something fails. Which of three similar pieces of code is the one still in use. A newcomer gets these wrong. A reviewer corrects them three times a week.
The traps. Anything that has bitten us once. A database change that must run before another one. A service that quietly returns nothing instead of an error.
What not to touch, and why. The why matters. Without it, anyone clever enough will talk themselves out of the rule. A person or an AI, same thing.
Run the tests: one exact command, ready to paste
Trap: this database change runs before that one
Trap: this service returns nothing, not an error
Do not touch: this folder, and the reason
What stays out
Just as important: what never goes in.
Anything the code tells you in under a minute. The folder layout, the list of what the app stores. A copy drifts away from the code. And a wrong copy is worse than no copy.
Wishes. "We write tests for everything" goes in only if it is true. One rule the code clearly breaks, and the reader learns that the file lies. Then the real rules get ignored too.
History. It lives somewhere else. This file is for doing the work.
Procedures, not prompts
Then the same idea grew. It took over the routines my agents run: fix a bug, review a change, publish to the test server. They started as prompts. Long ones, tuned by hand, full of phrases that existed because something went wrong once. They worked. But nobody could tell which sentence mattered, so nobody dared to edit them.
So I rewrote each prompt as a procedure in plain English. And I asked every line the same thing: why is this step here, and what happens if you skip it? A third of the lines had no answer. Gone!
Every procedure now has the same 4 parts:
- When it applies, in one line, so the wrong one is not picked.
- The steps, each with a result you can see: not "check the tests pass" but "run this command, and you should see this".
- What stops you, the moment to give up and ask. Without it, the default is to improvise.
- How to report, including what an honest half-done result looks like.
The contractor test
One bar for the file and for every procedure, and it is a simple one:
Could a good contractor who joins on Monday follow it without asking me anything?
If I cannot hand you the document, I do not have a process. I have a habit. And a habit does not survive being handed to someone else, a person or an AI.
And the AI? Same test, with a shorter attention span. That is why one file works for both.
What the mistakes taught me
When an agent gets something wrong, the easy move is a quick extra line in a prompt, just for that one case. It feels fast. It also hides the lesson where nobody reads it.
So my rule is simple. The fix goes into the file. If a change went into the wrong version of the project, the step that picks the version was unclear, and it was unclear for people too. If a change sent for review mixed three unrelated things, the procedure never said one thing per review.
Every one of those fixes has made the file better for humans. Not one has made it worse. That is the part I did not expect! I thought I was writing for machines. Really, I was writing down how my own work is done, for the first time.
The agents did not teach me this. They just made it impossible to pretend. A new colleague quietly muddles through a missing step, and I never find out. An agent fails in plain sight, the same day. Each failure points at the exact line the document was missing.
That changed how I feel about mistakes. A mistake that becomes a rule is not lost time. You pay for it once. Never again.
Things I did not expect
The steps to put that project live used to be only in my head. Writing them down for a machine meant writing them well enough for a person. And weeks later, who was the first person the file saved? It was me! I pasted the exact lines and did not have to remember a thing.
The deleting felt even better than the writing. I had been scared to touch those long prompts. Then one question, "why is this line here?", turned the fear into a short list.
And the file stays alive on its own. Nobody plans a day to update it. Things go wrong, and each time the file grows one line wiser. I love that.
How many of your team's rules still live only in one person's head?
My best documentation is a list of my mistakes, and I am proud of every line.
I post one of these every week. Follow along on LinkedIn or YouTube, or by RSS. Want this on your team? Work with me.
The 527 rules I give my AI agents, free
Every one comes from a real mistake. The best 100 are open on /rules, or download them as AGENTS.md, no email. All 527 come by email, as one file you can drop straight into your repo as AGENTS.md or CLAUDE.md, so your agents follow them from the next session. Plus the occasional email when I learn a new one.
One click to unsubscribe.