gemini-cli
Google Gemini CLI fundamentals for code analysis, review, and validation. Use when (1) executing gemini commands for code review/analysis, (2) configuring models (gemini-3-flash-preview (default)/gemini-3.1-pro-preview (complex only)), output formats (text/json/stream-json), or sandbox modes, (3) managing Gemini sessions with /chat save/resume, (4) integrating Gemini into automation scripts and CI/CD pipelines. Do NOT use for orchestration patterns (use gemini-claude-loop instead).
Best use case
gemini-cli is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Google Gemini CLI fundamentals for code analysis, review, and validation. Use when (1) executing gemini commands for code review/analysis, (2) configuring models (gemini-3-flash-preview (default)/gemini-3.1-pro-preview (complex only)), output formats (text/json/stream-json), or sandbox modes, (3) managing Gemini sessions with /chat save/resume, (4) integrating Gemini into automation scripts and CI/CD pipelines. Do NOT use for orchestration patterns (use gemini-claude-loop instead).
Teams using gemini-cli should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/gemini-cli/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How gemini-cli Compares
| Feature / Agent | gemini-cli | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Google Gemini CLI fundamentals for code analysis, review, and validation. Use when (1) executing gemini commands for code review/analysis, (2) configuring models (gemini-3-flash-preview (default)/gemini-3.1-pro-preview (complex only)), output formats (text/json/stream-json), or sandbox modes, (3) managing Gemini sessions with /chat save/resume, (4) integrating Gemini into automation scripts and CI/CD pipelines. Do NOT use for orchestration patterns (use gemini-claude-loop instead).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Gemini CLI Skill ## ⚠️ Environment Notice | Environment | Command Format | |-------------|----------------| | Interactive terminal | `gemini` (enters interactive mode) | | **Claude Code / CI** | `gemini -p "prompt"` (headless mode) | | **Scripting with JSON** | `gemini -p "prompt" --output-format json` | | **Stdin input** | `echo "prompt" \| gemini` or `cat file \| gemini -p "analyze"` | **Non-TTY environments** (Claude Code, CI pipelines) require `-p` flag or stdin input. ## Quick Start ### Headless Mode (Claude Code/CI) ```bash # Basic review gemini -p "Review this code for bugs" # With JSON output for parsing gemini -p "Analyze this code" --output-format json # With specific model and directories gemini -m gemini-3-flash-preview --include-directories ./src,./lib -p "Code analysis" # Stdin input with prompt cat src/auth.py | gemini -p "Review for security issues" ``` ### JSON Output Parsing ```bash result=$(gemini -p "Query" --output-format json) response=$(echo "$result" | jq -r '.response') ``` ## Reference Documentation - **[Commands Reference](references/commands.md)** - Slash commands, @ commands, shell mode - **[Options Reference](references/options.md)** - Models, output formats, directories, JSON schema - **[Examples](references/examples.md)** - Code review, CI/CD integration, automation scripts ## Available Models > **Note**: Model names change as Google releases new versions. Run `gemini --help` or check [Gemini API Models](https://ai.google.dev/gemini-api/docs/models) for the current list. | Model | Description | Best For | |-------|-------------|----------| | `gemini-3-flash-preview` | Fast and efficient (DEFAULT) | Standard reviews, batch operations, general use | | `gemini-3.1-pro-preview` | Latest flagship model | Complex architecture analysis, security audits | ## Output Formats | Format | Description | Use Case | |--------|-------------|----------| | (default) | Human-readable text | Terminal output | | `json` | Structured with stats | Script parsing, automation | | `stream-json` | JSONL events | Real-time monitoring | ### JSON Response Structure > Full schema: See [Options Reference](references/options.md#json-response-schema) Key fields: `response` (string), `stats` (object), `error` (optional object) ## Key Options | Option | Alias | Description | |--------|-------|-------------| | `--prompt` | `-p` | Run in headless mode with prompt | | `--model` | `-m` | Model selection | | `--output-format` | | Output format (`json`, `stream-json`) | | `--include-directories` | | Additional context directories (comma-separated) | | `--yolo` | `-y` | Auto-approve all actions | | `--sandbox` | `-s` | Sandbox mode (`restrictive`) | | `--approval-mode` | | Set approval mode (`auto_edit`) | ## Common Patterns > **Full examples**: See [Examples](references/examples.md) for detailed patterns ### Essential Patterns ```bash # Code review with output cat src/auth.py | gemini -p "Review for security issues" > review.txt # JSON output with jq parsing result=$(gemini -p "Query" --output-format json) echo "$result" | jq -r '.response' # Cross-directory analysis gemini --include-directories ./backend,./frontend -p "Review API integration" ``` ## Timeout Configuration | Task Type | Recommended Timeout | Claude Code Tool | |-----------|---------------------|------------------| | Quick checks | 2 minutes | `timeout: 120000` | | Standard review | 5 minutes | `timeout: 300000` | | Deep analysis | **10 minutes** | `timeout: 600000` | **Recommendation**: Use `timeout: 600000` for complex analysis with `gemini-3.1-pro-preview`. ## Error Handling > **Detailed error handling patterns**: See [Examples](references/examples.md#error-handling) | Error | Cause | Solution | |-------|-------|----------| | No output | Missing `-p` flag | Use `gemini -p "prompt"` | | Empty response | No stdin/prompt | Provide via `-p` or stdin | | Exit code `1` | General error | Check JSON `.error` field | | Context too large | Too many files | Use specific paths | | Permission denied | Sandbox restrictions | Use `--yolo` carefully | ## Best Practices 1. **Use `-p` flag** in Claude Code and CI environments 2. **Use `--output-format json`** for script parsing 3. **Parse with `jq`** for reliable extraction 4. **Check `.error`** in JSON response for error handling 5. **Use `--include-directories`** for multi-directory context 6. **Match model to task**: `gemini-3-flash-preview` for most tasks, `gemini-3.1-pro-preview` only for complex architecture/security 7. **Set 10-minute timeout** for deep analysis (`timeout: 600000`)
Related Skills
gemini-claude-loop
Dual-AI engineering loop orchestrating Claude Code (planning/implementation) and Gemini (validation/review). Use when (1) complex feature development requiring validation, (2) high-quality code with security/performance concerns, (3) large-scale refactoring, (4) user requests gemini-claude loop or dual-AI review. Do NOT use for simple one-off fixes or prototypes.
unity-vcontainer
VContainer dependency injection expert specializing in IoC container configuration, lifecycle management, and Unity-optimized DI patterns. Masters dependency resolution, scoped containers, and testable architecture design. Use PROACTIVELY for VContainer setup, service registration, or SOLID principle implementation.
unity-unitask
UniTask library expert specializing in allocation-free async/await patterns, coroutine migration, and Unity-optimized asynchronous programming. Masters UniTask performance optimizations, cancellation handling, and memory-efficient async operations. Use PROACTIVELY for UniTask implementation, async optimization, or coroutine replacement.
unity-unirx
UniRx (Reactive Extensions) library expert for legacy Unity projects. Specializes in UniRx-specific patterns, Observable streams, and ReactiveProperty. Use for maintaining existing UniRx codebases. For new projects, use unity-r3 skill instead.
unity-ui
Build and optimize Unity UI with UI Toolkit and UGUI. Masters responsive layouts, event systems, and performance optimization. Use for UI implementation, Canvas optimization, or cross-platform UI challenges.
unity-textmeshpro
TextMeshPro (TMPro) expert for Unity text rendering with advanced typography, performance optimization, and professional text effects. Masters font asset creation, dynamic fonts, rich text formatting, material presets, and text mesh optimization. Use PROACTIVELY for text rendering, font management, localization text, UI text performance, or text effects implementation.
unity-testrunner
Unity Test Framework CLI automation and test writing patterns. Masters batchmode execution, NUnit assertions, EditMode/PlayMode testing, and TDD workflows. Use PROACTIVELY for test automation, CI/CD pipelines, or test-driven development in Unity.
unity-r3
R3 (Reactive Extensions) library expert specializing in modern reactive programming patterns, event-driven architectures, and Observable streams. Masters R3-specific features, async enumerable integration, and Unity-optimized reactive patterns. Use PROACTIVELY for R3 implementation, reactive programming, or MVVM/MVP architecture.
unity-performance
Optimize Unity game performance through profiling, draw call reduction, and resource management. Masters batching, LOD, occlusion culling, and mobile optimization. Use for performance bottlenecks, frame rate issues, or optimization strategies.
unity-networking
Implement multiplayer games with Unity Netcode, Mirror, or Photon. Masters client-server architecture, state synchronization, and lag compensation. Use for multiplayer features, networking issues, or real-time synchronization.
unity-mobile
Optimize Unity games for mobile platforms with IL2CPP, platform-specific code, and memory management. Masters iOS/Android deployment, app size reduction, and battery optimization. Use for mobile builds, platform issues, or device-specific optimization.
unity-csharp-fundamentals
Unity C# fundamental patterns including TryGetComponent, SerializeField, RequireComponent, and safe coding practices. Essential patterns for robust Unity development. Use PROACTIVELY for any Unity C# code to ensure best practices.