Skip to content

Commit d01fee9

Browse files
authoredMay 23, 2025··
Expand and refactor the code-review docs (#355)
* Split the current chat commands page into three pages: a reference page, a troubleshooting guide, and a best practices guide. Replace the chat commands page with two task-orience how-to guides, one about controlling code reviews, and one about generating improvements. Add a new overview page for the code review process.
1 parent e2e3084 commit d01fee9

File tree

7 files changed

+422
-60
lines changed

7 files changed

+422
-60
lines changed
 
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Code review best practices
3+
description: Best practices for managing CodeRabbit code reviews.
4+
sidebar_label: Best practices
5+
---
6+
7+
This page lists best practices for performing code reviews with CodeRabbit.
8+
9+
For more information about working with
10+
CodeRabbit through chat, see [Control and manage code reviews](/guides/commands).
11+
12+
For a CodeRabbit command reference, see [Code review command reference](/reference/review-commands).
13+
14+
## Recommended code-review workflow
15+
16+
- Start with `@coderabbitai review` for checking new changes.
17+
- Use `@coderabbitai full review` when major changes require a fresh perspective.
18+
- Generate summaries after significant updates using `@coderabbitai summary`.
19+
20+
## Managing large changes
21+
22+
- Use `@coderabbitai pause` before making multiple commits.
23+
- Resume reviews with `@coderabbitai resume` when ready.
24+
- Consider `@coderabbitai full review` after substantial changes.
25+
26+
## Documentation flow
27+
28+
- Run `@coderabbitai generate docstrings` after finalizing function implementations.
29+
- Learn more about [docstring generation](/finishing-touches/docstrings).
30+
31+
## Overall tips
32+
33+
- Commands are case-insensitive (`@coderabbitai REVIEW` works the same as `@coderabbitai review`).
34+
- Commands can be issued by anyone with write access to the repository.
35+
- Multiple commands can be used in sequence as needed.
36+
- Use `@coderabbitai configuration` to export your settings before making changes.
37+
38+
## Command response time
39+
40+
- Most commands (pause, resume, ignore) take effect immediately.
41+
- Review commands typically complete within a few minutes, depending on PR size.
42+
- Docstring generation time varies based on the number of functions.

‎docs/guides/code-review-overview.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Review pull requests
3+
description: An overview of CodeRabbit's core code review features.
4+
sidebar_label: Overview
5+
---
6+
7+
The central feature of CodeRabbit is its ability to proactively review
8+
new pull requests on your code repository.
9+
10+
CodeRabbit reviews take the form of pull request comments that
11+
include summaries, analyses, and initial critiques of the proposed changes.
12+
This information, usually added to pull requests within minutes, can help your team perform more rapid, better-informed code reviews.
13+
14+
The following sections present an overview of this feature. For a hands-on example that lets you experience a CodeRabbit code review using
15+
a real repository, see [Quickstart](/getting-started/quickstart).
16+
17+
## Automatically review pull requests {#review}
18+
19+
After you [integrate CodeRabbit with your repository](/platforms), CodeRabbit proceeds
20+
to automatically review every subsequent pull request, as soon as each one is created.
21+
22+
CodeRabbit performs code reviews by attaching comments to the pull request.
23+
These comments contain detailed summaries and analyses of the changes,
24+
as well as listing out problems or areas for potential improvement that it found.
25+
26+
CodeRabbit uses [a variety of open-source linters and security tools](/tools) and a custom
27+
code verification agent to provide this analysis. CodeRabbit
28+
also consults several models to further analyze and critique the proposed changes,
29+
using all of the content of your repository as context. The code-review comment that CodeRabbit attaches
30+
to your pull request synthesizes and summarizes all of the information collected from these different sources.
31+
32+
For more information about the graph analysis that CodeRabbit includes with its reviews
33+
when available, see [CodeRabbit Code Graph Analysis](/integrations/code-graph-analysis).
34+
35+
### Events that trigger automated reviews {#events}
36+
37+
By default, the following activity in your repository triggers CodeRabbit to
38+
perform a code review:
39+
40+
- If CodeRabbit sees a new pull request, then it immediately performs a full review
41+
of the proposed code changes.
42+
- If an open pull request that CodeRabbit has already reviewed gets modified with another
43+
commit, then CodeRabbit performs an incremental review that focuses on the new commit.
44+
45+
## Interact with CodeRabbit reviews {#interact}
46+
47+
After CodeRabbit attaches its initial code-review comment to a pull request, you can
48+
directly interact with CodeRabbit by mentioning its username, `@coderabbitai`, in comments
49+
that you post to the pull request.
50+
51+
These interactions can serve several purposes:
52+
53+
- Free-form discussion about the pull request and the ongoing code review.
54+
- Commands to have CodeRabbit perform specific actions regarding the code review.
55+
- Prompts to have CodeRabbit generate its own improvements to the branch under review.
56+
57+
### Chat with CodeRabbit {#chat}
58+
59+
You can have open-ended, natural-language discussion with CodeRabbit during a code review, treating it
60+
as an LLM-powered chatbot that has your entire code repository available for context. For more information, see [CodeRabbit Chat](/guides/agent_chat).
61+
62+
### Manage CodeRabbit review behavior {#manage}
63+
64+
CodeRabbit recognizes a variety of keyword-based commands that let you control its
65+
behavior during a code review, including the following:
66+
67+
- Pause or resume automated reviews of the pull request.
68+
- Manually request a review, when automated reviews are paused.
69+
- Resolve all open comments authored by CodeRabbit.
70+
71+
For more information, see [Control and manage code reviews](/guides/commands).
72+
73+
### Generate improvements {#generate}
74+
75+
You can command CodeRabbit to generate improvements to the branch under review.
76+
CodeRabbit accomplishes this by publishing a new branch based on the branch under review,
77+
and creating a new pull request for your own review.
78+
79+
Available code-generation commands let you request the following from CodeRabbit:
80+
81+
- Implement the suggestions for improvements that CodeRabbit has made in its earlier code review comments.
82+
- Generate inline documentation for any undocumented functions that this pull request proposes to add.
83+
84+
For more information, see [Generate improvements](/guides/generate-improvements).
85+
86+
## What's next {#whats-next}
87+
88+
- [Control and manage code reviews](/guides/commands)
89+
- [Generate code improvements](/guides/generate-improvements)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Code review troubleshooting
3+
description: Troubleshooting CodeRabbit code reviews.
4+
sidebar_label: Troubleshooting
5+
---
6+
7+
This page is about troubleshooting interactive code review sessions with CodeRabbit. For more information about working with
8+
CodeRabbit through chat, see [Control and manage code reviews](/guides/commands).
9+
10+
If a CodeRabbit command doesn't seem to work:
11+
12+
1. Check that you have the necessary repository permissions.
13+
2. Verify the command syntax.
14+
3. Look for any response from CodeRabbit in the PR comments.
15+
4. Use `@coderabbitai help` for command guidance.
16+
17+
Need help? Join our community on [Discord](https://discord.gg/coderabbit) or [contact our support team](/getting-started/support).

‎docs/guides/commands.md

Lines changed: 120 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,92 +3,152 @@ title: Control and manage code reviews
33
description: Learn how to control CodeRabbit using commands in pull request comments
44
---
55

6-
# CodeRabbit Commands
6+
This page is about issuing direct commands to CodeRabbit during code reviews.
7+
For a general overview of performing code reviews with CodeRabbit, see [Review pull requests](/guides/code-review-overview).
78

8-
> Control your code reviews directly from pull request comments using CodeRabbit's command system. Each command starts with `@coderabbitai` followed by the specific action you want to take.
9+
You can control CodeRabbit's behavior with a specific pull request by mentioning the
10+
username of its bot, `@coderabbitai`, alongside keywords in comments or the pull
11+
request description, as specified by the next sections of this page.
912

10-
## Review Control Commands
13+
For a complete CodeRabbit command reference, see [Code review command reference](/reference/review-commands).
1114

12-
### Managing Reviews
15+
## Control automatic code reviews {#flow}
1316

14-
| Command | Description | Use Case |
15-
| --------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------- |
16-
| `@coderabbitai review` | Triggers an incremental review of new changes | When automatic reviews are disabled or you want to manually trigger a review |
17-
| `@coderabbitai full review` | Performs a complete review of all files from scratch | When you want to get fresh insights on the entire PR |
18-
| `@coderabbitai summary` | Regenerates the PR summary | When you want an updated overview after making changes |
17+
By default, CodeRabbit automatically reviews every new pull request created in
18+
your repository. It updates its review with comments whenever the pull request has new commits
19+
pushed to it.
1920

20-
### Review Flow Control
21+
The following sections show you how to tell CodeRabbit to modify this behavior with
22+
a specific pull request, such as pausing reviews, or resolving open comments.
2123

22-
| Command | Description | Use Case |
23-
| ---------------------- | ---------------------------------------- | --------------------------------------------------- |
24-
| `@coderabbitai pause` | Temporarily stops reviews on the PR | When you're making multiple rapid changes |
25-
| `@coderabbitai resume` | Restarts reviews after a pause | When you're ready for CodeRabbit to review again |
26-
| `@coderabbitai ignore` | Permanently disables reviews for this PR | When you want to handle the review process manually |
24+
For more information about permanently configuring the behavior of CodeRabbit on
25+
your repository, see [Add a configuration file](/getting-started/configure-coderabbit).
2726

28-
### Comment Management
27+
### Pause and resume automatic code reviews {#pause-resume}
2928

30-
| Command | Description | Use Case |
31-
| ----------------------- | --------------------------------------- | ------------------------------------------------------- |
32-
| `@coderabbitai resolve` | Resolves all CodeRabbit review comments | When you've addressed all feedback and want to clean up |
29+
You can tell CodeRabbit to pause its automatic reviews of a pull request. If
30+
you do, then you can still manually request CodeRabbit to review changes using
31+
the commands listed on [Code review command reference](/reference/review-commands).
3332

34-
### Documentation Commands
33+
To pause automated reviews of a pull request, post the following comment to the
34+
pull request:
3535

36-
| Command | Description | Use Case |
37-
| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- |
38-
| `@coderabbitai generate docstrings` | Generates docstrings for functions in the PR | When you need automatic documentation for your code |
39-
| `@coderabbitai configuration` | Shows current CodeRabbit settings | When you need to check or export your configuration |
36+
```text
37+
@coderabbitai pause
38+
```
4039

41-
### Agentic Chat Commands
40+
To resume automated reviews after pausing them, post the following comment to the
41+
pull request:
4242

43-
| Command | Description | Use Case |
44-
| -------------------- | ---------------------------------------------------------- | ---------------------------------------------------- |
45-
| `@coderabbitai plan` | Get the agentic chat to plan an edit for previous comments | When you want CodeRabbit to change your code for you |
43+
```text
44+
@coderabbitai resume
45+
```
4646

47-
### Help & Support
47+
### Disable automatic code reviews {#ignore}
4848

49-
| Command | Description | Use Case |
50-
| -------------------- | ------------------------------------------ | ------------------------------------------ |
51-
| `@coderabbitai help` | Displays available commands and usage info | When you need guidance on using CodeRabbit |
49+
To disable automatic code reviews for a pull request, add the following line
50+
anywhere in the pull request description:
5251

53-
## Best Practices
52+
```text
53+
@coderabbitai ignore
54+
```
5455

55-
### Review Workflow
56+
As long as that text remains in the description, CodeRabbit will not
57+
automatically review any commits associated with that pull request.
58+
You can still [chat with CodeRabbit](/guides/agent_chat) and issue other commands in the pull
59+
request comments.
5660

57-
- Start with `@coderabbitai review` for checking new changes
58-
- Use `@coderabbitai full review` when major changes require a fresh perspective
59-
- Generate summaries after significant updates using `@coderabbitai summary`
61+
To enable automatic reviews on that pull request, delete "`@coderabbitai ignore`"
62+
from the pull request description. CodeRabbit commences automatic reviews starting with
63+
the next commit made to the branch under review.
6064

61-
### Managing Large Changes
65+
## Manually request code reviews {#request}
6266

63-
- Use `@coderabbitai pause` before making multiple commits
64-
- Resume reviews with `@coderabbitai resume` when ready
65-
- Consider `@coderabbitai full review` after substantial changes
67+
You can ask CodeRabbit to perform a code review at any time. This can be useful
68+
when you have paused automated code reviews. Manually requested reviews have
69+
two types:
6670

67-
### Documentation Flow
71+
- A _full review_ disregards any comments that CodeRabbit has already made
72+
on this pull request, and generates a complete review of the entire pull request.
6873

69-
- Run `@coderabbitai generate docstrings` after finalizing function implementations
70-
- Learn more about [docstring generation](/finishing-touches/docstrings)
74+
- An _incremental review_ takes all comments that CodeRabbit has made since its most recent full review into consideration, and generates a review of only the new changes.
7175

72-
## Tips
76+
To manually request a full review, post the following comment to the
77+
pull request:
7378

74-
- Commands are case-insensitive (`@coderabbitai REVIEW` works the same as `@coderabbitai review`)
75-
- Commands can be issued by anyone with write access to the repository
76-
- Multiple commands can be used in sequence as needed
77-
- Use `@coderabbitai configuration` to export your settings before making changes
79+
```text
80+
@coderabbitai full review
81+
```
7882

79-
## Command Response Time
83+
To manually request an incremental review, post the following comment to the
84+
pull request:
8085

81-
- Most commands (pause, resume, ignore) take effect immediately
82-
- Review commands typically complete within a few minutes, depending on PR size
83-
- Docstring generation time varies based on the number of functions
86+
```text
87+
@coderabbitai review
88+
```
8489

85-
## Troubleshooting
90+
## Resolve comments {#resolve}
8691

87-
If a command doesn't seem to work:
92+
To have CodeRabbit mark all of its previous comments as resolved, post the following comment to the
93+
pull request:
8894

89-
1. Check that you have the necessary repository permissions
90-
2. Verify the command syntax
91-
3. Look for any response from CodeRabbit in the PR comments
92-
4. Use `@coderabbitai help` for command guidance
95+
```text
96+
@coderabbitai resolve
97+
```
9398

94-
Need help? Join our community on [Discord](https://discord.gg/coderabbit) or contact our support team.
99+
## Update information about the pull request {#update}
100+
101+
The commands in this section request CodeRabbit to generate and post updated information
102+
about the pull request itself.
103+
104+
### Update the summary text {#summary}
105+
106+
To have CodeRabbit update the generated summary of the branch’s proposed changes
107+
to the pull request’s description, post the following comment:
108+
109+
```text
110+
@coderabbitai summary
111+
```
112+
113+
CodeRabbit updates the summary text to the description under the heading
114+
"Summary by CodeRabbit".
115+
116+
### Diagram the pull request history {#diagram}
117+
118+
To have CodeRabbit post a comment that contains a sequence diagram which visualizes the
119+
history of the pull request under review, post the following comment:
120+
121+
```text
122+
@coderabbitai generate sequence diagram
123+
```
124+
125+
## Get information about CodeRabbit {#info}
126+
127+
The commands in this section request CodeRabbit to display its own configuration
128+
or documentation.
129+
130+
### Display current configuration {#config}
131+
132+
To have CodeRabbit post a comment listing out its current configuration
133+
with your repository, post the following comment to the
134+
pull request:
135+
136+
```text
137+
@coderabbitai configuration
138+
```
139+
140+
### Display a quick-reference guide {#help}
141+
142+
To have CodeRabbit post a comment to the pull request with a quick-reference
143+
guide to its own commands and other features, post the following comment to the
144+
pull request:
145+
146+
```text
147+
@coderabbitai help
148+
```
149+
150+
## What's next {#whats-next}
151+
152+
- [Generate code improvements](/guides/generate-improvements)
153+
- [Best practices](/guides/code-review-best-practices)
154+
- [Troubleshooting](/guides/code-review-troubleshooting)

‎docs/guides/generate-improvements.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: Generate improvements
3+
description: Request coderabbit to generate its own code improvements during code reviews
4+
---
5+
6+
```mdx-code-block
7+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
8+
9+
<ProPlanNotice />
10+
```
11+
12+
This page is about using CodeRabbit to generate improvements to code under review.
13+
14+
For a general overview of performing code reviews with CodeRabbit, see [Review pull requests](/guides/code-review-overview).
15+
16+
## Overview of CodeRabbit code generation {#overview}
17+
18+
:::note
19+
This feature is available only on GitHub.
20+
:::
21+
22+
You can request CodeRabbit to generate improvements to a branch that it is currently reviewing.
23+
24+
To do this, write out your request prompt in a comment addressed to `@coderabbitai`,
25+
such as with the following examples:
26+
27+
- `@coderabbitai Please implement the changes you suggested in your code review.`
28+
- `@coderabbitai Add input validation with proper error messages to these new functions.`
29+
- `@coderabbitai Break this large function into smaller, more focused methods.`
30+
31+
In addition to this kind of free-form request, you can also give CodeRabbit keyword-based
32+
commands for common code-generation requests, as described in [Code generation commands](#commands).
33+
This includes the `plan` keyword, which acts as shorthand for the first prompt on the
34+
previous list.
35+
36+
After you give it a code-generation prompt or command, CodeRabbit delivers its suggested improvements by taking these steps:
37+
38+
1. CodeRabbit posts a comment or two to the pull request, detailing its improvement plans.
39+
1. CodeRabbit publishes a new branch, based on the open pull request's branch, to the remote repository.
40+
1. CodeRabbit opens a new pull request based on this new branch, and links to it from the original pull request.
41+
42+
CodeRabbit doesn't make any further changes to the new branch or to the new pull request
43+
after it creates them. From that point on, it's fully up to you what to do with the new, suggested-change branch.
44+
45+
The best practice is to effectively take ownership of the new branch for yourself,
46+
deciding whether it's worth merging into the original pull request branch, and making
47+
any further updates you'd like to make first. You can use comments in the new branch
48+
to ask CodeRabbit to explain its changes, if needed, or to otherwise converse with
49+
CodeRabbit about the suggested improvements.
50+
51+
Because it's just an ordinary Git branch, the presence of the suggested-change branch
52+
doesn't block the ongoing code review in the original pull request branch. You are
53+
free to merge, defer, or close the suggested-change pull request that CodeRabbit made, using any method or timing that fits
54+
your workflow.
55+
56+
## Code generation commands {#commands}
57+
58+
This section lists short commands that you can give CodeRabbit to have it accomplish
59+
common code-generation tasks. For more complex tasks, you can instead write out full
60+
prompts, as described in the previous section.
61+
62+
For a complete CodeRabbit command reference, see [Code review command reference](/reference/review-commands).
63+
64+
### Generate inline documentation {#docstrings}
65+
66+
To have CodeRabbit generate missing documentation for function code added by
67+
the pull request, post the following comment to the
68+
pull request:
69+
70+
```text
71+
@coderabbitai generate docstrings
72+
```
73+
74+
For more information about how CodeRabbit can generate inline documentation, including
75+
the Git platforms and programming languages that this feature supports, see
76+
[Docstrings](/finishing-touches/docstrings).
77+
78+
### Generate solutions to open review comments {#plan}
79+
80+
To have CodeRabbit generate and add a new repository branch with code improvements
81+
that try to address its own code review comments, post the following comment to the
82+
pull request:
83+
84+
```text
85+
@coderabbitai plan
86+
```
87+
88+
Using this keyword is essentially shorthand for writing out a prompt like the following:
89+
90+
```text
91+
@coderabbitai Implement the changes that you suggested and apply them to this pull request.
92+
```
93+
94+
If you want to give CodeRabbit more specific implement instructions other than a general
95+
request to implement its own suggestions, then you can write out those instructions
96+
as a full prompt, instead of using the one-word `plan` command.
97+
98+
## What's next {#whats-next}
99+
100+
- [Control and manage code reviews](/guides/commands)
101+
- [Best practices](/guides/code-review-best-practices)
102+
- [Troubleshooting](/guides/code-review-troubleshooting)

‎docs/reference/review-commands.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Code review commands
3+
description: A list of commands that you can issue to CodeRabbit during code reviews.
4+
---
5+
6+
This page lists the various commands that you can issue to CodeRabbit through
7+
its chat interface during code reviews. For more information about working with
8+
CodeRabbit through chat, see [Interact with CodeRabbit reviews](/guides/code-review-overview#interact).
9+
10+
| Command | Description | Use Case |
11+
| --------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------- |
12+
| `@coderabbitai review` | Triggers an incremental review of new changes | When automatic reviews are disabled or you want to manually trigger a review |
13+
| `@coderabbitai full review` | Performs a complete review of all files from scratch | When you want to get fresh insights on the entire PR |
14+
| `@coderabbitai summary` | Regenerates the PR summary | When you want an updated overview after making changes |
15+
16+
## Code review flow control
17+
18+
| Command | Description | Use Case |
19+
| ---------------------- | ---------------------------------------- | --------------------------------------------------- |
20+
| `@coderabbitai pause` | Temporarily stops reviews on the PR | When you're making multiple rapid changes |
21+
| `@coderabbitai resume` | Restarts reviews after a pause | When you're ready for CodeRabbit to review again |
22+
| `@coderabbitai ignore` | Permanently disables reviews for this PR | When you want to handle the review process manually |
23+
24+
## Comment management
25+
26+
| Command | Description | Use Case |
27+
| ----------------------- | --------------------------------------- | ------------------------------------------------------- |
28+
| `@coderabbitai resolve` | Resolves all CodeRabbit review comments | When you've addressed all feedback and want to clean up |
29+
30+
## Documentation commands
31+
32+
| Command | Description | Use Case |
33+
| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- |
34+
| `@coderabbitai generate docstrings` | Generates docstrings for functions in the PR | When you need automatic documentation for your code |
35+
| `@coderabbitai configuration` | Shows current CodeRabbit settings | When you need to check or export your configuration |
36+
37+
## Agentic chat commands
38+
39+
| Command | Description | Use Case |
40+
| -------------------- | ---------------------------------------------------------- | ---------------------------------------------------- |
41+
| `@coderabbitai plan` | Get the agentic chat to plan an edit for previous comments | When you want CodeRabbit to change your code for you |
42+
43+
## Help and support
44+
45+
| Command | Description | Use Case |
46+
| -------------------- | ------------------------------------------ | ------------------------------------------ |
47+
| `@coderabbitai help` | Displays available commands and usage info | When you need guidance on using CodeRabbit |

‎sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ const sidebars: SidebarsConfig = {
8484
collapsed: true,
8585
label: "Review pull requests",
8686
items: [
87+
"guides/code-review-overview",
8788
"guides/commands",
89+
"guides/generate-improvements",
90+
"guides/code-review-best-practices",
91+
"guides/code-review-troubleshooting",
8892
"guides/agent_chat",
8993
{
9094
type: "category",
@@ -140,6 +144,7 @@ const sidebars: SidebarsConfig = {
140144
label: "CodeRabbit API",
141145
href: "https://api.coderabbit.ai/api/swagger/",
142146
},
147+
"reference/review-commands",
143148
{
144149
type: "category",
145150
label: "Supported tools",

0 commit comments

Comments
 (0)
Please sign in to comment.