Creating a rule in Kodus
- Pick Global (or a repository / directory) in the scope picker at the top of the Code review group in the sidebar, then open Kody Rules
- Click New rule
- Configure:
- Rule name — what the rule checks (e.g., “Service files must have tests”)
- Execution mode — Per file (analyzes each changed file) or Per PR (analyzes the entire PR)
- Path — glob pattern to target specific files (e.g.,
src/services/**/*.ts); not used by Per PR rules - Severity — Critical, High, Medium, or Low
- Instructions — detailed description of what to check
What makes rules powerful
Rules can access rich context:- Variables like
fileDiff,pr_title,pr_description,pr_files_diff - File references with
@file:path/to/file.tsto compare against patterns - MCP functions to fetch data from connected tools (Jira, repository structure, etc.)
Example: Architecture boundary rule
Example: Test coverage rule
More ways to add rules
- Import from Rules Library — click Discovery on the Kody Rules page to browse proven rules by language and category
- Sync from IDE tools — auto-import rules from Cursor, Copilot, Claude
- Repository rules — define rules in markdown files in your repo
- Auto-generation — Kody suggests rules based on your review history