用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill gemini-subagent命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | gemini-subagent |
| description | > Use when this capability is needed. |
Claude is the orchestrator. Gemini is a worker subagent with its own fresh context window, its own network access, and its own code execution environment. You hand Gemini a well-scoped task and take back a short answer. Gemini's thinking, tool calls, and file reads happen in Gemini's context, not yours — that is where the token savings come from.
Treat each Gemini call like a function call:
Delegate when any of these apply:
gh api, npm view, pip install. You
(Claude) pay steep token cost for WebFetch/WebSearch; Gemini's network
calls happen in its own context.Edit directly with less overhead than
composing a Gemini prompt.Gut check: if the task would cost you more than ~3k tokens of reads/ searches, delegate. If it's under ~1k, just do it.
Canonical invocation:
filename=$(openssl rand -hex 4)
gemini --approval-mode <MODE> \
[-C <DIR>] \
[--model <MODEL>] \
"<PROMPT>" \
2>>"/tmp/gemini-${filename}.log"
Flag meanings:
--approval-mode <MODE> — see the adaptive ladder below.
-C <DIR> — run Gemini with a specific working directory. Pass this
whenever the task is scoped to a specific project folder; saves Gemini
a cd round-trip.
--model <MODEL> — override Gemini's model if needed (e.g.
gemini-2.5-pro, gemini-2.5-flash). Don't override the user's
default model unless they asked.
Prompt as the last positional argument, quoted. For long/multi- line prompts, use heredoc on stdin:
filename=$(openssl rand -hex 4)
gemini --approval-mode auto_edit \
2>>"/tmp/gemini-${filename}.log" <<'EOF'
Your multi-line
prompt here.
EOF
openssl rand log pattern instead of 2>/dev/null2>/dev/null throws away stderr, so when a call fails you have nothing
to diagnose. The alternative is:
/tmp/gemini-<name>.log instead of /dev/null.You get clean stdout for happy path and full debugging info on failure, without ever bloating Claude's context on the happy path.
The user has authorized adaptive escalation: default to auto_edit mode, escalate to YOLO mode whenever the task actually needs it, without stopping to ask. Don't over-escalate — use the minimum that gets the job done.
| Task shape | Mode | Flag |
|---|---|---|
| Read-only analysis inside workspace | plan mode | --approval-mode plan |
| Local edits / file writes inside a project | auto_edit mode | --approval-mode auto_edit |
Anything needing network (web search, fetch, pip install, npm view, curl, gh api, remote access) | yolo mode | --yolo |
Operating outside the workspace (system paths, ~/.config, other drives) | yolo mode | --yolo |
| Installing global tools, modifying global state | yolo mode | --yolo |
Do tell the user in your one-line status update which mode you picked and why — so they can correct you if your read was wrong. No approval needed, but transparency yes.
Truly destructive ops (rm -rf outside workspace, dropping a
database, force-push, rewriting git history) — stop and confirm with the
user first regardless of mode. The mode protects the
filesystem; it does not divine the user's intent.
Default to Gemini's configured defaults. Override with model selection only when the task class warrants it:
| Task class | Model | Why |
|---|---|---|
| Quick lookup, version check, single-file read | (default / flash) | Not worth the extra tokens |
| Normal code edits and refactors | (default) | Gemini's default is tuned for this |
| Audit, security review, "find all bugs" | gemini-2.5-pro | Needs exhaustive exploration |
| Debugging a subtle failure | gemini-2.5-pro | Needs careful reasoning |
| Bulk scan / pattern matching over many files | (default) | Balance speed and coverage |
Don't ask the user which model to use — pick a sensible default and mention it in the status line. If they want different, they'll say so.
Gemini is a capable coding agent, not a dumb shell. Treat it like a competent colleague who just walked into the room — no memory of your conversation, no context on why the task matters.
A good Gemini prompt has:
Example — bad:
"check what version of react we're on"
Example — good:
"Read package.json in the current directory and report just the 'react'
version string. No other output."
Example — web-search delegation:
filename=$(openssl rand -hex 4)
gemini --yolo \
2>>"/tmp/gemini-${filename}.log" <<'EOF'
Search the web for the current stable version of Bun (as of today).
Check bun.sh and the GitHub releases page. Return a single line:
bun <version> released <date>
EOF
Example — bulk analysis with structured return:
filename=$(openssl rand -hex 4)
gemini --approval-mode auto_edit -C /path/to/repo \
--model gemini-2.5-pro \
2>>"/tmp/gemini-${filename}.log" <<'EOF'
Find every TODO/FIXME comment under src/. For each, judge whether it
looks stale (references removed code, completed work, or is >1 year old
based on git blame). Return a markdown table:
| file:line | comment | stale? | reason |
No prose. Just the table.
EOF
Before launching a new call, consider: is there a recent Gemini session still relevant to what you're about to ask? Gemini keeps session state. Resume is cheap; a new session discards everything Gemini already learned.
Resume syntax (prompt via stdin, no flags):
filename=$(openssl rand -hex 4)
echo "Your follow-up prompt" | gemini --resume latest \
2>>"/tmp/gemini-${filename}.log"
Or with heredoc:
filename=$(openssl rand -hex 4)
gemini --resume latest \
2>>"/tmp/gemini-${filename}.log" <<'EOF'
Follow-up: now also check the peerDependencies field and flag mismatches.
EOF
Resume rules:
resume doesn't accept a prompt positional.--approval-mode, --model on resume.
The resumed session inherits from the original. Passing them causes
errors.When you have multiple independent subtasks, fire them in parallel
instead of sequentially. Use Bash with run_in_background: true, then
collect via TaskOutput on each task_id. This is a token-savings
multiplier — each subagent runs in its own context, all in wall-clock
parallel, and you only see the summaries.
Good candidates for parallel batch:
Bad candidates:
Long Gemini calls (>30s, big analyses, audits, large writes) should go into the background rather than blocking your turn:
run_in_background: true. You get a task_id
immediately and can continue other work.TaskOutput on the task_id with
block: true. You'll either get the finished output or wait for it.TaskStop.Gemini's stdout is your return value. Before you act on it, classify it:
success — call exited 0, stdout answers the prompt, nothing
looks off. Proceed. Ignore the stderr log.
partial — call exited 0 but stdout is empty, truncated, asks
clarifying questions back at you, or hits a known failure mode
(refused to run, couldn't find file, hit a permission wall). Check
the stderr log for why, then either: (a) fix the prompt and dispatch
fresh, (b) escalate the approval mode and retry, or (c) resume with a
clarification.
error — non-zero exit. Don't silently retry. Read the
stderr log first and diagnose. Common failures and fixes:
| Symptom | Likely cause | Fix |
|---|---|---|
operation not permitted / approval mode denial | Need higher approval mode | Escalate approval mode |
network unreachable / DNS failure | Approval mode restricting network | Use --yolo |
127 command not found | gemini not on PATH | Surface to user, don't retry |
| Gemini asked a clarifying question in output | Under-specified prompt | Rewrite prompt with clearer goal / return format |
| Empty output / hit timeout | Task too big for one call | Split into subtasks, or raise timeout |
Once you have a success result:
Read carefully. Don't parrot stdout back to the user verbatim — extract what they actually need and summarize.
Verify when it matters. Gemini runs on Google models with their own cutoffs and can be wrong — especially about recent library versions, model names, APIs, or post-cutoff changes. If the answer is load- bearing and you have reason to doubt, cross-check (your own knowledge, a second Gemini call with a different phrasing, or a direct tool).
Disagree explicitly and resume. If Gemini is wrong, don't just quietly ignore it. Resume the session and push back with evidence. Frame it as peer discussion, not correction — either AI could be wrong:
filename=$(openssl rand -hex 4)
echo "This is Claude following up. I disagree with [X] because \
[evidence]. What's your take?" | \
gemini --resume latest \
2>>"/tmp/gemini-${filename}.log"
Trust file ops. If Gemini said it wrote a file, it wrote it — its
shell actually ran the write. A quick ls -la or targeted
Read is enough to confirm; don't re-read the whole file.
Summarize for the user. One or two sentences: what you delegated, what came back, what you did with it. Don't dump Gemini's stdout into the chat unless the user asked — that re-inflates the context you were trying to save.
Before dispatch — one line, in your normal chat voice:
After — short result summary. One or two sentences. What changed, what's next.
This skill only earns its keep if it actually saves tokens. Gut checks before dispatching:
Edit/Read on small, known targets. Direct
tools are cheaper for tiny ops.Grep finds the answer in
200ms, use Grep.Source: dwgx/claude-gemini-subagent — distributed by TomeVault.