Creating a rule in Kodus
- Go to Code Review Settings → Kody Rules
- Click Add Rule
- Configure:
- Name — what the rule checks (e.g., “Service files must have tests”)
- Scope — File-level (analyzes individual files) or PR-level (analyzes the entire PR)
- Path — glob pattern to target specific files (e.g.,
src/services/**/*.ts) - 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 — 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