Overview
Use CodeRabbit with Googleโs Gemini CLI in a full agentic loop. Code with Gemini, review the changes with CodeRabbit, and fix the issues with Gemini. In this quick guide, youโll learn how to prompt Gemini, what CodeRabbit commands to run, and what to add to your Gemini.md file.Video demo
Prerequisites
Install the Gemini CLI
Install the Gemini CLI following the platform-specific instructions. Login in, and check that you can launch Gemini from your terminal.
Install CodeRabbit CLI
Install the CodeRabbit CLI globally on your system:Restart your shell:
Terminal command
Terminal command
Use CodeRabbit as part of building new features
CodeRabbit usage instructions for Gemini CLI
Add the following to your Gemini.md file:Feel free to customize the prompt to your needs. In general you want to convey:
Prompt for Gemini.md file
- How to run CodeRabbit, i.e. using the
--prompt-onlyflag and that itโs a CLI tool already installed. - That itโs a long running task and may take a while. Otherwise it may time out.
- Any guidelines for how you want Gemini to review and implement the changes. i.e. fix only critical issues.
- Some agents run CodeRabbit multiple times, so let them know the total number of times it should run.
Request implementation + review
Ask Gemini to implement a feature and run CodeRabbit analysis with issue fixes:
Prompt for Gemini
Agentic step: Gemini implements feature and runs CodeRabbit
Gemini: 1. Implements the requested feature 2. Runs
coderabbit --prompt-only
3. Checks CodeRabbitโs progress periodicallyAgentic step: CodeRabbit analysis and task creation
When CodeRabbit completes, Gemini:
- Reads the
--prompt-onlyoutput - Reviews the issues CodeRabbit surfaced
- Implements the fixes
Optimization tips
Use prompt-only mode for efficiency
When running CodeRabbit manually before Gemini, use--prompt-only for optimal AI agent integration:
- Provides succinct issue context
- Uses token-efficient formatting
- Includes specific file locations and line numbers
- Suggests fix approaches without overwhelming detail
Configure CodeRabbit for Gemini
CodeRabbit automatically reads yourgemini.md file. Add context on how code reviews should run, your coding standards, and architectural preferences. Note this feature is only available on the Pro paid plan.
Troubleshooting
CodeRabbit not finding issues
If CodeRabbit isnโt detecting expected issues:- Check authentication status: Run
coderabbit auth status(authentication improves review quality but isnโt required) - Verify git status: CodeRabbit analyzes tracked changes - check
git status - Consider review type: Use the
--typeflag to specify what to review:coderabbit --type uncommitted- only uncommitted changescoderabbit --type committed- only committed changescoderabbit --type all- both committed and uncommitted (default)
- Specify base branch: If your main branch isnโt
main, use--base:coderabbit --base developcoderabbit --base master
- Review file types: CodeRabbit focuses on code files, not docs or configuration
Managing review duration
CodeRabbit reviews may take 7 to 30+ minutes depending on the scope of changes:- Ensure background execution: Configure Gemini to run CodeRabbit in the background so you can continue working
- Review smaller changesets: Adjust what youโre reviewing to reduce analysis time:
- Use
--type uncommittedto review only uncommitted changes - Work on smaller feature branches compared to main
- Break large features into smaller, reviewable chunks
- Use
- Configure the diff scope: Control what changes are analyzed:
- Review uncommitted changes only: Use
--type uncommittedto analyze just working directory changes - Configure base branch: Use
--base developor--base mainto set the comparison point - Use feature branches: Work on focused feature branches instead of large staging branches
- Review uncommitted changes only: Use