gemini-cli
Gemini AIのCLIツールをClaude Code内で活用し、AI連携やコード分析、ツール実行を可能にすることで、Google AIやマルチモーダルタスクなど、より高度なAI機能を活用するSkill。
📜 元の英語説明(参考)
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.
🇯🇵 日本人クリエイター向け解説
Gemini AIのCLIツールをClaude Code内で活用し、AI連携やコード分析、ツール実行を可能にすることで、Google AIやマルチモーダルタスクなど、より高度なAI機能を活用するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o gemini-cli.zip https://jpskill.com/download/9432.zip && unzip -o gemini-cli.zip && rm gemini-cli.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9432.zip -OutFile "$d\gemini-cli.zip"; Expand-Archive "$d\gemini-cli.zip" -DestinationPath $d -Force; ri "$d\gemini-cli.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
gemini-cli.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
gemini-cliフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Gemini CLI 統合
Google の Gemini CLI を Claude Code に統合し、Claude と Gemini 間のシームレスな AI コラボレーションを実現して、機能を強化します。
使用場面
- Google AI/Gemini モデルを使用する場合
- マルチモーダル機能(テキスト + 画像)が必要な場合
- ReAct アーキテクチャによる複雑な推論が必要な場合
- Web 検索および取得機能が必要な場合
- MCP サーバー統合
- Gemini を使用したコード分析と生成
- AI モデルの出力を比較する場合
クイックスタート
1. Gemini CLI のインストール
# Node.js のバージョンを確認 (18+ が必要、20+ を推奨)
node --version
# NPM 経由でグローバルにインストール
npm install -g @google/gemini-cli
# またはインストールせずに使用
npx @google/gemini-cli
2. 認証の設定
オプション A: Google OAuth (推奨 - 無料)
# Gemini を起動し、OAuth フローに従う
gemini
# ブラウザが開き、Google 認証が行われます
オプション B: API キー
# https://aistudio.google.com/ からキーを取得
export GEMINI_API_KEY="your-api-key-here"
# または ~/.gemini/.env ファイルを作成
echo 'GEMINI_API_KEY="your-api-key-here"' > ~/.gemini/.env
3. 基本的な使い方
# 簡単なプロンプト (手動での承認が必要)
gemini -p "Explain this code: $(cat main.py)"
# YOLO モード (すべてのアクションを自動承認 - 自動化に推奨)
gemini --yolo -p "Analyze and optimize this codebase"
# インタラクティブセッション
gemini -i "Let's analyze my project"
# YOLO で特定のディレクトリを含める
gemini --include-directories ./src,./tests --yolo -p "Review and improve this codebase"
# 自動実行で特定のモデルを使用
gemini -m gemini-2.5-flash --yolo -p "Generate tests for all functions"
YOLO モード - 注意して使用
--yolo はすべてのアクションを自動的に承認します。控えめに使用してください - 強力ですが危険です。
✅ 安全な YOLO 操作
# 読み取り専用の分析 (安全)
gemini --yolo -p "Analyze code quality in @./src and generate report"
# ドキュメントの生成 (リスクが低い)
gemini --yolo -p "Add JSDoc comments to all functions in ./src"
# 小さく、アトミックな操作 (検証可能)
gemini --yolo -p "Fix ESLint errors in @./utils.js"
# 冪等な操作 (再試行しても安全)
gemini --yolo -p "Format all JavaScript files with Prettier"
⚠️ YOLO を安全対策とともに使用
# 常に最初にバックアップを作成
git stash push -m "pre-yolo-backup"
gemini --yolo -p "Refactor authentication module"
# ロールバックにチェックポイントを使用
gemini --checkpointing --yolo -p "Major code modernization"
# ドライランプレビューと組み合わせる
gemini --dry-run -p "Database migration" # 最初にレビュー
gemini --yolo -p "Execute reviewed migration" # その後自動化
❌ YOLO を絶対に使用しない場合
- 複雑な、複数ステップのワークフロー - 代わりにシーケンシャルなステップに分割
- 本番システムの変更 - 常に手動でレビュー
- データベース操作 - 人間の検証が必要
- セキュリティ構成 - 自動化するには重要すぎる
- ファイルの削除 - データ損失のリスク
- 不明/未テストの操作 - 最初に手動でテスト
より良い代替手段: 反復的なワークフロー
大規模な YOLO タスクの代わりに、Claude が調整するループを使用します。
# ❌ 危険: 1 つの巨大な YOLO タスク
gemini --yolo -p "Complete Express.js to Fastify migration"
# ✅ 安全: Claude がガイドするシーケンシャルなステップ
gemini -p "Step 1: Analyze Express dependencies" # レビュー
gemini --yolo -p "Step 2: Install Fastify packages" # 安全
gemini -p "Step 3: Convert first route" # レビュー
gemini --yolo -p "Step 4: Run tests" # 安全
# 反復的に続行...
Claude + Gemini コラボレーションパターン
AI 間連携: Claude と Gemini は、構造化された反復的なワークフローで連携するのが最適です。
Think-Act-Observe ループ
Claude が調整し、Gemini が実行する - AI コラボレーションのための最も強力なパターン:
# 1. Claude が THINK (考える): 目標を分析
# "認証モジュールをリファクタリングする必要がある。まず、構造を理解する。"
# 2. Claude が Gemini に ACT (行動) するように指示:
gemini -p "List all functions and their signatures in @./src/auth.js" > auth_analysis.txt
# 3. Claude が OBSERVE (観察) する:
cat auth_analysis.txt
# Claude がレビューし、次のステップを決定
# 4. Claude が特定のアトミックなアクションを指示:
gemini --yolo -p "Add try-catch error handling to the 'login' function in @./src/auth.js"
# 5. Claude が検証:
gemini --yolo -p "Run tests in tests/auth.test.js and report results"
# 6. Claude がテスト結果に基づいて反復
AI 解析のための構造化された出力
機械可読な結果を得るには、--output-format json を使用:
# Claude が解析できる構造化されたデータを取得
gemini --output-format json -p "List all Python files in ./src" > files.json
# Claude は JSON を確実に処理できる
cat files.json | jq '.files[]'
# 構造化された分析
gemini --output-format json -p "Analyze security issues in @./src/auth.js" > security_report.json
# Claude が特定のフィールドを解析
jq '.vulnerabilities[] | .severity' security_report.json
ドライランによる安全な自動化
実行前に操作をプレビュー:
# Claude が最初に計画をプレビュー
gemini --dry-run -p "Refactor the authentication system"
# 出力には、実行せずに計画されたツール呼び出しが表示される
# Claude がレビューして承認した後:
gemini --yolo -p "Execute the reviewed refactoring plan"
シーケンシャルなタスク分解
複雑なタスクをアトミックで検証可能なステップに分割:
#!/bin/bash
# Claude が調整するワークフロー
# BAD: 複雑すぎ、予測不可能
# gemini --yolo -p "Create a complete Express.js API with authentication"
# GOOD: シーケンシャルで検証可能なステップ
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 が続行する前にレビュー
echo "Step 5: Verify"
gemini --yolo -p "Run tests and report re 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Gemini CLI Integration
Integrates Google's Gemini CLI into Claude Code, enabling seamless AI collaboration between Claude and Gemini for enhanced capabilities.
When to Use
- Working with Google AI/Gemini models
- Need multimodal capabilities (text + images)
- Complex reasoning with ReAct architecture
- Web search and fetching capabilities
- MCP server integration
- Code analysis and generation with Gemini
- Comparing AI model outputs
Quick Start
1. Install Gemini CLI
# 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
2. Setup Authentication
Option A: Google OAuth (Recommended - Free)
# Start Gemini and follow OAuth flow
gemini
# Will open browser for Google authentication
Option B: API Key
# 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
3. Basic Usage
# 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 Mode - Use with Caution
--yolo automatically approves all actions. USE SPARINGLY - it's powerful but risky.
✅ Safe YOLO Operations
# 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"
⚠️ Use YOLO with Safeguards
# 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
❌ NEVER Use YOLO For
- Complex, multi-step workflows - Break into sequential steps instead
- Production system modifications - Always manual review
- Database operations - Require human verification
- Security configurations - Too critical for automation
- File deletions - Risk of data loss
- Unknown/untested operations - Test manually first
Better Alternative: Iterative Workflows
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...
Claude + Gemini Collaboration Patterns
AI-to-AI Integration: Claude and Gemini work best together with structured, iterative workflows.
The Think-Act-Observe Loop
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
Structured Output for AI Parsing
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
Safe Automation with Dry-Run
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"
Sequential Task Decomposition
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"
Tool Discovery and Schema
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
Error Handling Patterns
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
Context Management
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"
Checkpoint and Restore
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>
Core Workflows
Code Analysis Workflow
# 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"
Documentation Generation
# 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"
Multimodal Analysis
# 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"
Web Research
# 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"
Advanced Features
Interactive Commands
# 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
Tool Execution
# 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"
MCP Server Integration
# 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"
Checkpointing
# Enable checkpointing
gemini --checkpointing -p "Refactor this entire module"
# List checkpoints
gemini checkpoint list
# Restore checkpoint
gemini checkpoint restore <id>
Configuration
Settings File (~/.gemini/settings.json)
{
"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"]
}
}
}
Environment Variables
# 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"
Integration Patterns
Claude + Gemini Collaboration
# 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]"
Parallel Analysis
# Get different perspectives
echo "Analyze security of auth.js" | tee \
>(claude-cli) \
>(gemini -p -)
Model Comparison
# Compare outputs
PROMPT="Generate unit tests for utils.js"
echo "Claude:" && claude-cli "$PROMPT"
echo "Gemini:" && gemini -p "$PROMPT"
Best Practices
Security
-
API Key Management
- Never commit API keys
- Use environment variables
- Rotate keys regularly
-
Tool Execution
- Avoid
--yolofor untrusted prompts - Use
--sandboxfor experiments - Review tool calls before approval
- Avoid
-
MCP Server Trust
- Only trust known servers
- Use include/exclude tool lists
- Set appropriate timeouts
Performance
-
Model Selection
- Use
gemini-2.5-flashfor quick tasks - Use
gemini-2.5-profor complex reasoning - Consider token limits (1M context window)
- Use
-
Directory Management
- Exclude unnecessary directories
- Use specific includes for large projects
- Leverage checkpointing for long tasks
-
Rate Limiting
- OAuth: 60 req/min, 1000 req/day
- API Key: Varies by tier
- Implement retry logic
Workflow Optimization
-
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"
Troubleshooting
Common Issues
-
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>
Examples
Complete Project Analysis (Automated)
#!/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"
Automated Documentation Suite
#!/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"
Framework Migration (Auto-Pilot)
#!/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"
Daily Development Automation
#!/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"
Related Skills
gemini-auth: Authentication managementgemini-chat: Interactive chat sessionsgemini-tools: Tool execution workflowsgemini-mcp: MCP server managementgemini-code: Code-specific operations
Updates
This 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