AgentSkillsCN

gemini-cli

使用Gemini CLI进行AI辅助任务、代码审查,以及多模型协作。Gemini为代码、设计与决策提供了独特的第二视角。 适用场景如下: - 为代码或架构获取第二意见 - 从不同的AI视角审视设计方案 - 与多个AI模型并行开展分析 - 需要Gemini专属的能力支持(如长上下文等)

SKILL.md
--- frontmatter
name: gemini-cli
description: |
  Use the Gemini CLI for AI-assisted tasks, code review, and multi-model collaboration.
  Gemini provides a second perspective on code, designs, and decisions.

  Use when:
  - Getting a second opinion on code or architecture
  - Reviewing designs from a different AI perspective
  - Running parallel analysis with multiple AI models
  - Needing Gemini-specific capabilities (long context, etc.)

Gemini CLI

Use the gemini CLI for AI-assisted tasks and multi-model collaboration.

Prerequisites

bash
# Check if installed
which gemini

# If not installed
brew install gemini  # or npm install -g @google/gemini-cli

# Set API key
export GEMINI_API_KEY="your-key"  # https://aistudio.google.com/apikey

Usage Patterns

One-Shot Query (Non-Interactive)

bash
# Simple query
gemini "Explain this error: ${error_message}"

# With file context (pipe content)
cat src/auth.py | gemini "Review this authentication code for security issues"

# With specific model
gemini -m gemini-2.0-flash "Quick summary of this diff" < git_diff.txt

Interactive Session

bash
# Start interactive
gemini

# Start with initial prompt, continue interactively
gemini -i "Let's review the checkout flow"

Code Review

bash
# Review a file
cat src/checkout.ts | gemini "Review this code. Focus on:
1. Error handling
2. Edge cases
3. Performance"

# Review a diff
git diff HEAD~1 | gemini "What are the risks of these changes?"

Multi-Model Collaboration

Use Gemini alongside Claude for diverse perspectives:

bash
# Get Gemini's take, then compare with Claude
cat design.md | gemini "Critique this architecture" > gemini_review.md

# Use wicked-kanban to track the conversation
/wicked-kanban:new-task "Architecture review" --priority P1
# Add both AI perspectives as comments

Integration with wicked-kanban

For persistent cross-AI conversations:

bash
# Create a task for the discussion
/wicked-kanban:new-task "Design review: Auth system"

# Add Gemini's perspective as a comment
gemini "Review auth design" | python3 ${CLAUDE_PLUGIN_ROOT}/../wicked-kanban/scripts/kanban.py add-comment PROJECT TASK "Gemini: $(cat)"

# Claude can then respond with its own perspective

Available Options

OptionDescription
-m MODELSpecify model (gemini-2.0-flash, gemini-1.5-pro, etc.)
-i PROMPTStart interactive with initial prompt
-yYOLO mode - auto-accept all actions
-sSandbox mode
-e EXTUse specific extensions
-rResume previous session

Best Practices

  1. Be specific: Gemini works best with clear, focused prompts
  2. Pipe content: Use stdin for context rather than describing files
  3. Compare perspectives: Use both Gemini and Claude for important decisions
  4. Track decisions: Use wicked-kanban or wicked-mem to record AI insights