Quick review with Gemini using smart defaults. Reviews git staged files if no pattern provided, or specific files/patterns if specified. Supports model selection and focus areas.
Reviews code files with Gemini using smart defaults and optional focus areas.
/plugin marketplace add bgreenwell/claude-plugins/plugin install gemini-review@bgreenwell-pluginsQuick, explicit Gemini review with sensible defaults and structured output.
/gemini-review [file-pattern] [--model flash|pro] [--focus area]
file-pattern (optional)
git diff --cached --name-only)src/auth/*, src/auth/login.js, tests/*.test.js--model (optional)
flash (fast, default) or pro (thorough)gemini-2.5-flash--focus (optional)
security, performance, maintainability, testingWhen user invokes this command:
Parse Arguments
Validate Files
Construct Prompt
Execute Review
--output-format jsonParse Results
Format Output
/gemini-review
Behavior: Reviews all files in git staging area
/gemini-review src/auth/login.js src/auth/session.js
Behavior: Reviews just those two files
/gemini-review src/auth/*
Behavior: Reviews all files in src/auth/
/gemini-review src/auth/* --model pro
Behavior: Uses gemini-2.5-pro for thorough review
/gemini-review src/api/* --focus security
Behavior: Reviews API files with security-specific criteria
/gemini-review src/services/processor.js --model pro --focus performance
Behavior: Deep performance analysis with Pro model
When Claude processes this command:
# 1. Determine files to review
if [[ -n "$file_pattern" ]]; then
files="$file_pattern"
else
# Use git staged files
files=$(git diff --cached --name-only | grep -E '\.(js|ts|py|java|go|rb)$' | head -10)
if [[ -z "$files" ]]; then
echo "No staged files found. Specify files to review."
exit 1
fi
fi
# 2. Determine model
model="${model_arg:-gemini-2.5-flash}"
# 3. Build prompt based on focus
if [[ "$focus" == "security" ]]; then
prompt="Perform a security review focusing on:
- SQL injection vulnerabilities
- XSS vulnerabilities
- Authentication/authorization issues
- Input validation
- Sensitive data exposure
Files: @$files"
elif [[ "$focus" == "performance" ]]; then
prompt="Review for performance issues:
- Algorithm efficiency
- Memory usage
- Database query optimization
- Caching opportunities
- Bottlenecks
Files: @$files"
else
# General review
prompt="Review this code for:
- Correctness and logic errors
- Code quality and maintainability
- Potential bugs and edge cases
- Best practices
Files: @$files"
fi
# 4. Execute with JSON output
result=$(gemini -m "$model" -p "$prompt" --output-format json 2>&1)
# 5. Parse JSON (with fallback)
if echo "$result" | jq . > /dev/null 2>&1; then
response=$(echo "$result" | jq -r '.response')
tokens=$(echo "$result" | jq -r '.stats.models | to_entries | map(.value.tokens.total) | add // 0')
else
# Fallback to text if JSON parsing fails
echo "Warning: JSON parsing failed, using text output"
result=$(gemini -m "$model" -p "$prompt" --output-format text)
response="$result"
tokens="N/A"
fi
# 6. Format and display results
echo "Gemini Review Results"
echo "===================="
echo ""
echo "$response"
echo ""
echo "---"
echo "Model: $model"
echo "Tokens used: $tokens"
Gemini Review Results
====================
src/auth/login.js:
✓ Password hashing implementation looks secure
⚠️ Line 42: Consider adding rate limiting for login attempts
⚠️ Line 67: Missing error handling for database connection failures
src/auth/session.js:
✓ Session management follows best practices
❌ Line 89: Session token stored in plain text (use httpOnly cookies)
src/auth/tokens.js:
✓ JWT implementation is correct
⚠️ Line 123: Token expiration should be configurable
Summary:
Files reviewed: 3
Errors: 1
Warnings: 3
Clean checks: 3
Recommendations:
1. Fix session token storage (critical security issue)
2. Add rate limiting to prevent brute force attacks
3. Make token expiration configurable
4. Add database error handling
---
Model: gemini-2.5-flash
Tokens used: 4,523
No files found:
Error: No files to review
- If using default (staged files): No files are currently staged
- If using pattern: No files match pattern 'src/nonexistent/*'
Try:
- Stage files with: git add <files>
- Specify explicit file pattern: /gemini-review src/**/*.js
gemini-cli not found:
Error: gemini-cli not installed
Install:
pip install gemini-cli
Setup:
gemini auth login
Docs: https://github.com/bgreenwell/claude-plugins/tree/main/gemini-review
Authentication error:
Error: gemini-cli not authenticated
Run one of:
gemini auth login
gemini config set api_key YOUR_API_KEY
Then retry: /gemini-review
For Claude:
For Users:
Good Use Cases:
Use Natural Language Instead When:
Use /gemini-batch-review Instead When: