Rules file
Why it matters
Without one, the same correction is repeated every session: use British spelling, do not copy a component, check the tests before saying it is done. A rule written once applies to every future task, which makes this one of the cheapest improvements to working with an agent. It also gives a non-engineer a way to steer the work. Plain sentences in a file change what the agent does.
How to apply it
- Add a rule each time a correction has to be repeated. Repetition is the sign that a rule is missing.
- Write rules as concrete instructions. "Run the type check before finishing" works better than "write good code".
- Put the traps first, the parts of the stack where the agent goes wrong by default.
- Keep the file short enough to read in a minute. Long files dilute the important rules.
- Point to a longer record, such as a decisions table, for detail that does not need to load every time.
What it is
An AI coding agent has no memory of earlier sessions. Each time it starts, it knows nothing about how a particular business writes code, which tools it uses or which mistakes it has made before. A rules file fixes this. It is a plain text document kept with the project that the agent loads automatically before it starts work. Common names are CLAUDE.md and AGENTS.md, depending on the tool.
A good rules file is short and specific. It might say which language to write in, how to spell things on the site, where the key records live, which commands to run before finishing and which actions need approval first.
Common mistakes
- Writing aspirations instead of instructions.
- Letting the file grow with outdated rules that contradict newer ones.
- Putting secrets in it. The file is read by the agent and often stored in the repository.