Skip to content
Building with AI without it turning into a mess: rules, a handbook and designs

Building with AI without it turning into a mess: rules, a handbook and designs

· Bert Altena

An AI developer repeats a mistake as easily as it makes one. What helps: a rules file that may only grow, a handbook that is read first, and checks that do not rely on the eye.

An AI that writes code is fast. It is also forgetful. Every session it starts again, and a bug fixed last week gets built back in this week with just as much conviction. Not out of sloppiness, but because nobody told it.

On a booking platform I have built a lot of with AI these months, that has been the biggest lesson. The problem is not whether the AI can write good code. The problem is how you stop the whole from slowly falling apart. Three things worked.

Every mistake becomes a rule, with the date

The code contains a rules file that the AI reads at the start of every session. It holds the house rules: how the project is organised, the business rules around payments, what is never allowed. By now it has 49 chapters.

The most useful part is not the description but the history. Many rules say why they exist, with the date and the file where it went wrong. An example: in a migration with texts in four languages, German and Spanish were once swapped. No check noticed, and months later a German customer saw "Total a pagar" next to his price. Since then, the order of the languages sits at the top of every migration with texts, and the rule mentions the incident.

A story like that does more than a bare rule. An AI, and a person just as much, takes a rule more seriously when it sees what happened when the rule was not there.

Rules may grow, never shrink

At the bottom of the rules file is a rule about the rules themselves. Rules may be added, as long as they do not clash with what is there. Removing or weakening an existing rule is not allowed. If someone asks for it anyway, it is not done silently: the AI reports which rule it touches and why.

That sounds strict, and it is. But every rule came about through a mistake that was already made once. The temptation to remove a rule always comes at the moment it gets in the way, and that is exactly the moment it is doing its job.

A handbook that is read first

The rules file is about how you build. The handbook is about how the system works. It started at the beginning of August with 84 pages in 13 topics, in Dutch and English. Now there are 171 per language, in 14 topics.

Two agreements make it useful. Before work starts on a screen, the handbook pages about that screen are read first. Every page lists at the top the files it is about, so they can be found by searching for the file name. And every completed change updates the handbook, in both languages.

A small tool keeps it honest. For every page it records the date of the latest change to the files it lists. If that date is ahead of the text, that is the signal the page is lagging behind. A handbook that quietly goes stale is trusted by nobody after a few months.

Designs as standalone html, in one place

For a new screen, a design is made first, as a standalone html page you open in the browser. Not an image or a description, but a clickable example in the real style of the screen it is about. The decision is made on that, and only then is it built.

Those designs live in one place, 68 of them now, and since recently they can be searched in a tab of their own on the task board. Each design shows its status: proposal, decided or rejected. You view them full screen, at the size of a computer, tablet or phone. Half a year later, that is the answer to the question: why is this here, and what was the alternative?

Checking with a script, not with the eye

The last lesson: do not trust the eye, not even an AI's. Several rules therefore have a check of their own that runs with every change.

There is a check on migrations, because the database tables have a prefix that is only added correctly in a fixed form; a deviation silently stops the rest of the file from running. There is a check for the em-dash in everything a user reads, including the HTML forms that produce the same character. A check on comments in code that reaches the browser, because those should be short and in English. And a code scan that runs the same rules as the check on the server, even without a database.

Each of those checks exists because doing it by eye went wrong once.

What I take from this

Working with an AI developer is more like onboarding a new colleague who has forgotten everything every morning than like using a tool. What you give that colleague on paper determines the quality.

Three things I would recommend to anyone who wants to build this way. Write a rule for every mistake, with the story attached. Make sure reading comes first and building second. And turn every rule you can check with a script into a script.

How the changes are then built and tested by themselves, I described in from request to live. More of the platform is in the portfolio. If you want to work on your own software with AI this way, get in touch via the contact page.

Frequently Asked Questions

What is a rules file for an AI developer?
A text file in the code that the AI reads at the start of every session. It holds the house rules of the project: how the code is organised, what is never allowed, and which mistakes were made before. That way nobody has to explain how it works at every session.
Why may rules only grow?
Because every rule exists because of a mistake that was already made once. Removing or weakening a rule because it gets in the way is the fastest way to make that mistake again. Adding is always allowed, as long as it does not clash with what is there.
Why a handbook if the code says it all?
The code says what happens, not why. The handbook records the decisions: why something works this way, what the alternative was and which trap was in it before. Whoever builds without reading that will undo such a decision by accident.
Chat met ons