// Invoke Google Gemini CLI for complex reasoning tasks, research, and AI assistance. Trigger phrases include "use gemini", "ask gemini", "run gemini", "call gemini", "gemini cli", "Google AI", "Gemini reasoning", or when users request Google's AI models, need advanced reasoning capabilities, research with web search, or want to continue previous Gemini conversations. Automatically triggers on Gemini-related requests and supports session continuation for iterative development.
| name | gemini |
| version | 1.2.0 |
| description | Invoke Google Gemini CLI for complex reasoning tasks, research, and AI assistance. Trigger phrases include "use gemini", "ask gemini", "run gemini", "call gemini", "gemini cli", "Google AI", "Gemini reasoning", or when users request Google's AI models, need advanced reasoning capabilities, research with web search, or want to continue previous Gemini conversations. Automatically triggers on Gemini-related requests and supports session continuation for iterative development. |
The default model for ALL Gemini invocations is gemini-3-pro-preview.
gemini-3-pro-preview unless user explicitly requests another modelgemini-2.5-flash ONLY on 404/access errors# Default invocation - ALWAYS use gemini-3-pro-preview
gemini -m gemini-3-pro-preview "your prompt here"
REQUIRED: Use positional prompts for Gemini CLI invocations.
DEPRECATED: -p/--prompt flag is officially deprecated and will be removed in a future version.
Examples:
gemini -m gemini-3-pro-preview "prompt" (CORRECT - positional)gemini -m gemini-3-pro-preview -p "prompt" (DEPRECATED - avoid using)gemini -r latest (CORRECT - session resume)Warning from CLI help: "[deprecated: Use the positional prompt instead. This flag will be removed in a future version.]"
Why? As of Gemini CLI v0.20.0, the -p flag is explicitly marked deprecated. Use positional prompts for forward compatibility.
For OAuth free tier users in headless mode:
When previewFeatures: true in ~/.gemini/settings.json, the CLI routes ALL requests to Gemini 3 Pro (even -m gemini-2.5-pro). Since free tier doesn't have Gemini 3 access, this causes 404 errors.
Solution: Disable preview features for reliable headless operation:
// ~/.gemini/settings.json
{
"general": {
"previewFeatures": false
}
}
Plugin Behavior: This skill automatically falls back to gemini-2.5-flash when encountering 404 errors. Flash always works with OAuth free tier.
This skill activates when users say phrases like:
This skill should be invoked when:
When a user makes a request, default to read-only mode (default approval) unless they explicitly request file editing:
Use gemini-3-pro-preview for ALL tasks with default approval mode:
Approval Mode Selection:
default (default): For all tasks - prompts for approval on edits (safe)auto_edit: ONLY when user explicitly requests file editingyolo: When user explicitly wants full auto-approval (use with caution)⚠️ Explicit Edit Request: If the user explicitly asks to "edit files", "modify code", "write changes", or "make edits" - ONLY then use --approval-mode auto_edit to enable file modifications.
Fallback Chain (if primary unavailable):
gemini-3-pro-preview (primary - highest capability)gemini-2.5-pro (stable general reasoning)gemini-2.5-flash (fast, always available)Example requests: "Design a distributed cache", "Explain CQRS pattern", "Analyze this code"
IMPORTANT: Gemini CLI works differently from Codex - no exec subcommand needed. Use positional prompts directly.
gemini -m gemini-3-pro-preview \
"Design a microservices architecture for e-commerce"
gemini -m gemini-3-pro-preview \
--approval-mode auto_edit \
"Edit this file to refactor the function"
# Resume most recent session
gemini -r latest
# Resume specific session by index
gemini -r 3
# Resume and add new prompt
gemini -r latest "Continue our discussion about caching strategies"
Why positional prompts?
exec command neededUse gemini-3-pro-preview (default for ALL tasks):
Fallback to gemini-2.5-pro when:
Fallback to gemini-2.5-flash when:
When users mention a version number, map to the latest model in that family:
| User Request | Maps To | Actual Model ID |
|---|---|---|
| "use 3" / "Gemini 3" | Latest 3.x Pro | gemini-3-pro-preview |
| "use 2.5" | 2.5 Pro | gemini-2.5-pro |
| "use flash" | 2.5 Flash | gemini-2.5-flash |
| No version specified | Latest Pro (ALL tasks) | gemini-3-pro-preview |
See: references/model-selection.md for detailed model selection guidance and decision tree.
All Gemini invocations use these defaults unless user specifies otherwise:
| Parameter | Default Value | CLI Flag | Notes |
|---|---|---|---|
| Model | gemini-3-pro-preview | -m gemini-3-pro-preview | For ALL tasks (highest capability) |
| Model (fallback 1) | gemini-2.5-pro | -m gemini-2.5-pro | If Gemini 3 Pro unavailable |
| Model (fallback 2) | gemini-2.5-flash | -m gemini-2.5-flash | Always works on free tier |
| Approval Mode (default) | default | No flag | Safe default - prompts for edits |
| Approval Mode (editing) | auto_edit | --approval-mode auto_edit | Only when user explicitly requests editing |
| Sandbox | false (disabled) | No flag | Sandbox disabled by default |
| Output Format | text | No flag | Human-readable text output |
| Web Search | Enabled when appropriate | -e web_search (if needed) | Context-dependent |
Rationale for Defaults:
--output-format json for parsing)Note: If you have previewFeatures: true in settings, disable it for reliable headless operation (see warning above).
The skill handles these common errors gracefully:
Error: command not found: gemini
Message: "Gemini CLI not installed. Install from: https://github.com/google-gemini/gemini-cli"
Action: User must install Gemini CLI before using this skill
Error: Output contains "auth" or "authentication"
Message: "Authentication required. Run: gemini login to authenticate with your Google account"
Action: User must authenticate via OAuth or API key
Error: Output contains "quota" or "rate limit" or status 429
Message: "Rate limit exceeded (60 req/min, 1000 req/day free tier). Retry in X seconds or upgrade account."
Action: Wait for rate limit reset or upgrade to paid tier
Error: Output contains "model not found" or "404" or status 403
Message: "Model unavailable. Trying fallback model..."
Action: Automatically retry with fallback:
gemini-3-pro-preview unavailable → try gemini-2.5-progemini-2.5-pro unavailable → try gemini-2.5-flashError: Using -r flag but session doesn't exist
Message: "Session not found. Use gemini --list-sessions to see available sessions."
Action: User should list sessions or start new session
Error: Status 403 or "preview access required"
Message: "Gemini 3 Pro requires preview access. Enable Preview Features in settings or use gemini-2.5-pro instead."
Action: Either enable preview features, get API key, or use 2.5 models
See: references/gemini-help.md for complete CLI reference and troubleshooting.
# Design system architecture
gemini -m gemini-3-pro-preview "Design a scalable payment processing system"
# Research with web search
gemini -m gemini-3-pro-preview -e web_search "Research latest React 19 features"
# Explain complex concept
gemini -m gemini-3-pro-preview "Explain the CAP theorem with real-world examples"
# Refactoring (uses gemini-3-pro-preview for all tasks)
gemini -m gemini-3-pro-preview "Refactor this function for better readability"
# Fix syntax errors
gemini -m gemini-3-pro-preview "Fix the syntax errors in this JavaScript code"
# Optimize performance
gemini -m gemini-3-pro-preview "Optimize this database query for better performance"
# Start a session (automatic)
gemini -m gemini-3-pro-preview "Design an authentication system"
# List available sessions
gemini --list-sessions
# Resume most recent
gemini -r latest
# Resume specific session
gemini -r 3
# Continue with new prompt
gemini -r latest "Now help me implement the login flow"
# JSON output for parsing
gemini -m gemini-2.5-pro --output-format json "List top 5 design patterns"
# Streaming JSON for real-time
gemini -m gemini-2.5-pro --output-format stream-json "Explain async patterns"
# Default mode (prompt for all)
gemini -m gemini-2.5-pro --approval-mode default "Review this code"
# Auto-edit (auto-approve edits only)
gemini -m gemini-2.5-pro --approval-mode auto_edit "Refactor this module"
# YOLO mode (auto-approve ALL - use with caution)
gemini -m gemini-2.5-pro --approval-mode yolo "Deploy to production"
# Enable sandbox for untrusted code
gemini -m gemini-2.5-pro -s "Analyze this suspicious code snippet"
# Disabled by default (trusted environment)
gemini -m gemini-2.5-pro "Review this internal codebase"
Gemini CLI supports extensions and Model Context Protocol (MCP) servers for enhanced functionality.
# List available extensions
gemini --list-extensions
# Use specific extensions (web search, code analysis, etc.)
gemini -m gemini-3-pro-preview -e web_search "Research React 19 features"
# Use all extensions (default)
gemini -m gemini-3-pro-preview "Design system architecture"
Note: This plugin does not implement custom extensions or MCP servers. Users can configure extensions and MCP servers through the Gemini CLI's standard configuration in ~/.gemini/settings.json. Extensions are enabled by default when appropriate for the task.
--include-directories) (v0.20.0+)Include additional directories in workspace context:
# Single directory
gemini -m gemini-3-pro-preview --include-directories /shared/libs "task"
# Multiple directories (comma-separated)
gemini -m gemini-3-pro-preview --include-directories /path1,/path2 "task"
# Multiple directories (repeated flag)
gemini -m gemini-3-pro-preview --include-directories /path1 --include-directories /path2 "task"
Note: Disabled in restrictive sandbox profiles.
--screen-reader) (v0.20.0+)Enable screen reader mode for accessibility:
gemini -m gemini-3-pro-preview --screen-reader "task"
-i/--prompt-interactive) (v0.20.0+)Execute a prompt and continue in interactive mode:
gemini -m gemini-3-pro-preview -i "initial prompt here"
Note: Limited applicability for Claude Code skills which use non-interactive mode.
--experimental-acp)Start agent in Agent Control Protocol mode for programmatic interaction:
gemini --experimental-acp "task"
Note: Experimental feature. Works with GEMINI_API_KEY environment variable.
For detailed information, see the references directory:
references/gemini-help.md - Complete Gemini CLI help output and flag referencereferences/command-patterns.md - Common command templates organized by use casereferences/session-workflows.md - Multi-turn conversation patterns and best practicesreferences/model-selection.md - Model selection decision tree and version mapping-m flag explicitly for predictable behaviorgemini "prompt" over deprecated -p flag-e web_search for research tasks-r latest for multi-turn conversationsgemini-3-pro-preview, fallback to 2.5 modelsauto_edit for code, default for untrusted taskscommand -v gemini before invocation| Feature | Codex CLI | Gemini CLI |
|---|---|---|
| Invocation | codex exec "prompt" | gemini "prompt" |
| Subcommand | Required (exec) | Not needed |
| Positional Prompts | Not supported | Preferred |
| Session Resume | codex exec resume --last | gemini -r latest |
| Models | GPT-5.1, GPT-5.1-Codex | Gemini 3 Pro, 2.5 Pro/Flash |
| Provider | OpenAI (via Codex) |
Use Gemini when:
Use Codex when:
Use Claude (native) when:
Changes in v0.20.0:
-p/--prompt flag officially deprecated (use positional prompts)--include-directories flag for workspace expansion-i/--prompt-interactive flag for interactive continuation--screen-reader accessibility flag--experimental-acp Agent Control Protocol mode-r flag standardFor questions or issues, consult references/gemini-help.md or run gemini --help.