
Gemini Cli
- 55 installs
- 10 repo stars
- Updated December 9, 2025
- samhvw8/dot-claude
Helps with ai & agent building tasks.
About
gemini-cli is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- gemini-cli
- AI & Agent Building
- AI-coding skill
Gemini Cli by the numbers
- 55 all-time installs (skills.sh)
- Ranked #6,762 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 26, 2026 (Skillselion catalog sync)
npx skills add https://github.com/samhvw8/dot-claude --skill gemini-cliAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 55 |
|---|---|
| repo stars | ★ 10 |
| Last updated | December 9, 2025 |
| Repository | samhvw8/dot-claude ↗ |
What it does
Helps with ai & agent building tasks.
Files
Gemini CLI Integration Skill
This skill enables Claude Code to effectively orchestrate Gemini CLI (v0.16.0+) with Gemini 3 Pro for code generation, review, analysis, and specialized tasks.
When to Use This Skill
Ideal Use Cases
1. Second Opinion / Cross-Validation
- Code review after writing code (different AI perspective)
- Security audit with alternative analysis
- Finding bugs Claude might have missed
2. Google Search Grounding
- Questions requiring current internet information
- Latest library versions, API changes, documentation updates
- Current events or recent releases
3. Codebase Architecture Analysis
- Use Gemini's
codebase_investigatortool - Understanding unfamiliar codebases
- Mapping cross-file dependencies
4. Parallel Processing
- Offload tasks while continuing other work
- Run multiple code generations simultaneously
- Background documentation generation
5. Specialized Generation
- Test suite generation
- JSDoc/documentation generation
- Code translation between languages
When NOT to Use
- Simple, quick tasks (overhead not worth it)
- Tasks requiring immediate response (rate limits cause delays)
- When context is already loaded and understood
- Interactive refinement requiring conversation
Core Instructions
1. Verify Installation
command -v gemini || which gemini2. Basic Command Pattern
gemini "[prompt]" --yolo -o text 2>&1Key flags:
--yoloor-y: Auto-approve all tool calls-o text: Human-readable output-o json: Structured output with stats-m gemini-2.5-flash: Use faster model for simple tasks
3. Critical Behavioral Notes
YOLO Mode Behavior: Auto-approves tool calls but does NOT prevent planning prompts. Gemini may still present plans and ask "Does this plan look good?" Use forceful language:
- "Apply now"
- "Start immediately"
- "Do this without asking for confirmation"
Rate Limits: Free tier has 60 requests/min, 1000/day. CLI auto-retries with backoff. Expect messages like "quota will reset after Xs".
4. Output Processing
For JSON output (-o json), parse:
{
"response": "actual content",
"stats": {
"models": { "tokens": {...} },
"tools": { "byName": {...} }
}
}Quick Reference Commands
Code Generation
gemini "Create [description] with [features]. Output complete file content." --yolo -o textCode Review
gemini "Review [file] for: 1) features, 2) bugs/security issues, 3) improvements" -o textBug Fixing
gemini "Fix these bugs in [file]: [list]. Apply fixes now." --yolo -o textTest Generation
gemini "Generate [Jest/pytest] tests for [file]. Focus on [areas]." --yolo -o textDocumentation
gemini "Generate JSDoc for all functions in [file]. Output as markdown." --yolo -o textArchitecture Analysis
gemini "Use codebase_investigator to analyze this project" -o textWeb Research
gemini "What are the latest [topic]? Use Google Search." -o textFaster Model (Simple Tasks)
gemini "[prompt]" -m gemini-2.5-flash -o textError Handling
Rate Limit Exceeded
- CLI auto-retries with backoff
- Use
-m gemini-2.5-flashfor lower priority tasks - Run in background for long operations
Command Failures
- Check JSON output for detailed error stats
- Verify Gemini is authenticated:
gemini --version - Check
~/.gemini/settings.jsonfor config issues
Validation After Generation
Always verify Gemini's output:
- Check for security vulnerabilities (XSS, injection)
- Test functionality matches requirements
- Review code style consistency
- Verify dependencies are appropriate
Integration Workflow
Standard Generate-Review-Fix Cycle
# 1. Generate
gemini "Create [code]" --yolo -o text
# 2. Review (Gemini reviews its own work)
gemini "Review [file] for bugs and security issues" -o text
# 3. Fix identified issues
gemini "Fix [issues] in [file]. Apply now." --yolo -o textBackground Execution
For long tasks, run in background and monitor:
gemini "[long task]" --yolo -o text 2>&1 &
# Monitor with BashOutput toolGemini's Unique Capabilities
These tools are available only through Gemini:
1. google_web_search - Real-time internet search via Google 2. codebase_investigator - Deep architectural analysis 3. save_memory - Cross-session persistent memory
Configuration
Project Context (Optional)
Create .gemini/GEMINI.md in project root for persistent context that Gemini will automatically read.
Session Management
List sessions: gemini --list-sessions Resume session: echo "follow-up" | gemini -r [index] -o text
See Also
reference.md- Complete command and flag referencetemplates.md- Prompt templates for common operationspatterns.md- Advanced integration patternstools.md- Gemini's built-in tools documentation
Gemini CLI Integration Patterns
Advanced patterns for orchestrating Gemini CLI effectively from Claude Code.
Pattern 1: Generate-Review-Fix Cycle
The most reliable pattern for quality code generation.
# Step 1: Generate code
gemini "Create [code description]" --yolo -o text
# Step 2: Have Gemini review its own work
gemini "Review [generated file] for bugs and security issues" -o text
# Step 3: Fix identified issues
gemini "Fix these issues in [file]: [list from review]. Apply now." --yolo -o textWhy It Works
- Different "mindset" for generation vs review
- Self-correction catches common mistakes
- Security vulnerabilities often caught in review phase
Example
# Generate
gemini "Create a user authentication module with bcrypt and JWT" --yolo -o text
# Review
gemini "Review auth.js for security vulnerabilities" -o text
# Output: "Found XSS risk, missing input validation, weak JWT secret"
# Fix
gemini "Fix in auth.js: XSS risk, add input validation, use env var for JWT secret. Apply now." --yolo -o textPattern 2: JSON Output for Programmatic Processing
Use JSON output when you need to process results programmatically.
gemini "[prompt]" -o json 2>&1Parsing the Response
// In Node.js or with jq
const result = JSON.parse(output);
const content = result.response;
const tokenUsage = result.stats.models["gemini-2.5-flash"].tokens.total;
const toolCalls = result.stats.tools.byName;Use Cases
- Extracting specific data from responses
- Monitoring token usage
- Tracking tool call success/failure
- Building automation pipelines
Pattern 3: Background Execution
For long-running tasks, execute in background and continue working.
# Start in background
gemini "[long task]" --yolo -o text 2>&1 &
# Get process ID for later
echo $!
# Monitor output incrementally with BashOutput toolWhen to Use
- Code generation for large projects
- Documentation generation
- Running multiple Gemini tasks in parallel
Parallel Execution
# Run multiple tasks simultaneously
gemini "Create frontend" --yolo -o text 2>&1 &
gemini "Create backend" --yolo -o text 2>&1 &
gemini "Create tests" --yolo -o text 2>&1 &Pattern 4: Model Selection Strategy
Choose the right model for the task.
Decision Tree
Is the task complex (architecture, multi-file, deep analysis)?
├── Yes → Use default (Gemini 3 Pro)
└── No → Is speed critical?
├── Yes → Use gemini-2.5-flash
└── No → Is it trivial (formatting, simple query)?
├── Yes → Use gemini-2.5-flash-lite
└── No → Use gemini-2.5-flashExamples
# Complex: Architecture analysis
gemini "Analyze codebase architecture" -o text
# Quick: Simple formatting
gemini "Format this JSON" -m gemini-2.5-flash -o text
# Trivial: One-liner
gemini "What is 2+2?" -m gemini-2.5-flash -o textPattern 5: Rate Limit Handling
Strategies for working within rate limits.
Approach 1: Let Auto-Retry Handle It
Default behavior - CLI retries automatically with backoff.
Approach 2: Use Flash for Lower Priority
# High priority: Use Pro
gemini "[important task]" --yolo -o text
# Lower priority: Use Flash (different quota)
gemini "[less critical task]" -m gemini-2.5-flash -o textApproach 3: Batch Operations
Combine related operations into single prompts:
# Instead of multiple calls:
gemini "Create file A" --yolo
gemini "Create file B" --yolo
gemini "Create file C" --yolo
# Single call:
gemini "Create files A, B, and C with [specs]. Create all now." --yoloApproach 4: Sequential with Delays
For automated scripts, add delays:
gemini "[task 1]" --yolo -o text
sleep 2
gemini "[task 2]" --yolo -o textPattern 6: Context Enrichment
Provide rich context for better results.
Using File References
gemini "Based on @./package.json and @./src/index.js, suggest improvements" -o textUsing GEMINI.md
Create project context that's automatically included:
# .gemini/GEMINI.md
## Project Overview
This is a React app using TypeScript.
## Coding Standards
- Use functional components
- Prefer hooks over classes
- All functions need JSDocExplicit Context in Prompt
gemini "Given this context:
- Project uses React 18 with TypeScript
- State management: Zustand
- Styling: Tailwind CSS
Create a user profile component." --yolo -o textPattern 7: Validation Pipeline
Always validate Gemini's output before using.
Validation Steps
1. Syntax Check
# For JavaScript
node --check generated.js
# For TypeScript
tsc --noEmit generated.ts2. Security Scan
- Check for innerHTML with user input (XSS)
- Look for eval() or Function() calls
- Verify input validation
3. Functional Test
- Run any generated tests
- Manual smoke test
4. Style Check
eslint generated.js
prettier --check generated.jsAutomated Validation Pattern
# Generate
gemini "Create utility functions" --yolo -o text
# Validate
node --check utils.js && eslint utils.js && npm testPattern 8: Incremental Refinement
Build complex outputs in stages.
# Stage 1: Core structure
gemini "Create basic Express server with routes for /api/users" --yolo -o text
# Stage 2: Add feature
gemini "Add authentication middleware to the Express server in server.js" --yolo -o text
# Stage 3: Add another feature
gemini "Add rate limiting to the Express server in server.js" --yolo -o text
# Stage 4: Review all
gemini "Review server.js for issues and optimize" -o textBenefits
- Easier to debug issues
- Each stage validates before continuing
- Clear audit trail
Pattern 9: Cross-Validation with Claude
Use both AIs for highest quality.
Claude Generates, Gemini Reviews
# 1. Claude writes code (using normal Claude Code tools)
# 2. Gemini reviews
gemini "Review this code for bugs and security issues: [paste code]" -o textGemini Generates, Claude Reviews
# 1. Gemini generates
gemini "Create [code]" --yolo -o text
# 2. Claude reviews the output (in conversation)
# "Review this code that Gemini generated..."Different Perspectives
- Claude: Strong on reasoning, following complex instructions
- Gemini: Strong on current web knowledge, codebase investigation
Pattern 10: Session Continuity
Use sessions for multi-turn workflows.
# Initial task
gemini "Analyze this codebase architecture" -o text
# Session saved automatically
# List sessions
gemini --list-sessions
# Continue with follow-up
echo "What patterns did you find?" | gemini -r 1 -o text
# Further refinement
echo "Focus on the authentication flow" | gemini -r 1 -o textUse Cases
- Iterative analysis
- Building on previous context
- Debugging sessions
Anti-Patterns to Avoid
Don't: Expect Immediate Execution
YOLO mode doesn't prevent planning. Gemini may still present plans.
Do: Use forceful language ("Apply now", "Start immediately")
Don't: Ignore Rate Limits
Hammering the API wastes time on retries.
Do: Use appropriate models, batch operations
Don't: Trust Output Blindly
Gemini can make mistakes, especially with security.
Do: Always validate generated code
Don't: Over-Specify in Single Prompt
Extremely long prompts can confuse the model.
Do: Use incremental refinement for complex tasks
Don't: Forget Context Limits
Even with 1M tokens, context can overflow.
Do: Use .geminiignore, be specific about files
Gemini CLI Skill for Claude Code
A Claude Code skill that enables effective use of Google's Gemini CLI as a powerful auxiliary tool.
What This Skill Does
This skill teaches Claude Code how to wield Gemini CLI for:
- Code Generation - Create apps, components, and modules
- Code Review - Security audits, bug detection, improvements
- Test Generation - Unit tests, integration tests
- Documentation - JSDoc, README, API docs
- Web Research - Current information via Google Search
- Architecture Analysis - Codebase investigation and mapping
Installation
Copy the skill directory to your Claude Code skills folder:
# Clone the repo
git clone https://github.com/forayconsulting/gemini_cli_skill.git
# Copy to Claude Code skills directory
cp -r gemini_cli_skill ~/.claude/skills/gemini-cliOr manually create ~/.claude/skills/gemini-cli/ and copy the files.
Prerequisites
- Gemini CLI installed
- Gemini API key or OAuth authentication configured
# Install Gemini CLI
npm install -g @google/gemini-cli
# Authenticate
gemini # First run prompts for authFiles
| File | Purpose |
|---|---|
SKILL.md | Main skill definition - when to use, core instructions |
reference.md | Complete CLI command and flag reference |
templates.md | Reusable prompt templates for common tasks |
patterns.md | Integration patterns and workflows |
tools.md | Gemini's built-in tools documentation |
Usage
Once installed, Claude Code automatically uses this skill when appropriate. Just ask:
"Use Gemini to review this code for security issues"
"Have Gemini generate tests for this module"
"Ask Gemini what's new in TypeScript 5.5"
"Get Gemini to analyze this codebase architecture"Key Features
Prompt Templates
Ready-to-use templates for:
- Code generation (single-file, multi-file, components)
- Code review (comprehensive, security, performance)
- Test generation (unit, integration)
- Documentation (JSDoc, README, API)
Integration Patterns
- Generate-Review-Fix - Quality assurance cycle
- Background Execution - Parallel task processing
- Model Selection - Pro vs Flash decision tree
- Rate Limit Handling - Strategies for free tier limits
Gemini's Unique Tools
google_web_search- Real-time internet searchcodebase_investigator- Deep architecture analysissave_memory- Cross-session persistence
Quick Reference
# Basic generation
gemini "Create [description]" --yolo -o text
# Code review
gemini "Review [file] for bugs and security issues" -o text
# Web research
gemini "What's new in [topic]? Use Google Search." -o text
# Architecture analysis
gemini "Use codebase_investigator to analyze this project" -o text
# Faster model for simple tasks
gemini "[prompt]" -m gemini-2.5-flash -o textWhy Use Gemini from Claude Code?
| Use Case | Benefit |
|---|---|
| Second opinion | Different AI perspective on code |
| Current info | Google Search grounding |
| Architecture | codebase_investigator tool |
| Parallel work | Offload tasks while continuing |
License
MIT
Gemini CLI Command Reference
Complete reference for Gemini CLI v0.16.0+
Installation
npm install -g @google/gemini-cli
# Or without installing:
npx @google/gemini-cliAuthentication
# Option 1: API Key
export GEMINI_API_KEY=your_key
# Option 2: OAuth (interactive)
gemini # First run prompts for authCommand Line Flags
Essential Flags
| Flag | Short | Description |
|---|---|---|
--yolo | -y | Auto-approve all tool calls |
--output-format | -o | Output format: text, json, stream-json |
--model | -m | Model selection (e.g., gemini-2.5-flash) |
Session Management
| Flag | Short | Description |
|---|---|---|
--resume | -r | Resume session by index or "latest" |
--list-sessions | List available sessions | |
--delete-session | Delete session by index |
Execution Options
| Flag | Short | Description |
|---|---|---|
--sandbox | -s | Run in isolated sandbox |
--approval-mode | default, auto_edit, or yolo | |
--timeout | Request timeout in ms | |
--checkpointing | Enable file change snapshots |
Context & Tools
| Flag | Description |
|---|---|
--include-directories | Add directories to workspace |
--allowed-tools | Restrict available tools |
--allowed-mcp-server-names | Restrict MCP servers |
Other Options
| Flag | Short | Description |
|---|---|---|
--debug | -d | Enable debug output |
--version | -v | Show version |
--help | -h | Show help |
--list-extensions | -l | List installed extensions |
--prompt-interactive | -i | Interactive mode with initial prompt |
Output Formats
Text (-o text)
gemini "prompt" -o text
# Returns: Human-readable responseJSON (-o json)
gemini "prompt" -o jsonReturns structured data:
{
"response": "The actual response content",
"stats": {
"models": {
"gemini-2.5-flash": {
"api": {
"totalRequests": 3,
"totalErrors": 0,
"totalLatencyMs": 5000
},
"tokens": {
"prompt": 1500,
"candidates": 500,
"total": 2000,
"cached": 800,
"thoughts": 150,
"tool": 50
}
}
},
"tools": {
"totalCalls": 2,
"totalSuccess": 2,
"totalFail": 0,
"byName": {
"google_web_search": {
"count": 1,
"success": 1,
"durationMs": 3000
}
}
}
}
}Stream JSON (-o stream-json)
Real-time newline-delimited JSON events for monitoring long tasks.
Model Selection
Available Models
| Model | Use Case | Context |
|---|---|---|
gemini-3-pro | Complex tasks (default) | 1M tokens |
gemini-2.5-flash | Quick tasks, lower latency | Large |
gemini-2.5-flash-lite | Fastest, simplest tasks | Medium |
Usage
# Default (Pro)
gemini "complex analysis" -o text
# Flash for speed
gemini "simple task" -m gemini-2.5-flash -o textConfiguration Files
Settings Location
Priority order (highest first): 1. /etc/gemini-cli/settings.json (system) 2. ~/.gemini/settings.json (user) 3. .gemini/settings.json (project)
Example Settings
{
"security": {
"auth": {
"selectedType": "oauth-personal"
}
},
"general": {
"previewFeatures": true,
"vimMode": false,
"checkpointing": true
},
"mcpServers": {}
}Project Context (GEMINI.md)
Create .gemini/GEMINI.md in project root:
# Project Context
Project description and guidelines.
## Coding Standards
- Standards Gemini should follow
## When Making Changes
- Guidelines for modificationsIgnore Files (.geminiignore)
Like .gitignore, excludes files from context:
node_modules/
dist/
*.log
.envSession Management
List Sessions
gemini --list-sessionsOutput:
Available sessions for this project (5):
1. Create task manager (10 minutes ago) [uuid]
2. Review code (20 minutes ago) [uuid]
...Resume Session
# By index
echo "follow-up question" | gemini -r 1 -o text
# Latest session
echo "continue" | gemini -r latest -o textRate Limits
Free Tier Limits
- 60 requests per minute
- 1000 requests per day
Rate Limit Behavior
- CLI auto-retries with exponential backoff
- Message:
"quota will reset after Xs" - Typical wait: 1-5 seconds
Mitigation
1. Use gemini-2.5-flash for simple tasks 2. Batch operations into single prompts 3. Run long tasks in background
Interactive Commands
In interactive mode, these slash commands are available:
| Command | Purpose |
|---|---|
/help | Show available commands |
/tools | List available tools |
/stats | Show token usage |
/compress | Summarize context to save tokens |
/restore | Restore file checkpoints |
/chat save <tag> | Save conversation |
/chat resume <tag> | Resume conversation |
/memory show | Display GEMINI.md context |
/memory refresh | Reload context files |
Piping & Scripting
Pipe Input
echo "What is 2+2?" | gemini -o text
cat file.txt | gemini "summarize this" -o textFile Reference Syntax
In prompts, reference files with @:
gemini "Review @./src/main.js for bugs" -o textShell Command Execution
In interactive mode, prefix with !:
> !git statusKeyboard Shortcuts (Interactive)
| Shortcut | Function |
|---|---|
Ctrl+L | Clear screen |
Ctrl+V | Paste from clipboard |
Ctrl+Y | Toggle YOLO mode |
Ctrl+X | Open in external editor |
Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| "API key not found" | Set GEMINI_API_KEY env var |
| "Rate limit exceeded" | Wait for auto-retry or use Flash |
| "Context too large" | Use .geminiignore or be specific |
| "Tool call failed" | Check JSON stats for details |
Debug Mode
gemini "prompt" --debug -o textError Reports
Full error reports saved to:
/var/folders/.../gemini-client-error-*.jsonGemini CLI Prompt Templates
Reusable prompt templates for common operations.
Code Generation
Single-File Application
gemini "Create a [description] with [features]. Include [requirements]. Output the complete file content." --yolo -o textExample:
gemini "Create a single-file HTML/CSS/JS calculator with: basic operations, history display, keyboard support, dark mode toggle, responsive design. Output the complete file content." --yolo -o textMulti-File Project
gemini "Create a [project type] with [stack]. Include [features]. Create all necessary files and make it runnable. Use modern best practices. START BUILDING NOW." --yolo -o textExample:
gemini "Create a REST API with Express, SQLite, and JWT auth. Include user CRUD, input validation, error handling. Create all necessary files and make it runnable. START BUILDING NOW." --yolo -o textComponent/Module
gemini "Create a [component type] that [functionality]. Follow [standards]. Include [requirements]. Output the code." --yolo -o textExample:
gemini "Create a React hook useLocalStorage that syncs state with localStorage. Follow React 18 best practices. Include TypeScript types. Output the code." --yolo -o textCode Review
Comprehensive Review
gemini "Review [file] and tell me:
1) What features it has
2) Any bugs or security issues
3) Suggestions for improvement
4) Code quality assessment" -o textSecurity-Focused Review
gemini "Review [file] for security vulnerabilities including:
- XSS (cross-site scripting)
- SQL injection
- Command injection
- Insecure data handling
- Authentication issues
Report findings with severity levels." -o textPerformance Review
gemini "Analyze [file] for performance issues:
- Inefficient algorithms
- Memory leaks
- Unnecessary re-renders
- Blocking operations
- Optimization opportunities
Provide specific recommendations." -o textBug Fixing
Fix Identified Bugs
gemini "Fix these bugs in [file]:
1) [Bug description]
2) [Bug description]
3) [Bug description]
Apply fixes now." --yolo -o textAuto-Detect and Fix
gemini "Analyze [file] for bugs, then fix all issues you find. Apply fixes immediately." --yolo -o textTest Generation
Unit Tests
gemini "Generate [framework] unit tests for [file]. Cover:
- All public functions
- Edge cases
- Error handling
- [Specific areas]
Output the complete test file." --yolo -o textExample:
gemini "Generate Jest unit tests for utils.js. Cover:
- All exported functions
- Edge cases (empty input, null, undefined)
- Error handling
- Boundary conditions
Output the complete test file." --yolo -o textIntegration Tests
gemini "Generate integration tests for [component/API]. Test:
- Happy path scenarios
- Error scenarios
- Edge cases
Use [framework]. Output complete test file." --yolo -o textDocumentation
JSDoc/TSDoc
gemini "Generate [JSDoc/TSDoc] documentation for all functions in [file]. Include:
- Function descriptions
- Parameter types and descriptions
- Return types and descriptions
- Usage examples
Output as [format]." --yolo -o textREADME Generation
gemini "Generate a README.md for this project. Include:
- Project description
- Installation instructions
- Usage examples
- API reference
- Contributing guidelines
Use the codebase to gather accurate information." --yolo -o textAPI Documentation
gemini "Document all API endpoints in [file/directory]. Include:
- HTTP method and path
- Request parameters
- Request body schema
- Response schema
- Example requests/responses
Output in [Markdown/OpenAPI] format." --yolo -o textCode Transformation
Refactoring
gemini "Refactor [file] to:
- [Specific improvement]
- [Specific improvement]
Maintain all existing functionality. Apply changes now." --yolo -o textLanguage Translation
gemini "Translate [file] from [source language] to [target language]. Maintain:
- Same functionality
- Similar code structure
- Idiomatic patterns for target language
Output the translated code." --yolo -o textFramework Migration
gemini "Convert [file] from [old framework] to [new framework]. Maintain all functionality. Use [new framework] best practices. Output the converted code." --yolo -o textWeb Research
Current Information
gemini "What are the latest [topic] as of [date]? Use Google Search to find current information. Summarize key points." -o textLibrary/API Research
gemini "Research [library/API] and provide:
- Latest version and changes
- Best practices
- Common patterns
- Gotchas to avoid
Use Google Search for current information." -o textComparison Research
gemini "Compare [option A] vs [option B] for [use case]. Use Google Search for current benchmarks and community opinions. Provide recommendation." -o textArchitecture Analysis
Project Analysis
gemini "Use the codebase_investigator tool to analyze this project. Report on:
- Overall architecture
- Key dependencies
- Component relationships
- Potential issues" -o textDependency Analysis
gemini "Analyze dependencies in this project:
- Direct vs transitive
- Outdated packages
- Security vulnerabilities
- Bundle size impact
Use available tools to gather information." -o textSpecialized Tasks
Git Commit Message
gemini "Analyze staged changes and generate a commit message following conventional commits format. Be concise but descriptive." -o textCode Explanation
gemini "Explain what [file/function] does in detail:
- Purpose and use case
- How it works step by step
- Key algorithms/patterns used
- Dependencies and side effects" -o textError Diagnosis
gemini "Diagnose this error:
[error message]
Context: [relevant context]
Provide:
- Root cause
- Solution steps
- Prevention tips" -o textTemplate Variables
Use these placeholders in templates:
[file]- File path or name[directory]- Directory path[description]- Brief description[features]- List of features[requirements]- Specific requirements[framework]- Testing/UI framework[language]- Programming language[format]- Output format (markdown, JSON, etc.)[date]- Date for time-sensitive queries[topic]- Subject matter for research
Gemini CLI Built-in Tools
Reference for Gemini's built-in tools and their capabilities.
Unique Tools (Not in Claude Code)
These tools are available only through Gemini CLI:
google_web_search
Performs web search using Google Search API.
Capabilities:
- Real-time internet search
- Current information (news, releases, docs)
- Grounded responses with sources
Usage:
gemini "What are the latest React 19 features? Use Google Search." -o textBest For:
- Current events and news
- Latest library versions
- Recent documentation updates
- Community opinions and benchmarks
Example Queries:
- "What are the security vulnerabilities in lodash 4.x? Use Google Search."
- "What's new in TypeScript 5.4? Use Google Search."
- "Best practices for Next.js 14 app router in November 2025."
---
codebase_investigator
Specialized tool for deep codebase analysis.
Capabilities:
- Architectural mapping
- Dependency analysis
- Cross-file relationship detection
- System-wide pattern identification
Usage:
gemini "Use the codebase_investigator tool to analyze this project" -o textOutput Includes:
- Overall architecture description
- Key file purposes
- Component relationships
- Dependency chains
- Potential issues/inconsistencies
Best For:
- Onboarding to new codebases
- Understanding legacy systems
- Finding hidden dependencies
- Architecture documentation
Example:
gemini "Use codebase_investigator to map the authentication flow in this project" -o text---
save_memory
Saves information to persistent long-term memory.
Capabilities:
- Cross-session persistence
- Key-value storage
- Recall in future sessions
Usage:
gemini "Remember that this project uses Zustand for state management. Save this to memory." -o textBest For:
- Project conventions
- User preferences
- Recurring context
- Custom instructions
---
Standard Tools
These tools are similar to Claude Code's capabilities:
list_directory
Lists files and subdirectories in a path.
Parameters:
path: Directory to listignore: Glob patterns to exclude
Example Output:
src/
components/
utils/
index.js
package.json
README.md---
read_file
Reads file content with truncation for large files.
Supported Formats:
- Text files (all types)
- Images (PNG, JPG, GIF, WEBP, SVG, BMP)
- PDF documents
Parameters:
path: File pathoffset: Starting line (for large files)limit: Number of lines
Large File Handling: If file exceeds limit, output indicates truncation and provides instructions for reading more with offset/limit.
---
search_file_content
Fast content search powered by ripgrep.
Advantages over grep:
- Optimized performance
- Automatic output limiting (max 20k matches)
- Better pattern matching
Parameters:
pattern: Regex patternpath: Search root- Various ripgrep flags
---
glob
Pattern-based file finding.
Returns:
- Absolute paths
- Sorted by modification time (newest first)
Example Patterns:
src/**/*.ts- All TypeScript files in src**/*.test.js- All test files**/README.md- All READMEs
---
web_fetch
Fetches content from URLs.
Capabilities:
- HTTP/HTTPS URLs
- Local addresses (localhost)
- Up to 20 URLs per request
Usage:
gemini "Fetch and summarize https://example.com/docs" -o text---
write_todos
Internal task tracking.
Capabilities:
- Track subtasks for complex requests
- Organize multi-step work
- Prevent missed steps
Automatic Usage: Gemini uses this internally for complex tasks.
---
Tool Invocation
Automatic Tool Selection
Gemini automatically selects appropriate tools based on the prompt:
| Prompt Type | Tool Selected |
|---|---|
| "What files are in src/" | list_directory |
| "Find all TODO comments" | search_file_content |
| "Read package.json" | read_file |
| "Find all React components" | glob |
| "What's new in Vue 4?" | google_web_search |
| "Analyze this codebase" | codebase_investigator |
Explicit Tool Requests
You can explicitly request tools:
gemini "Use the codebase_investigator tool to..." -o text
gemini "Search the web for..." -o text
gemini "Use glob to find all..." -o text---
Tool Statistics in JSON Output
When using -o json, tool usage is reported:
{
"stats": {
"tools": {
"totalCalls": 3,
"totalSuccess": 3,
"totalFail": 0,
"totalDurationMs": 5000,
"totalDecisions": {
"accept": 0,
"reject": 0,
"modify": 0,
"auto_accept": 3
},
"byName": {
"google_web_search": {
"count": 1,
"success": 1,
"fail": 0,
"durationMs": 3000,
"decisions": {
"auto_accept": 1
}
},
"read_file": {
"count": 2,
"success": 2,
"fail": 0,
"durationMs": 2000,
"decisions": {
"auto_accept": 2
}
}
}
}
}
}---
Comparison with Claude Code Tools
| Capability | Claude Code | Gemini CLI |
|---|---|---|
| File listing | LS, Glob | list_directory, glob |
| File reading | Read | read_file |
| File writing | Write, Edit | write_file (in YOLO) |
| Code search | Grep | search_file_content |
| Web fetch | WebFetch | web_fetch |
| Web search | WebSearch | google_web_search |
| Architecture | Task (Explore) | codebase_investigator |
| Memory | N/A | save_memory |
| Task tracking | TodoWrite | write_todos |
Bold = Gemini's unique advantage
---
Tool Restrictions
Using allowed-tools
In settings or command line, restrict available tools:
gemini --allowed-tools "read_file,glob" "Find config files" -o textIn Settings
{
"security": {
"allowedTools": ["read_file", "list_directory", "glob"]
}
}---
Best Practices
When to Use Specific Tools
google_web_search:
- Need current/recent information
- Checking latest versions
- Finding documentation updates
- Community solutions to problems
codebase_investigator:
- New to a codebase
- Understanding complex systems
- Finding hidden dependencies
- Creating documentation
save_memory:
- Recurring project context
- User preferences
- Custom conventions
Tool Combination Patterns
Research → Implement:
gemini "Use Google Search to find best practices for [topic], then implement them" --yolo -o textAnalyze → Report:
gemini "Use codebase_investigator to analyze the project, then write a summary report" --yolo -o textSearch → Read → Modify:
gemini "Find all files using deprecated API, read them, and suggest updates" -o text