gemini-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGemini CLI Skill
Gemini CLI 技能
Use Google’s 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.
gemini当你需要超大上下文窗口、第二种意见或安全的沙箱执行时,可将Google的 CLI作为外部“第二大脑”使用。本技能不使用MCP;它直接运行本地CLI。
geminiWhen To Use
使用场景
Use this skill when the user asks to:
- “Ask Gemini” / “Use Gemini”
- Analyze or summarize large files or directories (especially with references)
@path - 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
前置条件
- CLI is installed and configured (e.g.
geminiworks)gemini --version - You are allowed to run local shell commands in this environment
- For sandbox execution, Gemini CLI supports (see
-s/--sandbox)gemini --help
- 已安装并配置CLI(例如
gemini可正常运行)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-2.5-pro "..."
gemini -m gemini-2.5-flash "..."bash
gemini -m gemini-2.5-pro "..."
gemini -m gemini-2.5-flash "..."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 without MCP:
gemini-mcp-toolskills/gemini-cli/scripts/gemini-tool.mjsImportant: 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 .
--cwdbash
node skills/gemini-cli/scripts/gemini-tool.mjs help本技能附带一个无依赖的包装器,可在不使用MCP的情况下复刻的核心功能:
gemini-mcp-toolskills/gemini-cli/scripts/gemini-tool.mjs重要提示:Gemini CLI仅能读取其当前“项目目录”下的文件(通常为进程工作目录)。请在你希望Gemini读取的仓库中运行该包装器,或传递参数。
--cwdbash
node skills/gemini-cli/scripts/gemini-tool.mjs helpAsk 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-2.5-pro
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --sandboxbash
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-2.5-pro
node skills/gemini-cli/scripts/gemini-tool.mjs ask --prompt "..." --sandboxBrainstorm (wrapper)
头脑风暴(包装器)
bash
node skills/gemini-cli/scripts/gemini-tool.mjs brainstorm --prompt "How should we design onboarding?" --methodology scamper --ideaCount 12bash
node skills/gemini-cli/scripts/gemini-tool.mjs brainstorm --prompt "How should we design onboarding?" --methodology scamper --ideaCount 12Change 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 . Fetch the next chunk:
cacheKeybash
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."如果响应被分块,输出内容将包含一个。获取下一个分块:
cacheKeybash
node skills/gemini-cli/scripts/gemini-tool.mjs fetch-chunk --cacheKey <key> --chunkIndex 2Safety Rules
安全规则
- Never execute destructive commands from Gemini output without explicit user approval.
- In change mode, the block must match the file content exactly; otherwise, do not apply the edit.
OLD - Prefer read-only analysis unless the user explicitly requests changes.
- 未经用户明确批准,绝不要执行Gemini输出中的破坏性命令。
- 在变更模式下,块必须与文件内容完全匹配;否则,请勿应用该编辑。
OLD - 除非用户明确要求修改,否则优先选择只读分析。