gemini-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gemini CLI Skill

Gemini CLI 技能

Use Google’s
gemini
CLI as an external “second brain” when you need a very large context window, a second opinion, or safe sandbox execution. This skill does not use MCP; it runs the local CLI directly.
使用Google的
gemini
CLI作为外部“第二大脑”,当你需要超大上下文窗口、第二种意见或安全的沙箱执行时。该技能使用MCP;它直接运行本地CLI。

When To Use

使用场景

Use this skill when the user asks to:
  • “Ask Gemini” / “Use Gemini”
  • Analyze or summarize large files or directories (especially with
    @path
    references)
  • Brainstorm options with a specific framework (SCAMPER, design thinking, etc.)
  • Generate structured edit suggestions (“change mode”) that can be applied deterministically
当用户要求以下操作时使用此技能:
  • “Ask Gemini” / “Use Gemini”
  • 分析或总结大型文件或目录(尤其是带有
    @path
    引用的)
  • 使用特定框架进行头脑风暴(SCAMPER、设计思维等)
  • 生成可确定性应用的结构化编辑建议(“变更模式”)

Prerequisites

前提条件

  • gemini
    CLI is installed and configured (e.g.
    gemini --version
    works)
  • You are allowed to run local shell commands in this environment
  • For sandbox execution, Gemini CLI supports
    -s/--sandbox
    (see
    gemini --help
    )
  • gemini
    CLI已安装并配置完成(例如
    gemini --version
    可正常运行)
  • 你被允许在此环境中运行本地shell命令
  • 对于沙箱执行,Gemini CLI支持
    -s/--sandbox
    (详见
    gemini --help

Core Commands

核心命令

One-shot query (plain)

一次性查询(纯文本)

bash
gemini "Explain what this code does: @src/main.ts"
bash
gemini "Explain what this code does: @src/main.ts"

Choose a model

选择模型

bash
gemini -m gemini-3-pro-preview "..."
gemini -m gemini-3-flash-preview "..."
bash
gemini -m gemini-3-pro-preview "..."
gemini -m gemini-3-flash-preview "..."

Sandbox mode

沙箱模式

bash
gemini -s "Safely test @scripts/example.py and explain the results."
bash
gemini -s "Safely test @scripts/example.py and explain the results."

Helper Script (Recommended)

辅助脚本(推荐)

This skill ships with a dependency-free wrapper that mirrors the core behavior of
gemini-mcp-tool
without MCP:
skills/gemini-cli/scripts/gemini-tool.mjs
Important: Gemini CLI can only read files under its current “project directory” (typically the process working directory). Run the wrapper from the repo you want Gemini to read, or pass
--cwd
.
bash
node skills/gemini-cli/scripts/gemini-tool.mjs help
此技能附带一个无依赖的封装脚本,可在不使用MCP的情况下复刻
gemini-mcp-tool
的核心行为:
skills/gemini-cli/scripts/gemini-tool.mjs
重要提示:Gemini CLI仅能读取其当前“项目目录”下的文件(通常为进程工作目录)。从你希望Gemini读取的仓库中运行该封装脚本,或传递
--cwd
参数。
bash
node skills/gemini-cli/scripts/gemini-tool.mjs help

Ask Gemini (wrapper)

调用Gemini(封装脚本)

bash
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "Summarize @. in 5 bullets."
node skills/gemini-cli/scripts/gemini-tool.mjs ask --cwd /path/to/project --prompt "Summarize @. in 5 bullets."
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --model gemini-3-pro-preview
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --sandbox
bash
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "Summarize @. in 5 bullets."
node skills/gemini-cli/scripts/gemini-tool.mjs ask --cwd /path/to/project --prompt "Summarize @. in 5 bullets."
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --model gemini-3-pro-preview
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --sandbox

Brainstorm (wrapper)

头脑风暴(封装脚本)

bash
node skills/gemini-cli/scripts/gemini-tool.mjs brainstorm --prompt "How should we design onboarding?" --methodology scamper --ideaCount 12
bash
node skills/gemini-cli/scripts/gemini-tool.mjs brainstorm --prompt "How should we design onboarding?" --methodology scamper --ideaCount 12

Change Mode (structured edits + chunk caching)

变更模式(结构化编辑 + 块缓存)

Use change mode when you want Gemini to output deterministic OLD/NEW blocks that can be applied by exact string matching.
bash
node skills/gemini-cli/scripts/gemini-tool.mjs ask --changeMode --prompt "In @src/foo.ts, rename Foo to Bar and update call sites."
If the response is chunked, the output includes a
cacheKey
. Fetch the next chunk:
bash
node skills/gemini-cli/scripts/gemini-tool.mjs fetch-chunk --cacheKey <key> --chunkIndex 2
当你希望Gemini输出可确定性匹配的OLD/NEW块,以便通过精确字符串匹配应用时,使用变更模式。
bash
node skills/gemini-cli/scripts/gemini-tool.mjs ask --changeMode --prompt "In @src/foo.ts, rename Foo to Bar and update call sites."
如果响应被分块,输出将包含一个
cacheKey
。获取下一个块:
bash
node skills/gemini-cli/scripts/gemini-tool.mjs fetch-chunk --cacheKey <key> --chunkIndex 2

Safety Rules

安全规则

  • Never execute destructive commands from Gemini output without explicit user approval.
  • In change mode, the
    OLD
    block must match the file content exactly; otherwise, do not apply the edit.
  • Prefer read-only analysis unless the user explicitly requests changes.
  • 未经用户明确批准,绝不要执行Gemini输出中的破坏性命令。
  • 在变更模式下,
    OLD
    块必须与文件内容完全匹配;否则,不要应用编辑。
  • 除非用户明确请求变更,否则优先选择只读分析。