一键导入
gemini-agent
Wrapper around gemini CLI for non-interactive runs (prompt via args/file/stdin) with resume support. Outputs session_id for conversation continuation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Wrapper around gemini CLI for non-interactive runs (prompt via args/file/stdin) with resume support. Outputs session_id for conversation continuation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Wrapper around codex CLI for non-interactive runs (prompt via args/file/stdin) with resume support. Outputs session_id for conversation continuation.
Multi-agent debate orchestrator. Use when you want multiple AI perspectives on a question, plan review, or architectural decision. Runs parallel agent panels with a Chair synthesizing responses.
SDK-based Claude agent with full Task tool access. Use for executing handoff prompts or spawning nested sub-agents.
This skill should be used when the user asks to "implement this plan", "generate execution prompts", "super implement", "create handoff from plan", or wants to transform a large plan into self-contained execution-ready prompt artifacts.
ALWAYS use this skill instead of Read when reading Claude Code transcript files (.jsonl in ~/.claude/projects/, ~/.claude/history.jsonl, or paths containing 'transcript'). Token-efficient format that extracts USER/ASSISTANT exchanges and tool summaries, strips metadata.
Build a phased prompt chain with orchestration file from a monolithic implementation prompt
| name | gemini-agent |
| description | Wrapper around gemini CLI for non-interactive runs (prompt via args/file/stdin) with resume support. Outputs session_id for conversation continuation. |
| allowed-tools | Bash |
Thin wrapper around gemini CLI for non-interactive use:
PROMPT_FILE, or stdin--model or GEMINI_MODEL env var--resume or GEMINI_SESSION env var~/.gemini/oauth_creds.json) for authenticationGemini CLI v0.20.0+ required (for --resume support):
npm install -g @google/gemini-cli@latest
gemini --version # should be 0.20.0 or higher
Authentication (one of these):
gemini interactively once to complete OAuth login (creates ~/.gemini/oauth_creds.json)GEMINI_API_KEY environment variableGOOGLE_GENAI_USE_GCA=true with existing OAuth credsChoose ONE method based on your situation:
| Situation | Method | Example |
|---|---|---|
| Short inline prompt | Args | gemini-agent "Explain X" |
| Prompt already exists in a file | PROMPT_FILE | PROMPT_FILE=task.md gemini-agent |
| Building prompt dynamically | Heredoc | gemini-agent <<'EOF'your promptEOF |
| Piping from another command | Stdin | cat file.md | gemini-agent |
Key concept: PROMPT_FILE means "read this file's contents AS the prompt" - the entire file becomes your prompt.
gemini-agent "Explain how async/await works in JavaScript"
gemini-agent "Review this code for bugs: $(cat snippet.js)"
# The contents of task.md become the prompt
PROMPT_FILE=task.md gemini-agent
# With model selection
PROMPT_FILE=analysis-request.md GEMINI_MODEL=gemini-2.0-flash gemini-agent
gemini-agent <<'EOF'
Context: We're building a VS Code extension.
Question: What's the best way to handle webview state persistence?
Please provide:
1. Recommended approach
2. Code example
3. Common pitfalls
EOF
# Pipe file contents
cat requirements.md | gemini-agent
# Pipe command output
git diff HEAD~3 | gemini-agent "Review these changes:"
Don't combine input methods - use exactly ONE:
# WRONG: PROMPT_FILE with heredoc
PROMPT_FILE=/dev/stdin gemini-agent <<'EOF'
prompt here
EOF
# CORRECT: Just use heredoc directly
gemini-agent <<'EOF'
prompt here
EOF
# WRONG: PROMPT_FILE pointing to stdin
PROMPT_FILE=/dev/stdin gemini-agent
# CORRECT: Use pipe or heredoc
cat myfile.txt | gemini-agent
# WRONG: Mixing PROMPT_FILE with piped input
echo "extra" | PROMPT_FILE=task.md gemini-agent
# (stdin is ignored, only PROMPT_FILE is used - you'll get a warning)
# CORRECT: Choose one source
PROMPT_FILE=task.md gemini-agent
# OR
cat task.md extra.txt | gemini-agent
Capture the [session_id: ...] from output to continue conversations:
# Resume most recent session
gemini-agent --resume latest "Follow-up question"
# Resume by UUID (from previous output)
gemini-agent --resume c9283e30-910e-442c-b567-48ac9e1fab03 "Continue"
# Resume by index (use `gemini --list-sessions` to see available)
gemini-agent --resume 3 "Continue from session 3"
# Via environment variable
GEMINI_SESSION=c9283e30-910e-442c-b567-48ac9e1fab03 gemini-agent "Follow-up"
# Via flag
gemini-agent --model gemini-2.0-flash "Your prompt"
# Via environment variable
GEMINI_MODEL=gemini-2.0-flash gemini-agent "Your prompt"
| Variable | Description |
|---|---|
PROMPT_FILE | Path to file whose contents become the prompt |
GEMINI_MODEL | Model to use (passed as --model) |
GEMINI_SESSION | Session to resume (latest, UUID, or index number) |
GEMINI_API_KEY | API key authentication |
GOOGLE_GENAI_USE_GCA | Set to true for Gemini Code Assist auth |
Returns plain text response followed by the session ID:
<response text>
[session_id: <uuid>]
Capture the session ID to continue the conversation with --resume <uuid>.
Diagnostics are shown automatically on any failure, including:
You can also run diagnostics manually:
gemini-agent --version
gemini interactively once to set up OAuth, or set GEMINI_API_KEYnpm install -g @google/gemini-cligemini --version to check)gemini -y -o json -p <prompt> in non-interactive YOLO mode with JSON output to capture session_idc9283e30-910e-442c-b567-48ac9e1fab03), not partial UUIDsgemini --list-sessions to see available sessions for current projectFor reference, session files are stored at:
~/.gemini/tmp/{project_hash}/chats/session-*.json{project_hash} is the SHA256 hash of the working directory pathgemini --list-sessions to list available sessions without needing to navigate the file structure