In part one we got as far as the first CLAUDE.md, the file Claude Code reads at the start of every session. This part is about what we put in it, why it split into eight files, and what we learned about our own codebase by explaining it to something that takes every word literally.
A guide that knows C# is not a guide that knows us
The frontier models are good at C#. They are not good at the particular way a twenty-year-old platform does things, because nobody has written about that on the internet. Our agent kept making the same category of mistake: locally correct code that violated a convention it had no way of knowing.
So we wrote the conventions down. The root guide is the "deepest single source of truth" for how to write code here. Then one guide per module, each one short enough to be read properly:
- Data: how NHibernate mappers are structured, how repositories are registered in the container, how Solr indexing hooks in. About two hundred lines.
- Database: the SQL project and dacpac, how data-change scripts are written with run-once guards, how translations and permissions are seeded. The longest one, over five hundred lines, because the database is where mistakes are most expensive.
- Domain: the Active Record base class, how query classes work, and the rule that every data change writes an activity log entry. Four hundred lines.
- Web application: a long list of Razor pitfalls that each cost somebody an afternoon once.
- Tests: what coverage a new entity needs before it is done.
- Plus shorter guides for Core, Web Core and the ordering controllers.
An agent working in the data layer reads the data guide. It does not need to know about Razor. That split was not a style choice. A single twenty-kilobyte file was being skimmed, and we could tell because the mistakes it was supposed to prevent kept happening.
Rules written in blood
The most useful rules are the ones that name a specific failure. A few of ours, quoted as they stand:
"Never use
newto instantiate services or repositories inside business logic."
"No
// NOSONARwithout a justification comment."
The second one has a footnote in our Definition of Done that explains why it exists: agents tend to suppress warnings rather than fix them, and this rule catches that. We did not know that about agents until we watched it happen. A static-analysis warning appears, the agent adds a suppression comment, the build goes green, and the problem is still there. A human might do that too, but a human feels slightly guilty. The rule replaces the guilt.
"Tools as truth. When they emit red errors or warnings, the claim 'it works' is false."
That one came from a different failure. An agent would finish a task and report success, and the report would be confident and well formatted, and the build would be red. We now treat any statement about the state of the code as a claim until a tool confirms it. The agent runs the build. The agent runs the tests. If they are red, the task is not done, whatever the summary says.
The nine laws
Above the module guides sits a short list we call the architectural laws. There are nine. They are deliberately few, and they are the first thing a reviewer agent checks a plan against:
- Separation of concerns. Layers stay in their lane.
- Explicit over implicit. No magic, no hidden side effects.
- Performance first. No N+1 queries. Ever. On a platform this size they are the top cause of production incidents.
- Security by design. Not a review step at the end.
- Scout rule. Leave the file better than you found it, within the ticket's scope.
- Spec first. Features start from a frozen specification.
- Plan-mode TDD. The plan lists the tests. The tests come before the code.
- Observability required. If it runs in production it logs, traces and can be measured.
- Complexity budget. Hard limits on method length, nesting and cognitive complexity, enforced by SonarQube.
When documents disagree, the laws win over the Definition of Done, which wins over the module guides. Writing that ordering down ended several arguments before they started, including arguments between agents.
Skills: the "how", separate from the "what not"
The guides and laws say what is forbidden. They do not say how to do the ordinary things. For that we have skills: small, reusable procedures the agent follows step by step. We have twenty-seven of them in this repository at the time of writing. Some are generic engineering hygiene: write a commit message in conventional-commit format, draft a pull request body that walks through the Definition of Done, refactor in steps of three hundred lines or less with the tests pinned first. Some are specific to us: create a Jira ticket with a German and an English summary, run the SonarQube scanner and work through the findings, generate a procurement workflow template in the product's own format.
The rule we settled on is that a skill is procedural and always links back to the rule it serves. If a skill and a rule ever disagree, the rule is right and the skill has a bug. That keeps the procedures from quietly becoming policy.
Giving the agent a map
One more thing changed how well the agent worked, and it had nothing to do with prose. On a codebase with six thousand C# files, "find where this is used" by text search is slow and unreliable. In mid-2026 we gave the agent a code navigation server over the Model Context Protocol: find a definition, find references, search semantically, look up a glossary term or an architecture decision, run git blame. The root guide tells the agent to use it before it reads files. The quality of plans went up noticeably, because the plans were now based on what the code actually does rather than on what a grep suggested it might do.
What we learned about ourselves
The honest summary is that the agent was a mirror. Every place it went wrong was a place where our conventions were unwritten, inconsistent, or only enforced by the memory of whoever happened to review the pull request. Writing eight module guides took weeks of senior time. It was the best documentation effort this codebase has ever had, and it was done for a reader that does not get bored. New colleagues get to read it too.
Next in the series: one agent doing everything turned out to be fast and unreliable. Part three is about the agency: sixteen roles, read-only reviewers and a state machine with a human gate.