gemini について
geminiは、Gemini CLIからGoogleのGemini Proを使って調査、分析、推論を行うスキルです。要約、コード分析、ファクトチェックなどに使うコマンド例とプロンプトパターンを紹介します。
主な機能
- 01Gemini CLIコマンドのガイド
- 02調査と統合のプロンプト
- 03文書の要約
- 04コード分析
- 05ファクトチェックと抽出
- 06出力とエラー処理のヒント
活用シーン
- 01根拠となる事実を伴うテーマ調査
- 02標準入力からの文書要約
- 03コマンドラインでのコード分析
- 04構造化データの抽出
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ johnlindquist/ claude --skill geminiインストール後、Claude Code で/geminiを入力して読み込まれたか確認します。
詳細
Gemini AI アシスタント
Google の Gemini Pro モデルを活用し、100 万トークンのコンテキストウィンドウで、調査、分析、推論のタスクを実行します。
前提条件
Gemini CLI をインストールします:
pip install google-generativeai
API キーを設定します:
export GEMINI_API_KEY=your_api_key
API キーは次の場所で取得できます:https://makersuite.google.com/app/apikey
CLI リファレンス
基本的な使い方
# Simple question
gemini -m pro "Your question here"
# With text output (no markdown)
gemini -m pro -o text "Your question"
# Disable extensions for programmatic use
gemini -m pro -o text -e "" "Your question"
# Pipe content as stdin
echo "content to analyze" | gemini -m pro -o text -e "" "Summarize this"
cat file.txt | gemini -m pro -o text -e "" "Analyze this code"
一般的な操作
調査
批判的な分析を伴う詳細な調査:
gemini -m pro -o text -e "" "You are an expert research analyst. Research: [topic]. Provide specific facts, distinguish opinions from facts, note uncertainties, and give actionable insights."
要約
cat document.txt | gemini -m pro -o text -e "" "Summarize this content, focusing on: [focus area]"
コード分析
cat code.ts | gemini -m pro -o text -e "" "Analyze this code and answer: [question]"
検索結果の統合
gemini -m pro -o text -e "" "Search and synthesize: [query]. Include specific facts, dates, and distinguish confirmed from speculative information."
ファクトチェック
gemini -m pro -o text -e "" "Fact-check this claim: [claim]. State true/false/partial, cite sources, note context."
段階的な推論
gemini -m pro -o text -e "" "Think through this problem step by step: [problem]. Constraints: [constraints]. Provide reasoning and conclusion."
データ抽出
cat content.txt | gemini -m pro -o text -e "" "Extract [what to extract] from this content. Format as [json/list/table]."
ニュース検索
gemini -m pro -o text -e "" "Latest news about: [topic] from [timeframe]. Summarize important developments."
プロンプトテンプレート
調査用プロンプト
You are an expert research analyst. Your goal is to provide genuinely useful, accurate research.
RESEARCH OBJECTIVE: [topic]
QUALITY STANDARDS:
- Be specific and concrete, not vague
- Distinguish between facts, expert opinions, and speculation
- Note when information is uncertain, contested, or evolving
- Identify what's NOT known or what gaps exist
- Provide actionable insights, not just information
分析用プロンプト
Analyze the following and provide:
1. Key findings
2. Implications
3. Recommendations
4. Uncertainties or gaps
Content: [content]
ベストプラクティス
- プログラムから使用する場合は
-o text -e ""を使い、クリーンな出力を取得します - 大きなコンテンツはコマンドライン引数ではなく、標準入力経由でパイプします
- プロンプトは具体的に記述します。曖昧な質問には曖昧な回答が返ってきます
- 出力形式を指定します。解析可能な出力を得るには、リスト、表、JSON を要求します
- 正確さが重要な場合は引用元を要求します
- 長時間の処理ではタイムアウトを設定します(gemini は 30~120 秒かかることがあります)
エラー処理
| エラー | 解決方法 |
|---|---|
| "command not found" | インストールします:pip install google-generativeai |
| "API key" / "unauthorized" | GEMINI_API_KEY 環境変数を設定します |
| "rate limit" / "quota" | 待ってから再試行するか、Google Cloud Console で割り当て量を確認します |
| タイムアウト | クエリを小さく分割するか、タイムアウトを延長します |
コメント
Markdown 対応