
gemini-cli
Skill that consults Google's Gemini CLI for second opinions, architecture advice, and code reviews.
- version
- 3.12.0
- GitHub stars
- 250
What it does
- Adds the
gemini-cliskill that calls the officialgeminicommand from inside Claude Code, using Gemini's 1M+ token context - Covers architecture decisions, security audits, debugging after failed attempts, code reviews, and large refactor plans
- Offers Flash and Pro model selection (
gemini-2.5-flash,gemini-2.5-pro) and piping file or diff content through the non-interactive-pflag - Designed for critical decisions such as auth, payments, and large multi-file changes, not routine questions Claude can answer alone
Google Gemini CLI for second opinions, architectural advice, code reviews, security audits. Leverage 1M+ context for comprehensive codebase analysis via command-line tool.
Add marketplace
/plugin marketplace add secondsky/claude-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install gemini-cli@claude-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceGemini CLI
Leverage Gemini's 1M+ context window as your AI pair programmer within Claude Code workflows.
This skill teaches Claude Code how to use the official Google Gemini CLI (gemini command) to get second opinions, architectural advice, debugging help, and comprehensive code reviews. Based on production testing with the official CLI tool.
Table of Contents
- Quick Start
- When to Use Gemini Consultation
- Installation
- Model Selection: Flash vs Pro
- Top 3 Use Cases
- Integration Example
- Top 3 Errors & Solutions
- When to Load References
- Production Rules
Quick Start
Prerequisites:
- Gemini CLI installed (
bun add -g @google/gemini-cli) - Authenticated with Google account (run
geminionce to authenticate)
Core Command Patterns:
# Quick question (non-interactive with -p flag)
gemini -p "Should I use D1 or KV for session storage?"
# Code review with file context
cat src/auth.ts | gemini -p "Review this authentication code for security vulnerabilities"
# Architecture advice using Pro model
gemini -m gemini-2.5-pro -p "Best way to handle WebSockets in Cloudflare Workers?"
# With all files in directory
gemini --all-files -p "Review this auth implementation for security issues"
# Interactive mode for follow-up questions
gemini -i "Help me debug this authentication error"
Critical: Always use -p flag for non-interactive commands in automation/scripts.
When to Use Gemini Consultation
ALWAYS Consult (Critical Scenarios)
Claude Code should automatically invoke Gemini in these situations:
-
Major Architectural Decisions
- Example: "Should I use D1 or KV for session storage?"
- Example: "Durable Objects vs Workflows for long-running tasks?"
- Pattern:
gemini -m gemini-2.5-pro -p "[architectural question]"
-
Security-Sensitive Code Changes
- Authentication systems, payment processing, PII handling
- API key/secret management
- Pattern:
cat [security-file] | gemini -m gemini-2.5-pro -p "Security audit this code"
-
Stuck Debugging (2+ Failed Attempts)
- Error persists after 2 debugging attempts
- Stack trace unclear or intermittent bugs
- Pattern:
gemini -p "Help debug: [error message]" < error.log
-
Large Refactors (5+ Files)
- Core architecture changes, database schema migrations
- Pattern:
gemini --all-files -m gemini-2.5-pro -p "Review this refactoring plan"
-
Context Window Pressure (70%+ Full)
- Approaching token limit, need to offload analysis
- Pattern:
cat large-file.ts | gemini -p "Analyze this code structure"
OPTIONALLY Consult
- Unfamiliar Technology - Using library/framework for first time
- Code Reviews - Before committing major changes
Installation
1. Install Gemini CLI
bun add -g @google/gemini-cli
2. Authenticate
gemini
Follow the authentication prompts to link your Google account.
3. Verify Installation
gemini --version # Should show 0.13.0+
gemini -p "What is 2+2?" # Test connection
Model Selection: Flash vs Pro
gemini-2.5-flash (Default)
- Speed: ~5-25 seconds
- Quality: Good for most tasks
- Use For: Code reviews, debugging, quick questions
- Cost: Lower
gemini -m gemini-2.5-flash -p "Review this function for performance issues"
gemini-2.5-pro
- Speed: ~15-30 seconds
- Quality: Excellent, thorough analysis
- Use For: Architecture decisions, security audits, major refactors
- Cost: Higher
gemini -m gemini-2.5-pro -p "Security audit this authentication system"
Quick Decision Guide
Quick question? → Flash
Security/architecture? → Pro
Debugging? → Flash (try Pro if stuck)
Refactoring 5+ files? → Pro
CRITICAL FINDING: Flash and Pro can give opposite recommendations on the same question (both valid, different priorities). Flash prioritizes performance, Pro prioritizes consistency/correctness. For details, load references/models-guide.md.
Top 3 Use Cases
1. Security Audit
# Audit authentication code
cat src/middleware/auth.ts | gemini -m gemini-2.5-pro -p "
Security audit this authentication middleware. Check for:
1. Token validation vulnerabilities
2. Timing attack risks
3. Error handling leaks
4. CSRF protection
5. Rate limiting
"
2. Architecture Decision
# Compare technologies with context
gemini -m gemini-2.5-pro -p "
Context: Building Cloudflare Worker with user authentication.
Question: Should I use D1 or KV for storing session data?
Considerations:
1. Session reads on every request
2. TTL-based expiration
3. Cost under 10M requests/month
4. Deployment complexity
"
3. Debugging Root Cause
# Analyze error logs with context
tail -100 error.log | gemini -p "
These errors started after deploying auth changes. What's the likely root cause?
Context:
- Added JWT validation middleware
- Using @cloudflare/workers-jwt
- Errors only on /api/* routes
"
For more use cases: Load references/models-guide.md for performance optimization, refactoring plans, and code reviews.
Integration Example
Claude Consulting Gemini Automatically
Scenario: User asks architectural question
User: "Should I use D1 or KV for storing user sessions?"
Claude (internal): This is an architectural decision. Consult Gemini for second opinion.
[Runs: gemini -m gemini-2.5-pro -p "Compare D1 vs KV for user session storage in Cloudflare Workers. Consider: read/write patterns, cost, performance, complexity."]
Claude (to user): "I've consulted Gemini for a second opinion. Here's what we both think:
My perspective: [Claude's analysis]
Gemini's perspective: [Gemini's analysis]
Key differences: [synthesis]
Recommendation: [combined recommendation]"
Key Pattern: Synthesize both perspectives, don't just forward Gemini's response.
Top 3 Errors & Solutions
Error 1: Not Authenticated
Error: Error: Not authenticated
Solution:
gemini # Follow authentication prompts
Error 2: Model Not Found
Error: Error: Model not found: gemini-2.5-flash-lite
Cause: Model deprecated or renamed (flash-lite doesn't exist)
Solution: Use stable models only:
gemini -m gemini-2.5-flash -p "Your question"
gemini -m gemini-2.5-pro -p "Your question"
Error 3: Command Hangs
Cause: Interactive mode when expecting non-interactive
Solution: Always use -p flag for non-interactive commands
# ✅ Correct
gemini -p "Question"
# ❌ Wrong (will hang waiting for input)
gemini "Question"
For more troubleshooting: Load references/models-guide.md for rate limits, large file context issues, and performance tips.
When to Load References
Load reference files in these scenarios:
Load references/models-guide.md when:
- User asks about Flash vs Pro differences
- Models give conflicting recommendations
- Need detailed performance comparison
- Choosing model for specific task type
- Want to understand why models disagree
Load references/prompting-strategies.md when:
- Crafting complex prompts to Gemini
- Need AI-to-AI prompting format template
- Want to improve prompt quality
- Comparing old vs new prompting approaches
Load references/gemini-experiments.md when:
- Need historical context on testing
- Investigating edge cases
- Understanding design decisions
- Troubleshooting unusual behavior
Note: helper-functions.md is obsolete (references old gemini-coach wrapper, not the official gemini CLI).
Production Rules
1. Always Use -p for Automation
# ✅ Good for scripts
gemini -p "Question"
# ❌ Bad (interactive)
gemini
2. Select Model Based on Criticality
# Architecture/security → Pro
gemini -m gemini-2.5-pro -p "[critical question]"
# Debugging/review → Flash
gemini -m gemini-2.5-flash -p "[general question]"
3. Provide Context in Prompts
# ✅ Good: Context + Question + Considerations
gemini -p "Context: Building Cloudflare Worker. Question: Best auth pattern? Considerations: 1) Stateless, 2) JWT, 3) <100ms overhead"
# ❌ Bad: Vague
gemini -p "Best auth?"
4. Pipe File Content for Reviews
# ✅ Efficient
cat src/auth.ts | gemini -p "Review for security"
# ❌ Less efficient
gemini -p "Review src/auth.ts"
5. Synthesize, Don't Just Forward
❌ BAD: Just paste Gemini's response
Claude: [runs gemini] "Gemini says: [paste]"
✅ GOOD: Synthesize both perspectives
Claude: "I've consulted Gemini for a second opinion:
My analysis: [Claude's perspective]
Gemini's analysis: [Gemini's perspective]
Key differences: [synthesis]
Recommendation: [unified answer]"
6. Handle Errors Gracefully
if output=$(gemini -p "Question" 2>&1); then
echo "Gemini says: $output"
else
echo "Gemini consultation failed, proceeding with Claude's recommendation"
fi
Version History
2.1.0 (2025-12-15):
- Optimized to <500 lines (Phase 12.5 → 13 condensation)
- Extracted detailed content to references/
- Added "When to Load References" section
- Condensed to top 3 errors, top 3 use cases
2.0.0 (2025-11-13):
- Complete rewrite for official Gemini CLI (removed gemini-coach wrapper)
- Direct CLI integration patterns
- Updated command examples for
geminiCLI v0.13.0+
1.0.0 (2025-11-08):
- Initial release with gemini-coach wrapper
Related Skills
- google-gemini-api - Gemini API integration via SDK
- google-gemini-embeddings - Gemini embeddings for RAG
- google-gemini-file-search - Managed RAG with Gemini
License
MIT - See LICENSE
Support
- Issues: https://github.com/jezweb/claude-skills/issues
- Email: jeremy@jezweb.net
- Official Gemini CLI: https://github.com/google-gemini/gemini-cli
Readme
gemini-cli
Status: ✅ Production-Ready | v2.0.0 | Last Updated: 2025-11-13
Use the official Google Gemini CLI directly from Claude Code for second opinions, architectural advice, debugging help, and comprehensive code reviews using Gemini's 1M+ context window.
Auto-Trigger Keywords
This skill should activate when Claude Code encounters these scenarios:
Commands
gemini(official CLI tool)gemini-cli(installation package)gemini-2.5-flash,gemini-2.5-pro(model names)
Use Cases
- "second opinion"
- "consult Gemini"
- "peer review"
- "architectural decision"
- "stuck debugging" (after 2+ attempts)
- "security audit"
- "compare implementations"
- "model comparison"
- "Flash vs Pro"
- "1M context window"
- "large codebase analysis"
Technologies
- Google Gemini
- Gemini CLI
- @google/gemini-cli
- AI pair programming
- AI-to-AI prompting
Scenarios (Proactive)
- Major architectural decisions (D1 vs KV, Durable Objects vs Workflows, etc.)
- Security-sensitive code (auth, payments, data handling)
- Large refactors (5+ files, core architecture changes)
- Context approaching 70%+ full
- Unfamiliar technology stack
- Debugging failures (2+ attempts on same bug)
When to Use
✅ Use This Skill When:
- User asks major architectural question ("Should I use D1 or KV for sessions?")
- Writing security-sensitive code (auth, payments, PII)
- Planning large refactor (5+ files or core architecture)
- Stuck debugging after 2+ failed attempts
- Context approaching 70%+ capacity, need full codebase analysis
- Unfamiliar with technology stack or library
- Need to compare two implementations (old vs new, alternative approaches)
- User explicitly requests Gemini consultation
- Want complementary perspective on critical decision
- Need 1M+ context window for comprehensive analysis
❌ Don't Use This Skill When:
- Simple questions answerable with Claude's knowledge
- Trivial code reviews (small, non-critical changes)
- Every single decision (reserve for critical scenarios)
- API rate limits exceeded
- No internet connection available
Quick Example
Scenario: User asks "Should I use D1 or KV for session storage?"
Claude's Workflow:
# 1. Detect architectural decision
# 2. Inform user: "Consulting Gemini for second opinion..."
# 3. Get Gemini's perspective (Pro model)
gemini -m gemini-2.5-pro -p "I'm building a Cloudflare Worker with 1000-5000 DAU. Should I use D1 or KV for session storage? Consider: 1) Session reads on every request, 2) TTL-based expiration after 30 days, 3) Remember me functionality, 4) Multi-device tracking, 5) Cost under $50/month."
# 4. Synthesize both perspectives
# 5. Present unified recommendation
User sees:
Based on consultation with Gemini:
**My Perspective**: Both viable, depends on priorities
- KV excels at read performance (sub-millisecond)
- D1 provides better querying for multi-device tracking
**Gemini's Perspective** (2.5-Pro): D1 recommended
- Strong consistency is critical for sessions
- Query flexibility for "remember me" across devices
- Cost effective at this scale
**Recommendation**: Start with D1
Installation
Via Marketplace (Recommended)
# Add marketplace
/plugin marketplace add https://github.com/jezweb/claude-skills
# Install skill
/plugin install gemini-cli@claude-skills
Manual Installation
# Clone repository
git clone https://github.com/jezweb/claude-skills.git
cd claude-skills
# Symlink skill
ln -s $(pwd)/skills/gemini-cli ~/.claude/skills/gemini-cli
Install Gemini CLI
# Install official Gemini CLI
npm install -g @google/gemini-cli
# Authenticate
gemini
# Test
gemini --version
gemini -p "What is 2+2?"
Features
Core Capabilities
- ✅ Direct CLI Integration: Use official
geminicommand (no wrapper needed) - ✅ Model Selection: Flash (fast) vs Pro (thorough)
- ✅ 1M+ Context Window: Analyze large code files
- ✅ Non-Interactive Mode: Perfect for Claude Code automation (
-pflag) - ✅ File Context: Pipe files or use
--all-files - ✅ AI-to-AI Prompting: Optimized prompts for Gemini from Claude
Use Cases Covered
- Architecture Decisions: Technology selection, pattern choices
- Security Audits: Authentication, payments, sensitive data handling
- Debugging Assistance: Root cause analysis after failed attempts
- Code Reviews: Before commits, pull requests
- Refactoring Plans: Large-scale changes (5+ files)
- Performance Optimization: Bottleneck identification
Usage Patterns
Pattern 1: Quick Consultation
gemini -p "Should I use Drizzle ORM or raw SQL for Cloudflare D1?"
Pattern 2: Security Review
cat src/auth/middleware.ts | gemini -m gemini-2.5-pro -p "Security audit this auth middleware"
Pattern 3: Code Review
git diff HEAD | gemini --all-files -p "Review these changes for edge cases and security"
Pattern 4: Architecture Advice
gemini -m gemini-2.5-pro -p "Best way to handle WebSocket state in Cloudflare Durable Objects? Consider: 1) 100+ concurrent connections, 2) Persistence requirements, 3) Failover"
Pattern 5: Debugging
echo "[error message]" | gemini -p "Help debug this error. What's the likely root cause?"
Comparison: gemini-cli vs google-gemini-api
| Feature | gemini-cli (this skill) | google-gemini-api |
|---|---|---|
| Purpose | Second opinions, peer review | Direct API integration |
| Context | Full codebase (1M+ tokens) | Request-specific |
| Integration | Command-line tool | SDK (@google/genai) |
| Use Case | AI-to-AI consultation | Building Gemini-powered apps |
| Best For | Architecture, security audits | Chat, embeddings, function calling |
Use both: gemini-cli for consulting Gemini, google-gemini-api for building with Gemini.
Related Skills
- google-gemini-api - Gemini API integration via SDK
- google-gemini-embeddings - Gemini embeddings for RAG
- google-gemini-file-search - Managed RAG with Gemini
- openai-api - Alternative for second opinions
Known Issues
- Model Deprecation:
gemini-2.5-flash-literemoved (useflashorpro) - Rate Limits: Space out requests if hitting limits
- Large Files: Use
--all-filescarefully (can exceed context)
See SKILL.md for complete troubleshooting guide.
Version History
2.0.0 (2025-11-13):
- ✨ Complete rewrite for official Gemini CLI (removed gemini-coach wrapper)
- ✨ Direct CLI integration patterns
- ✨ Simplified to core use cases
- ✨ Updated for gemini CLI v0.13.0+
1.0.0 (2025-11-08):
- Initial release with gemini-coach wrapper
- Production testing and experimentation
Contributing
Issues and improvements welcome:
- Issues: https://github.com/jezweb/claude-skills/issues
- Email: jeremy@jezweb.net
License
MIT - See LICENSE
Maintained by: Jeremy Dawes | Jezweb
Details
- Marketplace
- secondsky/claude-skills
- Source
- plugins/gemini-cli
- Category
- Ai
- Keywords
- gemini-cli, gemini, cli, machine-learning, llm, artificial-intelligence
- Listed since
- Apr 7, 2026
More from secondsky/claude-skills
All 122- github-project-automationv3.12.0
- graphql-implementationv3.12.0
- health-check-endpointsv3.12.0
- hono-routingv3.12.0
- hugov3.12.0
- humanize-writingv3.12.0
- idempotency-handlingv3.12.0
- image-optimizationv3.12.0
- inspira-uiv3.12.0
- interaction-designv3.12.0
- internationalization-i18nv3.12.0
- jest-generatorv3.12.0
- kpi-dashboard-designv3.12.0
- logging-best-practicesv3.12.0
- maz-uiv3.12.0
- microservices-patternsv3.12.0
- ml-model-trainingv3.12.0
- ml-pipeline-automationv3.12.0
- mobile-app-debuggingv3.12.0
- mobile-app-testingv3.12.0
- mobile-first-designv3.12.0
- mobile-offline-supportv3.12.0
- model-deploymentv3.12.0
- motionv3.12.0
Similar to gemini-cli
More Code Review & Quality
GeminiMCP serverjamubc2.3K starsGives Claude access to Google Gemini's analysis and sandboxed code execution via the Gemini CLI.
geminiSkillgiuseppe-trisciuoglio/developer-kit3.6K installsDelegates specific tasks to the Gemini CLI for large-context analysis, with English prompts and safe result handling.
agyPluginrobbyt/claude-skills42 starsGoogle Antigravity (agy) CLI integration with focused skills for web search, plan review, code review, and architecture analysis. Replaces the deprecated gemini
gemini-reviewSkillalinaqi/maggy174 installsGemini CLI code review using Gemini 2.5 Pro's 1M token context to analyze entire repositories at once.