Shell out to Gemini CLI from Claude for headless AI task execution. This skill enables Claude to leverage Gemini 2.5 Pro alongside its own capabilities for parallel analysis, alternative perspectives, and batch processing.
This skill provides a framework for executing non-interactive Gemini tasks where content is piped to the Gemini CLI, processed with custom prompts, and results are saved directly to files. Use it to combine Claude's and Gemini's strengths for comprehensive analysis and processing.
Use this skill when you need:
- Alternative AI perspective on Claude's analysis
- Parallel analysis from both Claude and Gemini
- Gemini's specific strengths for particular tasks
- Headless (non-interactive) AI execution saving to files
- Batch processing of multiple inputs
- Independent validation of Claude's work
Don't use when:
- Claude can handle the task directly without needing a second perspective
- Interactive conversation is required (gemini CLI is headless only)
cat input.md | gemini "PROMPT" --model gemini-2.5-pro > output.md# Claude creates analysis in conversation
# Then get Gemini's independent review
cat analysis.md | gemini "Review this analysis and provide your perspective. Identify anything missed or alternative viewpoints." --model gemini-2.5-pro > gemini_perspective.mdThe fundamental pattern has four components:
- Input (optional):
cat file1.md file2.md- Concatenate input files - Pipe:
|- Send output to next command - Gemini CLI:
gemini "PROMPT" --model gemini-2.5-pro- Process with Gemini - Output:
> output.md- Save results to file
- Use for: Complex reasoning, deep analysis, sophisticated multi-step tasks
- Speed: Slower, but more capable
- Best for: Code reviews, architectural analysis, detailed critiques
- Use for: Simple transformations, quick processing, basic analysis
- Speed: Much faster
- Best for: Batch processing, simple formatting, straightforward summaries
Specify with: --model gemini-2.5-pro or --model gemini-2.5-flash
Get Gemini's viewpoint on Claude's work:
cat claude_analysis.md | gemini "Review this analysis. Provide alternative viewpoints and identify gaps." --model gemini-2.5-pro > gemini_view.mdBoth AIs analyze the same input:
# Claude analyzes in conversation, then:
cat document.md | gemini "Analyze this document for key insights and recommendations." --model gemini-2.5-pro > gemini_analysis.md
# Compare both analysesIndependent code review:
cat code.py | gemini "You are a senior Python developer. Review this code for: 1) Design patterns, 2) Potential issues, 3) Security concerns, 4) Optimization opportunities." --model gemini-2.5-pro > code_review.mdCompare multiple approaches:
cat approach_a.md approach_b.md | gemini "Compare these approaches. Create a table with pros/cons, then recommend when to use each." --model gemini-2.5-pro > comparison.mdProcess multiple files:
for file in *.md; do
cat "$file" | gemini "Summarize this document" --model gemini-2.5-flash > "summaries/${file%.md}_summary.md"
doneSynthesize multiple sources:
cat source1.md source2.md source3.md | gemini "Synthesize key insights from these sources. Create an executive summary followed by detailed findings." --model gemini-2.5-pro > synthesis.md"You are [ROLE].
Task: [WHAT TO DO]
Input: [WHAT YOU'RE ANALYZING]
Output: [DESIRED FORMAT]
Context: [CONSTRAINTS/AUDIENCE]"
- Define the role: "You are an expert technical writer..."
- Specify output format: "Format as Markdown with clear headings"
- Break into steps: Multi-part instructions for complex tasks
- Set constraints: Audience, focus areas, length limits
gemini "You are an expert editor for top-tier technical publications.
Task: Analyze the provided article using the rubric that follows.
Output: Comprehensive review in Markdown format with scores and specific, actionable feedback for each criterion.
Context: This is for a developer audience seeking advanced technical insights." --model gemini-2.5-pro- Claude creates initial analysis → saves to file
- Gemini reviews and enhances → saves refinement
- Compare both results
- Claude analyzes in conversation
- Gemini analyzes same content → saves to file
- Compare perspectives, synthesize insights
- Claude: Interactive exploration, code generation
- Gemini: Batch processing, alternative perspectives
- Combine results for complete solution
# First pass
cat input.md | gemini "Analyze..." --model gemini-2.5-pro > v1.md
# Second pass with feedback
cat v1.md | gemini "Review and improve this analysis. Focus on..." --model gemini-2.5-pro > v2.mdRecommended structure when using this skill:
work/
├── gemini_output/ # Gemini-generated files
│ ├── analysis.md
│ ├── review.md
│ └── synthesis.md
├── claude_output/ # Claude-generated files
└── combined/ # Synthesized results
- Verify gemini CLI is installed:
which gemini - Check file paths exist:
ls -la input.md - Ensure prompt is properly quoted (use
"...") - Verify model flag:
--model gemini-2.5-pro
- Make prompt more specific
- Add role definition
- Request structured format
- Try
gemini-2.5-proinstead offlash
Use single quotes for outer prompt if inner quotes needed:
gemini 'Say "Hello World"' --model gemini-2.5-proBasic command:
cat input.md | gemini "PROMPT" --model gemini-2.5-pro > output.mdMultiple inputs:
cat file1.md file2.md file3.md | gemini "PROMPT" --model gemini-2.5-pro > output.mdPrompt-only (no input file):
gemini "Generate a checklist for..." --model gemini-2.5-pro > checklist.mdBest practices checklist:
- ✅ Always specify model with
--model - ✅ Define role in prompt
- ✅ Request structured output format
- ✅ Use descriptive output filenames
- ✅ Save Gemini output to dedicated directory
Complete skill documentation including:
- Detailed use cases
- Advanced patterns
- Prompt engineering techniques
- Error handling
Deep-dive into CLI mechanics:
- Command breakdown
- Pipe operator explanation
- Output redirection details
- Workflow examples
Scenario: Claude writes a Python function, get Gemini's independent review.
Step 1 - Claude's work (in conversation):
def process_data(items):
"""Process items and return summary."""
return sum(len(x) for x in items)Step 2 - Save to file (Claude writes):
# Claude saves function to function.pyStep 3 - Get Gemini's perspective:
cat function.py | gemini "You are a senior Python developer. Review this function for: 1) Code quality, 2) Potential issues, 3) Improvements. Be specific and provide examples." --model gemini-2.5-pro > gemini_review.mdStep 4 - Compare & Synthesize:
- Review Gemini's feedback in
gemini_review.md - Compare with Claude's implementation
- Synthesize best approach combining both perspectives
This skill requires the gemini CLI to be installed and configured. Ensure you have:
- Google's gemini CLI installed
- Proper authentication configured
- Access to gemini-2.5-pro and gemini-2.5-flash models
Use this skill strategically to complement Claude's capabilities with Gemini's independent analysis, enabling richer insights through multi-AI collaboration.