.claude/skills/gemini-cli/SKILL.md
Integrate Gemini AI CLI into Claude Code for AI collaboration, code analysis, and tool execution. Use when working with Gemini AI, Google AI, multimodal tasks, or needing advanced AI capabilities.
npx skillsauth add adaptationio/skrillz gemini-cliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Integrates Google's Gemini CLI into Claude Code, enabling seamless AI collaboration between Claude and Gemini for enhanced capabilities.
# Check Node.js version (requires 18+, recommend 20+)
node --version
# Install globally via NPM
npm install -g @google/gemini-cli
# Or use without installation
npx @google/gemini-cli
# Start Gemini and follow OAuth flow
gemini
# Will open browser for Google authentication
# Get key from https://aistudio.google.com/
export GEMINI_API_KEY="your-api-key-here"
# Or create ~/.gemini/.env file
echo 'GEMINI_API_KEY="your-api-key-here"' > ~/.gemini/.env
# Quick prompt (manual approval required)
gemini -p "Explain this code: $(cat main.py)"
# YOLO mode (auto-approve all actions - RECOMMENDED for automation)
gemini --yolo -p "Analyze and optimize this codebase"
# Interactive session
gemini -i "Let's analyze my project"
# Include specific directories with YOLO
gemini --include-directories ./src,./tests --yolo -p "Review and improve this codebase"
# Use specific model with auto-execution
gemini -m gemini-2.5-flash --yolo -p "Generate tests for all functions"
--yolo automatically approves all actions. USE SPARINGLY - it's powerful but risky.
# Read-only analysis (safe)
gemini --yolo -p "Analyze code quality in @./src and generate report"
# Documentation generation (low risk)
gemini --yolo -p "Add JSDoc comments to all functions in ./src"
# Small, atomic operations (verifiable)
gemini --yolo -p "Fix ESLint errors in @./utils.js"
# Idempotent operations (safe to retry)
gemini --yolo -p "Format all JavaScript files with Prettier"
# Always create backups first
git stash push -m "pre-yolo-backup"
gemini --yolo -p "Refactor authentication module"
# Use checkpointing for rollback
gemini --checkpointing --yolo -p "Major code modernization"
# Combine with dry-run preview
gemini --dry-run -p "Database migration" # Review first
gemini --yolo -p "Execute reviewed migration" # Then automate
Instead of large YOLO tasks, use Claude-orchestrated loops:
# ❌ RISKY: One giant YOLO task
gemini --yolo -p "Complete Express.js to Fastify migration"
# ✅ SAFE: Claude-guided sequential steps
gemini -p "Step 1: Analyze Express dependencies" # Review
gemini --yolo -p "Step 2: Install Fastify packages" # Safe
gemini -p "Step 3: Convert first route" # Review
gemini --yolo -p "Step 4: Run tests" # Safe
# Continue iteratively...
AI-to-AI Integration: Claude and Gemini work best together with structured, iterative workflows.
Claude orchestrates, Gemini executes - the most powerful pattern for AI collaboration:
# 1. Claude THINKS: Analyze the goal
# "I need to refactor the auth module. First, understand the structure."
# 2. Claude directs Gemini to ACT:
gemini -p "List all functions and their signatures in @./src/auth.js" > auth_analysis.txt
# 3. Claude OBSERVES the results
cat auth_analysis.txt
# Claude reviews and decides next step
# 4. Claude directs specific, atomic action:
gemini --yolo -p "Add try-catch error handling to the 'login' function in @./src/auth.js"
# 5. Claude verifies:
gemini --yolo -p "Run tests in tests/auth.test.js and report results"
# 6. Claude iterates based on test results
Use --output-format json for machine-readable results:
# Get structured data Claude can parse
gemini --output-format json -p "List all Python files in ./src" > files.json
# Claude can now reliably process the JSON
cat files.json | jq '.files[]'
# Structured analysis
gemini --output-format json -p "Analyze security issues in @./src/auth.js" > security_report.json
# Claude parses specific fields
jq '.vulnerabilities[] | .severity' security_report.json
Preview operations before execution:
# Claude previews the plan first
gemini --dry-run -p "Refactor the authentication system"
# Output shows planned tool calls without executing
# After Claude reviews and approves:
gemini --yolo -p "Execute the reviewed refactoring plan"
Break complex tasks into atomic, verifiable steps:
#!/bin/bash
# Claude-orchestrated workflow
# BAD: Too complex, unpredictable
# gemini --yolo -p "Create a complete Express.js API with authentication"
# GOOD: Sequential, verifiable steps
echo "Step 1: Initialize project"
gemini --yolo -p "Initialize Node.js project and create server.js"
echo "Step 2: Install dependencies"
gemini --yolo -p "Install express, cors, and body-parser"
echo "Step 3: Basic server"
gemini --yolo -p "Create basic Express server in server.js with hello world route"
echo "Step 4: Add authentication (review this step)"
gemini -p "Add JWT authentication middleware to server.js"
# Claude reviews before proceeding
echo "Step 5: Verify"
gemini --yolo -p "Run tests and report results"
Claude learns available tools:
# Discover what tools Gemini has
gemini tools list
# Get detailed tool schema
gemini tools describe fileSystem
gemini tools describe shell
gemini tools describe google_web_search
# Claude can then construct precise tool calls
Robust automation with proper error handling:
#!/bin/bash
set -e # Exit on error
# Claude-managed error recovery
if ! gemini --yolo -p "Run test suite"; then
echo "Tests failed. Analyzing..."
gemini -p "Analyze test failures and suggest fixes" > fixes.txt
cat fixes.txt
# Claude decides whether to apply fixes
fi
Efficient context for large projects:
# Let Claude select relevant context
gemini --include-directories ./src/auth,./tests/auth \
-p "Focus only on authentication module"
# Use @ syntax for precise file references
gemini -p "Compare @./src/auth-old.js with @./src/auth-new.js"
# Web context
gemini -p "Compare my implementation @./src/api.js with @https://example.com/best-practices"
Safe experimentation with rollback:
# Claude creates checkpoint before risky operations
gemini --checkpointing --yolo -p "Major refactoring of core module"
# If something goes wrong:
gemini checkpoint list
gemini checkpoint restore <checkpoint-id>
# Analyze entire project (auto-execute)
gemini --include-directories . \
--exclude-directories node_modules,.git \
--yolo -p "Analyze this codebase and suggest improvements"
# Code review with auto-fixes
gemini --yolo -p "Review and fix security issues: @./src/auth.js"
# Generate tests automatically
gemini --yolo -p "Generate comprehensive tests for: @./src/utils.js"
# Manual review (when unsure)
gemini -p "Explain the architecture of this complex module: @./src/core.js"
# Generate README (auto-create files)
gemini --include-directories . --yolo -p "Generate a comprehensive README.md for this project"
# API documentation (auto-generate)
gemini --yolo -p "Generate complete API documentation for: @./src/api/"
# Code comments (bulk operation)
gemini --yolo -p "Add detailed JSDoc comments to all functions in: @./src/"
# Manual review for complex docs
gemini -p "Explain the documentation strategy for: @./complex_algorithm.py"
# Analyze images (read-only, safe for YOLO)
gemini --yolo -p "Describe this architecture diagram: @./docs/architecture.png"
# Compare designs (analysis only)
gemini --yolo -p "Compare these UI designs and suggest improvements: @./design1.png @./design2.png"
# Extract and format text
gemini --yolo -p "Extract and format the text from: @./screenshot.png"
# Research with web search (auto-execute)
gemini --yolo -p "Research best practices for React performance optimization and create summary"
# Fetch and analyze (read-only)
gemini --yolo -p "Analyze this documentation: @https://docs.example.com/api"
# Compare implementations (analysis)
gemini --yolo -p "Compare my implementation with: @https://github.com/example/repo and suggest improvements"
# In interactive mode:
/help # Show all commands
/tools # List available tools
/mcp # Show MCP servers
/compress # Summarize conversation
/copy # Copy last response
/clear # Clear context
/checkpoint # Save project state
/restore # Restore checkpoint
/ide install # Setup VS Code
/ide enable # Connect to VS Code
# Auto-approve tool calls (careful!)
gemini --yolo -p "Create a Python script that processes all CSV files"
# Sandbox mode (safer)
gemini --sandbox -p "Set up a new React project"
# Manual approval (default)
gemini -p "Organize my project files"
# List MCP servers
gemini mcp list
# Add MCP server
gemini mcp add
# Remove MCP server
gemini mcp remove <name>
# Use with MCP tools
gemini -p "Use the database MCP server to query user data"
# Enable checkpointing
gemini --checkpointing -p "Refactor this entire module"
# List checkpoints
gemini checkpoint list
# Restore checkpoint
gemini checkpoint restore <id>
{
"model": "gemini-2.5-pro",
"defaultFlags": {
"checkpointing": true,
"includeDirectories": ["./src", "./tests"],
"excludeDirectories": ["node_modules", ".git", "dist"]
},
"tools": {
"shell": {
"enabled": false,
"requireConfirmation": true
},
"fileSystem": {
"enabled": true,
"allowedPaths": ["./"]
},
"web": {
"enabled": true,
"allowedDomains": ["github.com", "docs.google.com"]
}
}
}
# Authentication
export GEMINI_API_KEY="your-key"
# Vertex AI (Enterprise)
export GOOGLE_CLOUD_PROJECT="your-project"
export GOOGLE_CLOUD_LOCATION="us-central1"
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
# Model selection
export GEMINI_MODEL="gemini-2.5-pro"
# Default directories
export GEMINI_INCLUDE_DIRS="./src,./lib"
export GEMINI_EXCLUDE_DIRS="node_modules,.git"
# Use Claude for planning, Gemini for execution
echo "Claude, create a plan for refactoring auth module"
# ... get plan from Claude ...
gemini -p "Execute this refactoring plan: [paste plan]"
# Get different perspectives
echo "Analyze security of auth.js" | tee \
>(claude-cli) \
>(gemini -p -)
# Compare outputs
PROMPT="Generate unit tests for utils.js"
echo "Claude:" && claude-cli "$PROMPT"
echo "Gemini:" && gemini -p "$PROMPT"
API Key Management
Tool Execution
--yolo for untrusted prompts--sandbox for experimentsMCP Server Trust
Model Selection
gemini-2.5-flash for quick tasksgemini-2.5-pro for complex reasoningDirectory Management
Rate Limiting
Batch Operations
# Process multiple files efficiently
gemini -p "Analyze and improve: @./src/*.js"
Context Preservation
# Use interactive mode for related tasks
gemini -i "Let's refactor the auth system"
Output Formatting
# Get JSON output for parsing
gemini --json -p "List all functions in: @./utils.js"
Authentication Failed
# Clear cached credentials
rm -rf ~/.gemini/auth
# Re-authenticate
gemini
Rate Limiting
# Check usage
gemini usage
# Switch to different auth method if needed
Tool Execution Errors
# Check tool availability
gemini -i
/tools
# Verify permissions
MCP Server Issues
# Check server status
gemini mcp status
# Restart server
gemini mcp restart <name>
#!/bin/bash
# Comprehensive project analysis with auto-execution
gemini --include-directories . \
--exclude-directories node_modules,.git,dist \
--checkpointing --yolo \
-p "Perform comprehensive analysis and create reports:
1. Code quality assessment with fixes
2. Security vulnerability scan and patches
3. Performance optimization suggestions
4. Generate missing tests
5. Create complete documentation
6. Update dependencies safely
7. Implement CI/CD pipeline"
#!/bin/bash
# Generate complete documentation suite (fully automated)
gemini --yolo -p "Generate complete documentation ecosystem:
1. README.md with badges and quick start
2. API.md with OpenAPI specification
3. CONTRIBUTING.md with dev workflow
4. CHANGELOG.md with version history
5. JSDoc comments for all functions
6. Architecture diagrams in Mermaid
7. Test documentation and coverage reports
8. Deployment and operations guide"
#!/bin/bash
# Automated framework migration
gemini --checkpointing --yolo \
-p "Fully automated Express.js to Fastify migration:
1. Analyze current Express structure
2. Create detailed migration plan
3. Update package.json dependencies
4. Convert all routes and middleware
5. Update error handling patterns
6. Migrate and update all tests
7. Create docker configuration
8. Verify functionality with test suite
9. Generate migration report"
#!/bin/bash
# Daily automated development tasks
gemini --yolo -p "Execute daily development workflow:
1. Pull latest changes safely
2. Update dependencies to latest stable
3. Run full test suite and fix failures
4. Update documentation for any changes
5. Optimize code performance
6. Run security audit and fix issues
7. Generate daily progress report
8. Commit and push changes with proper messages"
gemini-auth: Authentication managementgemini-chat: Interactive chat sessionsgemini-tools: Tool execution workflowsgemini-mcp: MCP server managementgemini-code: Code-specific operationsThis skill tracks Gemini CLI updates. Check for new features:
# Update Gemini CLI
npm update -g @google/gemini-cli
# Check version
gemini --version
# View changelog
gemini changelog
development
Setup secure web-based terminal access to WSL2 from mobile/tablet via ttyd + ngrok/Cloudflare/Tailscale. One-command install, start, stop, status. Use when you need remote terminal access, web terminal, browser-based shell, or mobile access to WSL2 environment.
development
Complete development workflows where Claude writes the code while Gemini and Codex provide research, planning, reviews, and different perspectives. Claude remains the main developer. Use for complex projects requiring expert planning and multi-perspective reviews.
development
Systematic progress tracking for skill development. Manages task states (pending/in_progress/completed), updates in real-time, reports progress, identifies blockers, and maintains momentum. Use when tracking skill development, coordinating work, or reporting progress.
testing
Comprehensive testing workflow orchestrating functional testing, example validation, integration testing, and usability assessment. Sequential workflow for complete skill testing from examples through scenarios to integration validation. Use when conducting thorough testing, pre-deployment validation, ensuring skill functionality, or comprehensive quality checks.