Skip to content

Claude Code Review With a Rulebook and a Separate Auditor

Insights•
October 19, 2026

Introduction

The rules file says business logic does not belong in controllers. The agent read the file at the start of the session. The pull request still has a controller that calculates a discount, checks whether the customer is eligible, and saves the order. A few hundred lines of advice gave the agent nothing to decide with while writing, and nothing to check against afterwards.

One rules file is doing two jobs. It is supposed to teach the agent how to write code, and it is supposed to catch what the agent got wrong. Those jobs want different shapes. A rulebook is read before writing and is organized by what you are about to build. An auditor runs after writing, reads the rules one family at a time, and needs to know how bad each violation is. Splitting the two is what makes either one enforceable.

This piece shows the split as two Claude Code skills I use on my own Laravel projects: Kanon, the rulebook, and the Kanon audit, which checks code against it. Both are in the skills repo. They are not what the Codyssey backend uses: that repo has its own project-specific rules, covered in part 4. This is part 3 of the series that starts with My Claude Code Workflow for Laravel, From Idea to Merged PR.

Rules need keywords before they need content

Most rules files are written as advice: "prefer constructor injection", "try to keep controllers thin", "consider using a DTO". Every line reads as equally important, so in practice none of them is, and an agent under pressure to finish treats all of them as optional.

RFC 2119 defines the requirement keywords used in internet standards. Kanon uses all five, MUST, MUST NOT, SHOULD, SHOULD NOT and MAY, and none of the RFC's synonyms such as REQUIRED or RECOMMENDED. It states what each one costs the agent:

MARKDOWN
- **MUST / MUST NOT**: absolute. Never violate one, never "adapt" it to the project. If a MUST cannot be satisfied (missing package, framework limitation), stop and tell the user instead of quietly deviating. - **SHOULD / SHOULD NOT**: follow unless there is a concrete, stated reason not to. Every deviation gets one sentence of justification in your summary to the user. - **MAY**: permitted, use judgment.

The important line is the one about a MUST that cannot be met: stop and say so. Without it, an agent that hits a missing package or a framework limit bends the rule quietly and reports success. With it, the conflict comes back to you.

The keywords also force the author to decide. Writing "MUST" means accepting that the rule has no exceptions. Kanon's 10 reference files have 178 lines with a MUST or MUST NOT, 12 with a SHOULD, and 14 with a MAY. That ratio is a choice: most of the doctrine is not up for negotiation, and the few places with room for judgment are marked.

The rulebook: read before writing, routed by the task

A rulebook loaded in full before every edit is too long to apply with equal attention. Kanon splits the doctrine into 10 reference files and gives the agent a table that maps the task to the files:

You are writing

Read

A new feature, module, or slice

references/architecture.md plus the rows below that apply

Controllers, handlers, jobs, listeners, console commands, services

references/orchestration-di.md

Models, enums, DTOs, events, exceptions, naming decisions

references/models-domain.md

Auth checks, ownership, permissions, guards

references/authorization.md

Tests

references/testing.md

The full table has ten rows. An agent writing a queue job reads orchestration-di.md, and an agent writing a test reads testing.md. Each file stays short enough to apply in full: orchestration-di.md, the longest, is 131 lines.

A rule inside one of those files reads like this:

MARKDOWN
- An orchestrator **MUST NOT**: - contain business logic (calculations, eligibility decisions, status derivation, interpreting vendor data vocabularies); - mutate model state directly (`$model->forceFill(...)->save()`, attribute assignment) instead of calling a domain method that owns the change; - create related records inline (looping over children calling `create()`) instead of one aggregate method; - call an external system (HTTP, filesystem, PDF, mail transport) directly instead of a dedicated infrastructure class.

An orchestrator here is a class whose only job is to coordinate: a controller, a command handler, a job, a listener. The rule names what it may not do in terms concrete enough to check, and the examples (forceFill(...)->save(), create() in a loop) are what the agent will recognize in its own code.

When the work is done, Kanon asks for one more step: "list any canon rules you could not satisfy and why." The agent's summary then says what it skipped, instead of only what it did.

The auditor: run after writing, severity from the keyword

The Kanon audit reads the same reference files after the code is written. It does not ask an AI how bad each finding feels. The keyword already decided:

MARKDOWN
- **MUST / MUST NOT** violated -> **high**. Non-negotiable; the PR is not canon-compliant until fixed. - **SHOULD / SHOULD NOT** deviated without stated justification -> **med**. A deviation with a concrete written justification in code or PR description drops to low with the justification quoted. - **MAY / "consider" guidance** -> **low**, advisory.

The rulebook told the agent to justify every SHOULD deviation in its summary. The auditor looks for a written justification in the code or PR description: a deviation with a written reason drops to low, and one without a reason stays medium.

Because severity comes from the rule's keyword and not from the reviewer, a broken MUST is high in every run. A high finding means a MUST was broken, and the report quotes it.

Why the auditor splits the work by rule family

One reviewer holding ten rule files at once finds the loud violations and misses the structural ones. The audit starts one auditor per rule family instead, in parallel, each a subagent with a single job. Every auditor gets its family's reference file word for word, and the skill says why: "read it yourself and inline it in the prompt, so the auditor cites the actual rule, not a paraphrase."

A finding that cites the exact rule text can be checked against the rule. A finding that cites a summary of a rule can only be argued about. The auditor contract makes it a hard requirement: "Cite a specific rule for every finding. No rule, no finding."

Two more lines in the contract keep the report usable. Repeated mechanical violations collapse into one finding: "when the same rule is broken the same way across many files or lines, report ONE finding citing the rule once and listing the affected files". And each auditor stays in its family: "a rule another family owns is not yours to flag." Without both, a large diff produces a report too long to act on.

The opinionated part: a canon that overrides the project

Kanon does something most rules files avoid. It ignores the project it runs in:

Do not read the project's CLAUDE.md, style guides, or sibling files as a rule source; the canon is the only authority. If following the canon would conflict with something the project does, follow the canon and tell the user about the conflict.

The audit applies the same stance to review: "If the project's convention conflicts with the canon, the canon wins and the conflict is a finding." Its report opens with a line saying so, "so nobody mistakes it for a house-style review."

For my own projects, that is the point. A new Laravel project copies whatever the first few files do, and an agent copies the project. A fixed doctrine that travels from project to project means every new codebase starts from the same rules, including the opinionated ones: PHPUnit over Pest, no route-model binding, unguarded models.

The same stance makes Kanon wrong for most codebases you did not start. The skill says so in its own description: "Do NOT auto-apply this in a codebase with established team standards (e.g. an employer's monorepo) unless the user explicitly asks for the canon there." For a team codebase the audit's own description points to laravel-standards-review, a skill that reviews against the project's own conventions instead. It is in the general/ folder of the skills repo.

What this does not cover

Kanon and its audit check standards. They do not look for bugs, security holes or slow queries, and both skills say so. Kanon: "The canon covers standards, not correctness: keep using normal judgment (and /code-review) for bugs, security, and performance." A pull request with no audit findings can still charge a customer twice.

Where to start

Take your current rules file and rewrite five rules with MUST or SHOULD, each concrete enough that you could point at the line that breaks it. Split them into two or three files by what the agent is writing, and add a table that says which file to read for which task. Then give a second session the same files and one instruction: report every line that breaks a rule, and quote the rule.

The kanon/ folder of the skills repo has both skills in full. Part 4 covers the other half: a project's own rules, routed by file path.