Skip to content

Instantly share code, notes, and snippets.

@vgrichina
Last active September 4, 2025 20:55
Show Gist options
  • Save vgrichina/f95027ca233526614a8693cda02cba8d to your computer and use it in GitHub Desktop.
Save vgrichina/f95027ca233526614a8693cda02cba8d to your computer and use it in GitHub Desktop.
My user CLAUDE.md

Using Gemini CLI for Large Codebase Analysis

When analyzing large codebases or multiple files that might exceed context limits, use the Gemini CLI with its massive context window. Use gemini -p to leverage Google Gemini's large context capacity.

File and Directory Inclusion Syntax

Use the @ syntax to include files and directories in your Gemini prompts. The paths should be relative to WHERE you run the gemini command:

Examples:

Files:

gemini -p "@package.json @src/index.js Analyze the dependencies used in the code"

Directories:

gemini -p "@src/ @tests/ Analyze test coverage for the source code"

Current directory and subdirectories:

gemini -p "@./ Give me an overview of this entire project"

Or use --all_files flag:

gemini --all_files -p "Analyze the project structure and dependencies"

When to Use Gemini CLI

Use gemini -p when:

  • Analyzing entire codebases or large directories
  • Comparing multiple large files
  • Need to understand project-wide patterns or architecture
  • Current context window is insufficient for the task
  • Working with files totaling more than 100KB
  • Verifying if specific features, patterns, or security measures are implemented
  • Checking for the presence of certain coding patterns across the entire codebase
  • Need second opinion when cannot immediately resovle some issue

Execution Best Practices

IMPORTANT: For any substantial analysis, always redirect output to a file and run in background.

Why this is essential:

  • Gemini analysis can take several minutes for large codebases
  • Without redirection, you cannot see or save the results
  • Background execution prevents blocking your terminal
  • Need 2>&1 to capture both stdout and stderr in the output file

Important Notes

  • Paths in @ syntax are relative to your current working directory when invoking gemini
  • The CLI will include file contents directly in the context
  • No need for --yolo flag for read-only analysis
  • Gemini's context window can handle entire codebases that would overflow Claude's context
  • When checking implementations, be specific about what you're looking for to get accurate results
  • ALWAYS use output redirection - the analysis is useless if you can't read the results

Test Running Best Practices

  • Always run tests with output to file so that you can grep it later
  • Saving test outputs allows you to easily diff between different test runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment