关于 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 万 token 上下文窗口,完成研究、分析和推理任务。
前置条件
安装 Gemini CLI:
pip install google-generativeai
设置你的 API key:
export GEMINI_API_KEY=your_api_key
在以下地址获取 API key: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 ""进行程序化调用,以获得干净的输出 - 通过 stdin 传入大段内容,而不是使用命令行参数
- 在提示词中要具体 - 模糊的问题只会得到模糊的回答
- 要求结构化输出 - 请求列表、表格或 JSON,以便解析
- 在准确性很重要时要求引用来源
- 为长时间操作设置超时(gemini 可能需要 30-120 秒)
错误处理
| 错误 | 解决方案 |
|---|---|
| "command not found" | 安装:pip install google-generativeai |
| "API key" / "unauthorized" | 设置 GEMINI_API_KEY 环境变量 |
| "rate limit" / "quota" | 稍等后重试,或在 Google Cloud Console 检查配额 |
| 超时 | 拆分为更小的查询,或增加超时时间 |
评论
支持 Markdown