gemini

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gemini Second Opinion

Gemini第二意见

Use Gemini to get an independent review from a model with a 1M+ token context window.
使用Gemini获取来自具备1M+ token上下文窗口的模型的独立评审意见。

Invocation

调用方式

Use
-p
for non-interactive (headless) mode. Always use
-o text
for plain text output.
Prefer telling Gemini to read files directly over piping via stdin. Gemini can read files within the project workspace on its own, and stdin truncates at 8MB.
bash
undefined
使用
-p
参数启用非交互式(无界面)模式。始终使用
-o text
参数以获取纯文本输出。
优先让Gemini直接读取文件,而非通过标准输入(stdin)管道传输内容。Gemini可自行读取项目工作区内的文件,而stdin会在8MB处截断内容。
bash
undefined

PREFERRED: Tell Gemini to read files itself (non-interactive)

推荐方式:让Gemini自行读取文件(非交互式)

gemini -p "Read the files in /path/within/project/ and review them for bugs" -o text

```bash
gemini -p "Read the files in /path/within/project/ and review them for bugs" -o text

```bash

OK for small content: pipe via stdin

适用于小体积内容:通过stdin管道传输

git diff main..HEAD | gemini -p "Review this diff for issues" -o text
undefined
git diff main..HEAD | gemini -p "Review this diff for issues" -o text
undefined

Workspace Sandbox

工作区沙箱

Gemini is sandboxed to the project directory. It cannot read files outside the workspace, even via symlinks.
If files live outside the project (e.g.,
~/.claude/
), copy them into the project first, then clean up after:
bash
cp -r ~/.claude/some-data /path/to/project/.tmp-data
gemini -o text "Read the files in /path/to/project/.tmp-data/ and analyze them"
rm -rf /path/to/project/.tmp-data
Gemini被限制在项目目录的沙箱中。它无法读取工作区外的文件,即使通过符号链接也不行。
如果文件位于项目外部(例如
~/.claude/
),请先将其复制到项目内,之后再清理:
bash
cp -r ~/.claude/some-data /path/to/project/.tmp-data
gemini -o text "Read the files in /path/to/project/.tmp-data/ and analyze them"
rm -rf /path/to/project/.tmp-data

Workflow

工作流程

  1. Gather context: Identify the files, plans, or diffs Gemini needs
  2. Ensure accessibility: If files are outside the workspace, copy them in
  3. Compose a focused prompt: Be specific about what to review and what feedback you want
  4. Invoke Gemini: Tell it to read files directly, or pipe small content via stdin. Always use
    -p
    and
    -o text
  5. Clean up: Remove any temporary copies
  6. Report findings: Present Gemini's feedback to the user with your own assessment of which points are valid
  1. 收集上下文:确定Gemini需要处理的文件、方案或差异内容
  2. 确保可访问性:若文件在工作区外,先将其复制进来
  3. 编写明确的提示词:具体说明评审内容和所需反馈类型
  4. 调用Gemini:让它直接读取文件,或通过stdin传输小体积内容。始终使用
    -p
    -o text
    参数
  5. 清理工作:删除所有临时复制的文件
  6. 汇报结果:向用户呈现Gemini的反馈,并附上你对哪些反馈有效的评估

Prompt Guidelines

提示词指南

  • State the review goal explicitly (e.g., "find logical errors", "evaluate scalability", "check for missing edge cases")
  • Include constraints or requirements Gemini should check against
  • Ask for structured output (numbered issues, severity levels) for actionable feedback
  • For large volumes of files, tell Gemini to read the directory rather than listing each file
  • 明确说明评审目标(例如:“查找逻辑错误”、“评估可扩展性”、“检查是否遗漏边缘情况”)
  • 列出Gemini需要对照检查的约束条件或要求
  • 要求结构化输出(如编号问题、严重程度等级)以获取可执行的反馈
  • 针对大量文件,让Gemini读取整个目录而非逐个列出文件