Skip to main content

The challenge

In a monorepo, different packages have different standards. Your React frontend cares about component patterns, your NestJS backend cares about dependency injection, and your shared libs care about API stability. A one-size-fits-all review doesn’t work.

Strategy overview

Kodus supports three config levels that map naturally to a monorepo:

Step 1 — Map your packages

Identify the distinct areas in your monorepo and their review needs:

Step 2 — Create directory scopes

Pick the monorepo in the scope picker at the top of the Code review group, open the picker again and choose Add directory scope. Under Select directories, pick one or more package folders that share review settings, then click Add directory scope. Each directory scope appears indented under the repository in the picker — pick it to configure it. Each directory scope can have its own:
  • Kody Rules (file-level and PR-level)
  • What to review (which categories to enable, and the minimum severity to post)
  • Custom agents, added to the repository’s
  • Ignored files (on General)
A pull request uses a directory’s settings when it touches that configured directory and no other configured one. See Directory-Level Settings for how a pull request picks its settings.

Step 3 — Write targeted rules

On Code review → Kody Rules, Review Rules tab, click New rule. A rule created at a directory scope has no Path, so it applies to every file of a pull request reviewed with that directory scope’s settings. A pull request that touches two or more directory scopes, or none, is reviewed with the repository’s settings, and then the rules of every directory scope apply to all its files. Write directory rules so they still hold there, for example by naming the folder in the instructions. See Rule Inheritance. To target part of a package, create the rule at the repository scope with a Path glob.

Frontend rule (scope: the monorepo, with a path)

Backend rule (scope: the apps/api/ directory)

Shared library rule (scope: the libs/shared/ directory)

Step 4 — Use Memories for cross-cutting conventions

Some conventions apply everywhere. Teach them as Memories:

Step 5 — Set the severity threshold per directory

High-traffic packages might need stricter filters. Pick the directory in the scope picker, open What to review, and set Minimum severity to post:
  • apps/web/ — Medium (frontend moves fast)
  • libs/shared/ — Low/All (stability matters)
  • infra/ — High (fewer but critical)
The threshold applies to Kody Rules only when Apply the threshold to Kody Rules is on.

Step 6 — Ignore generated paths

Add monorepo-specific ignores to avoid noise: in Code review → General → Review scope, click Edit under Ignored files, or set them in kodus-config.yml (read only when Prefer kodus-config.yml settings is on for the repository):

Tips

  • Start with 2-3 rules per directory and expand based on what your team actually flags in reviews
  • Use rule inheritance — org-level rules cover security, repo-level covers conventions, directory-level covers architecture
  • If a rule fires too often in one package, narrow its Path or rewrite it at the scope where it was created.
For more on directory scopes, see Directory-Level Settings. For rule inheritance, see Rules Inheritance.