Skip to main content
A monorepo usually needs one set of repository-wide settings and a few rules that apply to a single package. This guide shows how to scope instructions, filters and tool configuration per package, and how to vary settings by the files a pull request changes.

Before you start

Scope instructions per package

Put a .coderabbit/instructions/ folder next to each package that needs its own rules. Patterns are relative to the directory that contains .coderabbit/.
1

Create the package folder

Add services/api/.coderabbit/instructions/ and a document with a unique id.
2

Write package-relative patterns

In services/api/.coderabbit/instructions/api-security.md, the pattern src/** means services/api/src/**.
3

Pick IDs on purpose

A nested document with the same kind and ID as a parent replaces the parent for that package. Use a different ID to add a rule next to the parent.
Nested documents add no level to the settings hierarchy and don’t need inheritance: true. See Inheritance and merging.
On providers without directory documents, scope the same rule in the configuration file.

Filter files per package

Path filters apply to the whole repository. Use exclusions alone so every other file stays eligible. A single include pattern turns the list into an allowlist, unless it exactly matches a default exclusion. An exclusion always wins regardless of order.
The default exclusions for generated code match directories named gen or generated at any depth. To review hand-written code in such a directory, add its exact default pattern without the !, for example **/gen/**.

Use per-package tool configuration files

Without config_file, ESLint keeps the configuration files that sit in a directory with a reviewed file. A nested config such as packages/web/.eslintrc.js applies only to files under packages/web/, in addition to any parent configuration. See Tools for each tool’s settings.

Vary settings by changed paths

In a TypeScript configuration, ctx.pr.changedFiles lists the changed paths, including both the old and new path of a rename.
.coderabbit.config.ts
When status isn’t resolved, paths is empty. Treat that case as “unknown” in your logic.

Limit reviews to the branches you merge into

CodeRabbit reviews pull requests that target the default branch. Add the other long-lived branches in base_branches. Each entry is a regular expression, and it isn’t anchored.

Check the result

Open a pull request that touches two packages, then post @coderabbitai configuration. Confirm that each package’s instructions apply to its own files and that the filters match your expectations. See Check which configuration a review used.

What’s next

.coderabbit/ documents

See front matter, nesting rules and limits for instruction and check documents.

Choose which files are reviewed

Learn how path filters and exclusions decide what CodeRabbit reviews.

TypeScript configuration

Adapt configuration to the pull request with the context object.