| name | connect-gemini |
| description | Use when the user wants to wire Google's Gemini CLI into Claude Code as a second independent model — for a second opinion, Google-grounded web search, very-large-context analysis, and code review. Triggers on "подключи гемини", "поставь gemini в claude code", "связка claude+gemini", "настрой gemini", "install gemini connector", "connect gemini to claude code", "set up gemini cli". Installs the `/gemini` and `/gemini-review` slash commands plus a `gemini` subagent that shells out to the local, already-authenticated `gemini` CLI. |
Connect Gemini to Claude Code
Goal: stand up Google's gemini CLI as a second model inside Claude Code. The user gets a /gemini slash command (one-shot ask), a /gemini-review slash command (independent review of the current git diff), and a gemini subagent that Claude can dispatch for parallel/background work. There is no official Google plugin (unlike OpenAI's codex@openai-codex), so this is a lightweight wrapper over the locally installed, OAuth-authenticated gemini CLI.
When NOT to invoke
- User wants the Gemini CLI on its own (no Claude Code integration) — install it and stop.
- User expects image generation from
/gemini — the gemini CLI is a coding/text agent and CANNOT generate Nano Banana images. It can only read/analyze images. Image generation needs the separate Gemini image API (GEMINI_API_KEY).
- Commands already installed (
/gemini exists) — skip to verification.
Requirements
gemini CLI installed (Homebrew gemini-cli or npm @google/gemini-cli)
- A Google account authenticated to the CLI (
gemini first-run OAuth; uses Code Assist / AI credits, not an API key)
- Claude Code installed and running
- macOS or Linux with
brew or npm
Process
1. Ensure the Gemini CLI is installed and authenticated
command -v gemini || brew install gemini-cli
gemini --version
If never logged in, run gemini once interactively and complete the Google OAuth in the browser. Smoke-test headless:
gemini --skip-trust -p "Reply with exactly: GEMINI OK" 2>/dev/null
2. Install the connector files
Three files place the connector. Either run the installer:
curl -fsSL https://raw.githubusercontent.com/sergeyramas/connect-gemini-skill/main/install.sh | bash
…or create them by hand at:
~/.claude/commands/gemini.md — the /gemini command
~/.claude/commands/gemini-review.md — the /gemini-review command
~/.claude/agents/gemini.md — the gemini subagent
(Contents live in this repo under connector/.)
3. Restart Claude Code
Slash commands and the subagent register only after a restart. Fully quit and relaunch.
4. Verify
/gemini Reply with exactly one line: GEMINI CONNECTOR OK, then your model name.
Expected: a clean one-line answer attributed to Gemini.
Resulting capabilities
/gemini <question> — one-shot Gemini query. Second opinion, Google-grounded web search, huge context.
/gemini-review — independent code review of the current git diff (review-only).
gemini subagent — Claude can dispatch Gemini for parallel/background sub-tasks.
Under the hood every call is gemini --skip-trust -p "<task>" 2>/dev/null (suppress cosmetic stderr). Add --include-directories <path> for large context, -m gemini-2.5-pro for a stronger model, -m gemini-2.5-flash for cheap bulk work.
Anti-patterns
- Expecting image generation — the CLI cannot generate images (Nano Banana). It reads images only.
- Skipping the Claude Code restart after placing the files — commands stay invisible.
- Relying on the default model (
gemini-2.0-flash-thinking-exp) for serious review — force -m gemini-2.5-pro.
- Letting
/gemini edit files — keep it read/think-only (no --yolo); use the subagent with an explicit mandate if mutation is needed.
- Forgetting auth — a never-logged-in CLI errors on the first headless call; run
gemini interactively once.