Guide: Configure path instructions in CodeRabbit

Last updated: February 20, 2026

Path instructions allow users to customize how CodeRabbit processes different parts of your codebase. When properly configured, these instructions will guide CodeRabbit's analysis and suggestions for specific file paths or directories.

Setup Path Instructions

  1. Create or edit the .coderabbit.yaml configuration file in the repository root.

  2. Add path instructions to the configuration file. For example:

  code_generation:
    unit_tests:
      path_instructions:
        - path: "**/*.ts"
          instructions: "Use describe blocks"
  1. Save the configuration file and commit these changes.

  2. Test the configuration by requesting unit test generation or other CodeRabbit features in a pull request. Generate unit tests by using the following command:

@coderabbitai generate unit tests

Troubleshooting

When trying to generate unit tests in a pull request with custom path filters, users may encounter the following error:

Agent execution returned an error. Exit code: 1

It indicates that the instructions have illegal characters. When using path instructions, ensure the configuration does not include backtick characters, as these can break the review process. Ensure that the instructions field does not contain:

  • backticks (`)

  • literal syntax (${variable})

  • backslashes (\n, \t, etc)

Further reading

https://docs.coderabbit.ai/guides/review-instructions#path-based-instructions

https://docs.coderabbit.ai/reference/review-commands#summary-and-documentation