Skip to main content
CodeRabbit reviews code with built-in logic. Instructions add your team’s rules on top. You can write them in several formats, and each format fits a different job.

Choose how to give guidance

Instructions steer comments. They don’t change which files CodeRabbit reviews. To change that, use path filters.

Add path instructions

A path instruction is a glob pattern plus the guidance for files that match it. Each entry takes up to 20,000 characters.
1

Pick a path

Choose a glob such as src/controllers/**. Glob matching follows Minimatch rules, including brace expansion.
2

Write the guidance

Say what to check and what to flag. Concrete rules work better than general advice.
3

Save and test

Apply the change, open a pull request that touches a matching file, and read the review.

Configure

Open Review settings, choose Organization defaults or a repository, and set View mode to All Settings. Go to Reviews > General and find Path instructions. Select Apply changes and confirm.

Store instructions as documents

Instruction documents keep the same guidance as Markdown files with front matter. They apply alongside inline YAML entries, and you can use both. A document has no mode or report field, so it guides the review without its own check result. Use a custom check when you want one. For the front matter fields, documents in nested directories, and moving entries out of YAML, see Instruction and check documents.

Generate path instructions from past reviews

Comment @coderabbitai emit path instructions on a pull request. CodeRabbit collects suggestions from the past 7 days and opens a pull request that adds them to .coderabbit.yaml without overwriting existing entries. See the command reference.

Add syntax-aware rules with ast-grep

ast-grep rules match code by its syntax tree instead of by path. Each rule is a YAML file that sets its own language and pattern, and you point CodeRabbit at your rule directories or shared rule packages under reviews.tools.ast-grep. CodeRabbit runs the rules during automated reviews, not in chat. See ast-grep to write rules, use packages, and check the supported file types.

Limits and availability

  • Each path instruction is limited to 20,000 characters.
  • CodeRabbit inserts instruction text into the review as you wrote it. Backticks, ${} and backslashes aren’t interpreted or removed.
  • Only the path glob is parsed. If a glob is invalid, CodeRabbit skips that entry.
  • Path instructions don’t affect other features that read the same code. Unit test generation has its own code_generation.unit_tests.path_instructions list.
  • A path instruction that matches a guideline file such as CLAUDE.md applies only when a pull request changes that file. It doesn’t load the file as a guideline. Use code guidelines.
  • Schema V3 is a limited preview.

Troubleshoot

  • An instruction has no visible effect: confirm the file matched the glob and wasn’t removed by path filters, then print the resolved settings with Check which configuration a review used.
  • Both a YAML entry and a document cover the same files: CodeRabbit applies both. Remove the one you no longer want.
All settings: reviews.path_instructions and reviews.tools.ast-grep in the configuration reference.

What’s next

Write review instructions that work

Turn a vague rule into one CodeRabbit follows.

Instruction and check documents

Put instructions in .coderabbit/.

Code guidelines

Reuse the standards files your team already keeps.