How to Use Gemini for Code Review
Leverage Gemini CLI to perform thorough, consistent code reviews that catch bugs, suggest improvements, and enforce coding standards automatically.
- 1
Set Up a Code Review Skill
Create a .gemini/skills/code-review/ directory with a SKILL.md that defines your team's review standards, coding conventions, and common anti-patterns to flag.
- 2
Review Individual Files
Open Gemini in your project and ask it to review specific files. Provide context about the change purpose so the review focuses on relevant concerns.
- 3
Review Git Diffs
Use 'gemini review --diff' to analyze staged changes or compare branches. Gemini will focus on the changed code and provide targeted feedback on the modifications.
- 4
Define Custom Review Criteria
Customize your review skill to check for security vulnerabilities, performance issues, accessibility compliance, or domain-specific patterns relevant to your project.
- 5
Integrate with Pull Requests
Set up a CI/CD step that runs Gemini code review on pull requests automatically. Post review comments directly to the PR using GitHub Actions or similar tools.