Gemini CLI Integration Patterns
Description
Advanced patterns for orchestrating Gemini CLI effectively from Claude Code.
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
Repository README
This is the README for forayconsulting/gemini_cli_skill, shared by 3 entries
in this directory. It describes the repository, not this entry specifically.
Gemini CLI Integration Patterns
Advanced patterns for orchestrating Gemini CLI effectively from Claude Code.
Pattern 1: Generate-Review-Fix Cycle
The most reliable pattern for quality code generation.
# Step 1: Generate code
gemini "Create [code description]" --yolo -o text
# Step 2: Have Gemini review its own work
gemini "Review [generated file] for bugs and security issues" -o text
# Step 3: Fix identified issues
gemini "Fix these issues in [file]: [list from review]. Apply now." --yolo -o text
Why It Works
- Different "mindset" for generation vs review
- Self-correction catches common mistakes
- Security vulnerabilities often caught in review phase
Example
# Generate
gemini "Create a user authentication module with bcrypt and JWT" --yolo -o text
# Review
gemini "Review auth.js for security vulnerabilities" -o text
# Output: "Found XSS risk, missing input validation, weak JWT secret"
# Fix
gemini "Fix in auth.js: XSS risk, add input validation, use env var for JWT secret. Apply now." --yolo -o text
Pattern 2: JSON Output for Programmatic Processing
Use JSON output when you need to process results programmatically.
gemini "[prompt]" -o json 2>&1
Parsing the Response
// In Node.js or with jq
const result = JSON.parse(output);
const content = result.response;
const tokenUsage = result.stats.models["gemini-2.5-flash"].tokens.total;
const toolCalls = result.stats.tools.byName;
Use Cases
- Extracting specific data from responses
- Monitoring token usage
- Tracking tool call success/failure
- Building automation pipelines
Pattern 3: Background Execution
For long-running tasks, execute in background and continue working.
# Start in background
gemini "[long task]" --yolo -o text 2>&1 &
# Get process ID for later
echo $!
# Monitor output incrementally with BashOutput tool
When to Use
- Code generation for large projects
- Documentation generation
- Running multiple Gemini tasks in parallel
Parallel Execution
# Run multiple tasks simultaneously
gemini "Create frontend" --yolo -o text 2>&1 &
gemini "Create backend" --yolo -o text 2>&1 &
gemini "Create tests" --yolo -o text 2>&1 &
Pattern 4: Model Selection Strategy
Choose the right model for the task.
Decision Tree
Is the task complex (architecture, multi-file, deep analysis)?
├── Yes → Use default (Gemini 3 Pro)
└── No → Is speed critical?
├── Yes → Use gemini-2.5-flash
└── No → Is it trivial (formatting, simple query)?
├── Yes → Use gemini-2.5-flash-lite
└── No → Use gemini-2.5-flash
Examples
# Complex: Architecture analysis
gemini "Analyze codebase architecture" -o text
# Quick: Simple formatting
gemini "Format this JSON" -m gemini-2.5-flash -o text
# Trivial: One-liner
gemini "What is 2+2?" -m gemini-2.5-flash -o text
Pattern 5: Rate Limit Handling
Strategies for working within rate limits.
Approac
Related Skills
Auto Update
Pull the latest ECC repo changes and reinstall the current managed targets.
Development Ecc Guide
Navigate ECC's current agents, skills, commands, hooks, install profiles, and docs from the live repository su
Development Epic Claim
Claim an epic issue, stamp coordination state, and sync local ownership.
Development Epic Publish
Publish a validated epic update back to the issue and local cache.
Development Epic Review
Mark epic review requested, approved, or changes requested.
Development Epic Unblock
Sweep blocked epic issues and reopen anything whose dependencies are closed.
Development Related Agents
Django Build Resolver
Django/Python build, migration, and dependency error resolution specialist. Fixes pip/Poetry errors, migration
Openai Codex CLI
(55.8k ⭐) - Lightweight coding agent that runs in your terminal.
src/agents/ — 11 Agent Definitions
**Generated:** 2026-04-11