Skip to content

Instantly share code, notes, and snippets.

@pedrocid
Created July 16, 2025 17:14
Show Gist options
  • Save pedrocid/603d1fff8c2f9a6614b2e503f5e9e17f to your computer and use it in GitHub Desktop.
Save pedrocid/603d1fff8c2f9a6614b2e503f5e9e17f to your computer and use it in GitHub Desktop.
Comprehensive guide to using Gemini CLI - comparison with Claude Code, strengths, limitations, and best practices

How to Use Gemini CLI: A Comprehensive Guide

Overview

Gemini CLI is a conversational AI assistant similar to Claude Code but powered by Google's Gemini model. After extensive testing, here's what you need to know.

Installation & Version

  • Current Version: 0.1.3
  • Installation: Available via Homebrew (/opt/homebrew/bin/gemini)
  • Language: Interface is in Spanish by default

Basic Usage

Command Structure

gemini [options] [prompt]
echo "your message" | gemini [options]

Key Options

  • -m, --model: Select model (default: gemini-2.5-pro)
  • -p, --prompt: Append prompt to stdin input
  • -s, --sandbox: Run in sandbox mode
  • -d, --debug: Enable debug mode
  • -a, --all_files: Include all files in context
  • -y, --yolo: Auto-accept all actions (dangerous)
  • -c, --checkpointing: Enable file edit checkpointing

What Gemini CLI is Good For

✅ Strengths

  1. Code Analysis: Excellent at identifying bugs and potential issues
  2. Natural Language Understanding: Handles conversational requests well
  3. Explanations: Provides clear, detailed explanations of concepts
  4. Context Awareness: Remembers conversation context and file contents
  5. File Operations: Can read, analyze, and modify files effectively
  6. Planning: Good at breaking down complex tasks into steps

❌ Limitations

  1. Language Barrier: Default Spanish interface can be confusing
  2. File Execution: Doesn't seem to execute file modifications as smoothly as Claude Code
  3. Interactive Mode: Less polished interactive experience compared to Claude Code
  4. Tool Integration: Limited compared to Claude Code's extensive tool ecosystem
  5. Error Handling: Less robust error recovery mechanisms

Comparison with Claude Code

Feature Gemini CLI Claude Code
Code Analysis ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
File Operations ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Interactive Experience ⭐⭐⭐ ⭐⭐⭐⭐⭐
Tool Integration ⭐⭐⭐ ⭐⭐⭐⭐⭐
Error Handling ⭐⭐⭐ ⭐⭐⭐⭐⭐
Language Support ⭐⭐ ⭐⭐⭐⭐⭐

Usage Rules and Best Practices

1. Input Methods

# Direct prompt
gemini -p "Analyze this code for bugs"

# Pipe input
echo "Fix the division by zero error" | gemini

# Combined approach
echo "Review this file" | gemini -p "Focus on security issues"

2. Context Management

  • Use -a, --all_files sparingly as it can overwhelm the context
  • Provide clear, specific prompts for better results
  • Break complex tasks into smaller, focused requests

3. Safety Considerations

  • Never use -y, --yolo flag in production environments
  • Always review suggested changes before applying them
  • Use --sandbox mode for testing potentially dangerous operations

4. Model Selection

  • Default gemini-2.5-pro is suitable for most tasks
  • Consider model capabilities when choosing alternatives

Common Use Cases

Code Review

echo "Review this JavaScript file for bugs and improvements" | gemini -p "Focus on:"

Bug Fixing

echo "Fix the identified issues in the calculator functions" | gemini

Documentation

echo "Generate JSDoc comments for all functions" | gemini -p "Include examples:"

Testing

echo "Create unit tests for the calculator functions" | gemini -p "Use Jest framework:"

When to Use Gemini CLI vs Claude Code

Use Gemini CLI When:

  • You need a second opinion on code analysis
  • Working with Google's ecosystem
  • Prefer Gemini's reasoning style
  • Want to compare AI model outputs

Use Claude Code When:

  • Need robust file operations and tool integration
  • Require extensive interactive capabilities
  • Working on complex, multi-step tasks
  • Need reliable error handling and recovery

Troubleshooting

Common Issues:

  1. Spanish Interface: Currently no obvious way to change language
  2. File Modifications: May not execute as expected - always verify changes
  3. Context Limits: Large codebases may hit context limitations

Solutions:

  • Use specific, targeted prompts
  • Break large tasks into smaller chunks
  • Verify all file modifications manually
  • Use checkpointing (-c) for important edits

Conclusion

Gemini CLI is a capable AI assistant that excels at code analysis and explanations. While it has some limitations compared to Claude Code, it serves well as a complementary tool for getting different perspectives on code problems. The Spanish interface and less polished interactive experience are notable drawbacks, but the core AI capabilities are strong.

Recommendation: Use Gemini CLI as a secondary tool alongside Claude Code for comprehensive code analysis and review, but rely on Claude Code for primary development workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment