Home / Market / gemini

gemini

Use when the user asks to run Gemini CLI for code review, plan review, or big context (>200k) processing. Ideal for comprehensive analysis requiring large context windows. Uses Gemini 3 Pro by default for state-of-the-art reasoning and coding.

skill★ 347850 dlgithubMITInstall in CosmosUpstream Source

Documentation & Preview

Gemini Skill

Harness the power of Google's Gemini 3 Pro for comprehensive code analysis, plan reviews, and big context processing. This skill enables Claude Code to leverage Gemini CLI for tasks requiring massive context windows (>200k tokens) and state-of-the-art reasoning capabilities.

Purpose

The Gemini skill provides access to Google's flagship Gemini 3 Pro model through the Gemini CLI, offering:

When to Use This Skill

Use the Gemini skill when:

Activation Keywords: "use Gemini", "run Gemini", "Gemini review", "analyze with Gemini", "big context", ">200k tokens"

How It Works

The skill acts as an intelligent wrapper around the Gemini CLI, providing:

  1. Model Selection: Guides users to choose the optimal Gemini model for their task
  2. Approval Mode Management: Automatically selects the correct approval mode based on execution context
  3. Background Safety: Prevents hung processes in non-interactive environments
  4. Structured Prompts: Helps construct effective prompts for comprehensive analysis

Execution Flow

User Request → Model Selection → Approval Mode → Command Assembly → Execution → Results

The skill handles all complexity around:

Key Features

1. Multiple Model Options

| Model | Best For | Performance | |-------|----------|-------------| | gemini-3-pro-preview ⭐ | Complex reasoning, coding, agentic tasks | 76.2% SWE-bench, flagship quality | | gemini-3-flash | Sub-second latency, speed-critical tasks | Distilled from 3 Pro, TPU-optimized | | gemini-2.5-pro | Legacy all-around performance | Mature stability | | gemini-2.5-flash | Cost-efficient, high-volume tasks | $0.15/M tokens | | gemini-2.5-flash-lite | Fastest processing | Maximum speed |

2. Smart Approval Modes

3. Background Execution Safety

The skill automatically protects against hung processes by:

4. Large Context Processing

Usage Examples

Example 1: Comprehensive Code Review (Background)

gemini -m gemini-3-pro-preview --approval-mode yolo \
  "Perform a comprehensive code review focusing on:
   1. Security vulnerabilities
   2. Performance issues
   3. Code quality and maintainability
   4. Best practices violations"

Use Case: Automated code review in CI/CD or Claude Code background tasks

Example 2: Architectural Plan Review

gemini -m gemini-3-pro-preview --approval-mode yolo \
  "Review this architectural plan for:
   1. Scalability concerns
   2. Missing components
   3. Integration challenges
   4. Alternative approaches"

Use Case: Analyzing technical specifications and system designs

Example 3: Full Codebase Analysis

gemini -m gemini-3-pro-preview --approval-mode yolo \
  "Analyze the entire codebase to understand:
   1. Overall architecture
   2. Key patterns and conventions
   3. Potential technical debt
   4. Refactoring opportunities"

Use Case: Understanding large codebases or legacy systems

Example 4: Interactive Code Review (Terminal Only)

gemini -m gemini-3-pro-preview --approval-mode default \
  "Review the authentication flow for security issues"

Use Case: Interactive sessions where user can approve/reject suggestions in real-time

Example 5: Speed-Critical Analysis

gemini -m gemini-3-flash --approval-mode yolo \
  "Quick security scan for common vulnerabilities"

Use Case: Fast analysis with sub-second latency requirements

Example 6: Multi-Directory Analysis

gemini -m gemini-3-pro-preview --approval-mode yolo \
  --include-directories /path/to/backend \
  --include-directories /path/to/frontend \
  "Analyze the full-stack application architecture"

Use Case: Projects spanning multiple directories or repositories

Command Reference

Core Flags

| Flag | Description | Example | |------|-------------|---------| | -m, --model | Select Gemini model | -m gemini-3-pro-preview | | --approval-mode | Control tool approval | --approval-mode yolo | | -y, --yolo | Shorthand for auto-approve | -y | | -i, --prompt-interactive | Execute prompt and continue | -i "Review auth system" | | --include-directories | Add directories to workspace | --include-directories /path | | -s, --sandbox | Run in sandbox mode | -s |

Approval Modes Quick Reference

| Mode | Interactive | Background | Auto-edits | Use When | |------|------------|------------|------------|----------| | default | ✅ | ❌ | ❌ | Interactive terminal with manual approval | | auto_edit | ✅ | ⚠️ | ✅ | Code reviews with automatic edit suggestions | | yolo | ✅ | ✅ | ✅ | Background/automated tasks (required) |

Critical: Background Mode Warning

NEVER use --approval-mode default in background or non-interactive shells (like Claude Code tool calls). It will hang indefinitely waiting for approval prompts that cannot be provided.

For Automated/Background Tasks

✅ DO THIS:

# Use yolo for fully automated execution
gemini -m gemini-3-pro-preview --approval-mode yolo "Review codebase"

# Or wrap with timeout for safety
timeout 300 gemini -m gemini-3-pro-preview --approval-mode yolo "Review codebase"

❌ NEVER DO THIS:

# Will hang indefinitely in background
gemini -m gemini-3-pro-preview --approval-mode default "Review codebase"

Symptoms of Hung Gemini

Fix Hung Process

# Check if hung
ps aux | grep gemini | grep -v grep

# Kill if necessary
pkill -9 -f "gemini.*gemini-3-pro-preview"

Best Practices

1. Model Selection

2. Prompt Engineering

Be specific and structured:

gemini -m gemini-3-pro-preview --approval-mode yolo \
  "Analyze the authentication system for:
   1. OWASP Top 10 vulnerabilities
   2. JWT token handling security
   3. Session management best practices
   4. Rate limiting implementation
   5. Password hashing strength"

3. Context Management

4. Safety

Error Handling

The skill handles common errors:

  1. Non-zero exit codes: Reports failure and requests direction
  2. Hung processes: Detects and provides kill commands
  3. Warnings in output: Summarizes and asks for adjustments
  4. Permission issues: Asks user before using high-impact flags

Troubleshooting

Process Hung in Background

Detection:

ps aux | grep -E "gemini.*gemini-3" | grep -v grep
# Look for: 20+ min runtime, 0% CPU, state 'S'

Resolution:

pkill -9 -f "gemini.*gemini-3-pro-preview"

Prevention: Always use --approval-mode yolo for background tasks

No Output After Long Time

Check if process is waiting for approval:

ps -o pid,etime,pcpu,stat,command -p <PID>

If stat is 'S' and CPU is 0%, kill and restart with --approval-mode yolo

Out of Memory

For very large codebases:

Requirements

Tips for Success

  1. Start with Pro: Default to gemini-3-pro-preview for best quality
  2. Be Specific: Clear, structured prompts yield better results
  3. Use Background Mode Safely: Always use yolo in non-interactive contexts
  4. Leverage Context: Gemini excels at understanding large codebases
  5. Save Results: Ask Gemini to output structured reports
  6. Follow Up: Start new sessions with context from previous findings

Performance Benchmarks

Gemini 3 Pro advantages:

Integration with Claude Code

The skill seamlessly integrates with Claude Code workflows:

  1. User requests Gemini analysis
  2. Skill prompts for model selection
  3. Determines execution context (interactive vs background)
  4. Assembles safe command with proper flags
  5. Executes and captures output
  6. Returns structured results to user

After completion, users can:

Coming Soon

Resources

---

Knowledge Cutoff: Gemini 3 models have knowledge through January 2025

Skill Version: Compatible with Gemini CLI v0.16.0+