Skip to content
mentoor

Topic 1 of 5 · 4 min read

AI review bots on pull requests

Goal: Configure an AI reviewer's scope and rules and decide which of its comments to act on, dismiss or escalate.

An AI review bot is a tireless first reader that catches mechanical problems; it is not the reviewer who owns the merge. Tools such as GitHub Copilot code review, Claude Code running in GitHub Actions, CodeRabbit or a script you wire to any model comment on a pull request within minutes. Your job is to give it a narrow brief and to triage what it says.

Check yourself · 1 of 3

What is the best first step to stop an AI review bot from flooding pull requests with style nits?

Choose one answer

Why it matters

A bot that comments on everything trains people to ignore it. A bot with no rules repeats the same style nits on every PR. Tuned well, it frees humans to look at design, intent and risk.

How to set one up

  1. Write the scope down. Put it in the file the tool reads: .github/copilot-instructions.md for Copilot, CLAUDE.md for Claude Code. Say what to check (null handling, missing tests, secrets, SQL built from strings) and what to skip (formatting, naming already handled by the linter).
  2. Run linters and tests first. Anything a deterministic tool finds should not be a model's job.
  3. Limit the trigger. Review on opened and on request, not on every push, and skip generated files and lockfiles.
  4. Triage every comment into one of three bins: act on it (real bug, clear fix), dismiss it (wrong, style, already handled), or escalate it (design or security doubt a human must decide).
  5. Keep a human approval. The bot comments; a person approves.

Before and after

Weak instruction file:

Review this code and suggest improvements.

Better:

Review only for: unchecked nulls, missing error handling on I/O,
missing tests for new branches, hard-coded secrets.
Do not comment on formatting or naming; the linter owns those.
Say "no issues found" when there are none. Cite the line.

What goes wrong

  • Noise. Ten low-value comments hide the one that matters.
  • Confident wrong comments. A bot may flag correct code or invent a function that does not exist. Verify before you change anything.
  • Blind spots. Bots read the diff and a little context. They miss intent, business rules, and what the change breaks in files it did not open.
  • Treating silence as approval. "No issues found" means nothing was spotted, not that the change is safe.

Examples

A rule file that cuts noise

A team's bot posted about 15 comments per PR, mostly naming and formatting. They added a rule file listing four risk checks and told it to skip style. Comments per PR dropped, and the ones left were mostly worth reading. The bot did not get smarter; its brief got smaller.

The plausible phantom

A bot comment says: "Use sanitizeInput() from utils/security here." No such helper exists. A reviewer who searches the repo before acting dismisses it. One who trusts it adds an import that fails the build.

Key points

  • Give the bot a written scope: what to check and what to skip, in the file the tool reads.
  • Deterministic checks such as linters and tests run first; the model covers what they cannot.
  • Sort each bot comment into act, dismiss or escalate instead of resolving them all.
  • A bot can flag correct code or cite code that does not exist, so verify before changing anything.
  • A bot comments and a human approves; a clean bot review is not a safe-to-merge signal.

Common mistakes

  • Installing the bot with default settings and no scope file.
  • Applying every suggestion because it sounds confident.
  • Letting the bot replace the human approval.
  • Having the bot comment on style that a linter already enforces.

Check yourself · 2 of 3

A review bot says a PR is fine: 'No issues found.' What does this tell you?

Choose one answer

Check yourself · 3 of 3

A bot comment tells you to call a helper named sanitizeInput(). What should you do before applying it?

Choose one answer

Practice items, not counted towards your mastery.

Start here