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-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 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-3-pro-preview
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-3-pro-preview
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 - 除非用户明确请求变更,否则优先选择只读分析。