gemini-cli
This skill should be used when the user asks to "use gemini", "gemini cli", "configure gemini", "set up gemini", "gemini review", "gemini images", or mentions general Gemini CLI usage. For specific topics, focused skills may be more appropriate.
What this skill does
# Gemini CLI Development
Use the Gemini CLI as a complementary AI tool for large context review and image generation tasks, orchestrated from within Claude Code.
## Prerequisites
### Install Gemini CLI
```bash
npm install -g @google/gemini-cli
```
Or via npx (no install):
```bash
npx @google/gemini-cli
```
### Authentication (choose one)
**Option 1: API Key (simplest)**
```bash
export GEMINI_API_KEY="your-api-key-here"
```
**Option 2: Google OAuth**
```bash
gemini auth login
```
**Option 3: Vertex AI**
```bash
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
export GOOGLE_CLOUD_PROJECT="your-project-id"
```
### Install nano-banana Extension
```bash
gemini extensions install https://github.com/gemini-cli-extensions/nanobanana
```
For nano-banana image generation, also set (if using a separate key):
```bash
export NANOBANANA_GEMINI_API_KEY="your-key"
```
## Critical Rules
### Gemini is Advisory Only
**Gemini MUST NEVER modify source files, configuration, or any project content.** Its role in this plugin is strictly:
1. **Advisor** — review code, analyze logs, provide recommendations
2. **Image creator** — generate images, icons, patterns via nano-banana
Gemini's output is always returned to Claude Code for the user to act on. Gemini does not implement fixes, refactor code, bump versions, or make any changes. If Gemini suggests a fix, Claude Code presents the suggestion — the user decides whether to apply it.
**For reviews, always use `--sandbox` mode** to enforce read-only access:
```bash
gemini --sandbox -m gemini-3-pro-preview -p "Review this code..."
```
**Never use `--yolo` for reviews.** The `--yolo` flag auto-approves all tool calls including file writes. It is ONLY permitted for image generation via nano-banana (which requires tool approval for the generate command).
### Always Use the CLI
**Every task in this plugin MUST execute the Gemini CLI via Bash.** The entire purpose of this plugin is to delegate work to Gemini — not to do it with Claude. If you find yourself reading files with Read/Grep/Glob and analyzing them, you are doing it wrong. Instead, pipe content directly to `gemini -p` in a single Bash command.
## Core Usage: Headless Mode
The key integration pattern is Gemini's **headless mode** (`-p` flag), which accepts a prompt and returns output non-interactively. All content gathering and the gemini call should be a **single piped Bash command**:
```bash
# Simple prompt
gemini -m gemini-3-pro-preview -p "Explain this error: ..."
# Pipe file content for review
cat large-file.ts | gemini -m gemini-3-pro-preview -p "Review this code for bugs and security issues" 2>&1
# Pipe a directory of files
find src/ -name "*.ts" -type f | sort | while read f; do echo "=== FILE: $f ==="; cat "$f"; done | gemini -m gemini-3-pro-preview -p "Review this codebase" 2>&1
# Use sandbox mode (default for all reviews — read-only, no file writes)
gemini --sandbox -m gemini-3-pro-preview -p "Analyze this codebase"
```
### Model Policy
**Always use the preferred model first.** Only fallback if it returns an error (quota, unavailable, capacity).
| Task | Preferred Model | Fallback Model |
|------|----------------|----------------|
| Text reviews | `gemini-3-pro-preview` | `gemini-2.5-pro` |
| Image generation | `gemini-3-pro-image-preview` | `gemini-2.5-flash-image` |
For image generation, always prepend `NANOBANANA_MODEL=gemini-3-pro-image-preview` to gemini commands (unless the user has set `NANOBANANA_MODEL` in their environment). For text reviews, use `-m gemini-3-pro-preview`.
If a model returns an error, retry with the fallback and inform the user which model was used.
```bash
# Text review (default)
gemini -m gemini-3-pro-preview -p "Your prompt here"
# Text review (fallback)
gemini -m gemini-2.5-pro -p "Your prompt here"
# Image generation (default)
NANOBANANA_MODEL=gemini-3-pro-image-preview gemini --yolo -p '/generate "prompt"'
# Image generation (fallback)
NANOBANANA_MODEL=gemini-2.5-flash-image gemini --yolo -p '/generate "prompt"'
```
### Configuration
Gemini CLI uses `GEMINI.md` files (similar to `CLAUDE.md`) for project context:
```bash
# Create project context file
echo "# Project: My App\nStack: React, TypeScript, Node.js" > GEMINI.md
```
Settings file location: `~/.gemini/settings.json`
### Recommended Settings for Gemini 3 Pro
Gemini 3 Pro requires **Preview Features** to be enabled. Without this setting, `-m gemini-3-pro-preview` will fail with a model not found error. The SessionStart hook checks for this automatically.
**Enable via CLI:** Run `gemini`, then use the `/settings` command and enable Preview Features.
**Enable via settings.json** (`~/.gemini/settings.json`):
```json
{
"general": {
"previewFeatures": true
}
}
```
**Recommended settings for optimal plugin integration:**
```json
{
"general": {
"previewFeatures": true,
"enableAutoUpdate": true
},
"tools": {
"disableLLMCorrection": true
}
}
```
**Model selection modes:**
| Mode | Setting | Models Used |
|------|---------|-------------|
| Auto (Gemini 3) | `/model` → Auto (Gemini 3) | gemini-3-pro-preview, gemini-3-flash-preview |
| Auto (Gemini 2.5) | `/model` → Auto (Gemini 2.5) | gemini-2.5-pro, gemini-2.5-flash |
| Manual | `/model` → Manual | Any available model |
Note: The `/model` setting does NOT affect headless mode (`-m` flag). This plugin always uses `-m gemini-3-pro-preview` explicitly, so the `/model` setting only matters for interactive use.
## Focused Skills
For specific tasks, use these focused skills:
| Topic | Skill | Trigger Phrases |
|-------|-------|-----------------|
| Large Context Review | `gemini-cli:gemini-review` | "review with gemini", "gemini code review", "analyze large file" (requires `GEMINI_API_KEY` or `GOOGLE_API_KEY`) |
| Image Generation | `gemini-cli:gemini-images` | "generate image", "create icon", "nano-banana", "gemini image" |
## Common Patterns
### Delegating to Gemini for Large Context
When a task involves reviewing more context than is practical in the current session:
```bash
# Review an entire codebase directory (--sandbox ensures read-only)
find src/ -name "*.ts" -exec cat {} + | gemini --sandbox -m gemini-3-pro-preview -p "Review this TypeScript codebase for: 1) Security vulnerabilities 2) Performance issues 3) Code quality"
# Review a large log file
gemini --sandbox -m gemini-3-pro-preview -p "Summarize errors and patterns in this log" < /var/log/app.log
# Compare implementations
diff -u old.ts new.ts | gemini --sandbox -m gemini-3-pro-preview -p "Review this diff for correctness and potential regressions"
```
### Using Gemini with File Context
```bash
# Pass specific files as context (--sandbox ensures read-only)
gemini --sandbox -m gemini-3-pro-preview -p "Given these files, suggest improvements" --file src/api.ts --file src/types.ts
# Review with project context
gemini --sandbox -m gemini-3-pro-preview -p "Review the architecture of this project" --file package.json --file tsconfig.json --file src/index.ts
```
## Troubleshooting
For debugging issues, the gemini-troubleshoot agent can diagnose common problems:
- CLI not found
- Authentication failures
- Extension issues
- Model availability
## Resources
- Gemini CLI docs: https://geminicli.com/docs/
- nano-banana extension: https://github.com/gemini-cli-extensions/nanobanana
- Gemini models: https://ai.google.dev/gemini-api/docs/models
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.