Why this guide matters
Every engineering team has a “best practices” doc somewhere. The problem is that IDE suggestions don’t read it, reviewers forget the nuances, and the document slowly loses authority. This guide turns your handbook into active guardrails, so Kody enforces those rules on every pull request and points at the section that drifted. We’ll use two building blocks:- Kody Rules – each policy bullet becomes a file-level or PR-level check that references the handbook.
- Custom agents – the handbook is linked as a doc, and every finding quotes the rule it applies.
Pre-flight checklist
- You have permission to edit Code review → Kody Rules.
- The handbook lives in the repo (for example
docs/engineering-standards.md). If yours sits in another path, adjust accordingly. - You know which topics should be evaluated at the file level (controllers, configs) versus PR level (feature flags, rollout narratives, architecture).
Keep the handbook under version control. Rules and agents read it from the branch a pull request targets, so every edit goes through a pull request with owners who sign off.
Phase 1 – Shape a rule-friendly policy pack
- Create or reuse a markdown file such as
docs/engineering-standards.md. - Organize content into short, checkable bullets:
Phase 2 – Point every rule at the real document
Reference the actual handbook instead of pasting snippets in each instruction.- Swap in other file paths for domain-specific packs (for example
@file:docs/mobile.md). - Need only a slice of the file? Append line anchors, like
@file:docs/engineering-standards.md#L40-L72, so the rule consumes just that section.
One reference keeps everything in sync. Update the handbook once and every rule enforces the latest version.
Phase 3 – Translate sections into Kody Rules
In the sidebar, open Code review → Kody Rules. On the Review Rules tab, click New rule and map each policy section to the right execution mode and path.File-level example
PR-level example
Rules understand variables (
fileDiff per file, pr_files_diff and the other pr_* variables per PR) and file references. See the Kody Rules guide for the full list.Phase 4 – Or give the handbook to a custom agent
A custom agent reads the handbook as a linked doc and has to quote the rule behind each finding. A quote that isn’t in the doc on the target branch is dropped. Custom agents are in beta, on Teams and Enterprise plans and during the trial; self-hosted Kodus also needsBETA_FEATURES=true.
1
Create the agent
In Code review → What to review → Custom agents, click New agent → Templates → Blank. Name it Engineering standards.
2
Link the handbook
Under Files & knowledge → Skills & docs, click Add skill or doc → Add by path and enter
docs/engineering-standards.md. A doc loads whole on every review, so keep it short. A long handbook works better as a skill with reference files.3
Write the instructions
4
Try it, then turn it on
Run Try it on a pull request that breaks a rule. Each comment cites the rule as Rule (
docs/engineering-standards.md) with the quoted bullet.Phase 5 – Test, observe, and keep it alive
Seed a verification PR
Seed a verification PR
Create a throwaway PR that violates each section and let Kody review it (comment
@kody start-review if it hasn’t started). Check that the inline and PR-level comments cite the right bullets. Run the agent on demand with @kody -v engineering-standards.Tune noise and severity
Tune noise and severity
During rollout, watch how often each rule fires. Tighten file globs, add exclusions, or adjust severity until the signal meets expectations.
Update docs and rules together
Update docs and rules together
Whenever the handbook changes, update the markdown and the related rules or agent instructions in the same PR so reviewers can validate the entire pipeline.
Quick checklist
-
docs/engineering-standards.mdexists with scannable bullets. - Every rule references the policy pack with
@file, so it reads the latest text. - File-level and PR-level Kody Rules cover your critical sections.
- Optional: a custom agent follows the handbook and quotes it.
- A dry-run PR confirmed the inline comments and PR summary before broad rollout.