claude-use-gemini-acp
Original:🇺🇸 English
Translated
1 scriptsChecked / no sensitive code detected
Delegate a sub-task to Gemini CLI via the Agent Client Protocol (ACP). Use this skill whenever you want to hand off work to Gemini — large-context summarization, Google Search grounding, tasks that exceed Claude's context window, or anything where Gemini's 1M-token window or real-time search gives an advantage. Also invoke when the user asks you to "ask Gemini", "check with Gemini", or "run this through Gemini". The script handles subprocess lifecycle and ACP session setup; you just provide the prompt and read stdout.
3installs
Added on
NPX Install
npx skill4agent add baphomet480/claude-skills claude-use-gemini-acpTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Claude → Gemini via ACP
Spawn a Gemini CLI subprocess in ACP mode, send a prompt, stream the response to stdout, and terminate cleanly. No persistent session — one prompt, one response.
When to use
- The task requires more context than fits in Claude's window
- You want real-time Google Search grounding
- You want a second opinion from a different model
- The user says "ask Gemini", "use Gemini for this", etc.
Setup (first use only)
bash
cd ~/.claude/skills/claude-use-gemini-acp/scripts
pnpm installThis installs into the local . Subsequent runs skip this step — pnpm caches the result.
@agentclientprotocol/sdknode_modules/Usage
bash
GEMINI_MODEL=gemini-2.5-pro \
TARGET_CWD=/path/to/project \
node ~/.claude/skills/claude-use-gemini-acp/scripts/gemini-delegate.mjs \
"Summarize the architecture in ARCHITECTURE.md and list the top 3 risks"The response streams to stdout as Gemini generates it. Capture it for use in your response:
bash
response=$(node ~/.claude/skills/claude-use-gemini-acp/scripts/gemini-delegate.mjs "your prompt")Environment variables
| Variable | Default | Description |
|---|---|---|
| | Model to use |
| | gemini-cli package version ( |
| current working dir | Working directory passed to the Gemini session |
How it works
- Spawns
pnpm dlx @google/gemini-cli@<version> --acp --yolo --model <model> - Connects via 's
@agentclientprotocol/sdk+ClientSideConnectionndJsonStream - Sends →
initialize→newSessionover the ACP sessionprompt - Streams deltas to stdout as they arrive
agent_message_chunk - Terminates the subprocess once the prompt response completes
The flag () auto-approves all tool calls inside Gemini's session.
--yolo-yPrompt construction tips
- Include all relevant context in the prompt string — this is a fresh session with no prior history
- Reference files by absolute path if you want Gemini to read them (it can use its filesystem tools)
- Keep prompts focused: one clear task per invocation
- For multi-step work, do multiple sequential invocations rather than one sprawling prompt
Error handling
If the script exits non-zero, check stderr for:
- download failures (network, auth)
pnpm dlx - Gemini auth errors (may be needed)
gemini auth login - ACP initialization failures (version mismatch)
The script does not retry — if something fails, surface the error to the user and suggest re-running after fixing the root cause.