File Analysis with @ Syntax
One of the most powerful features of Gemini MCP Tool is the ability to analyze files using the @ syntax.
Basic Usage
/gemini-cli:analyze @index.js explain this codeask gemini to analyze the entire codebase and a comment block to the top of every script, explaining that script. Use flash.Ask gemini to explain @index.js by reading the entire codebase firstAsk gemini to analyze @src/ and provide bug fixesAsk gemini what the weather is like in new york...then use gemini to review your recent modificationsMultiple Files
Analyze multiple files in one request:
/gemini-cli:analyze @src/server.js @src/client.js how do these interact?analyze @src/server.js @src/client.js and provide bug fixesEntire Directories
Analyze whole directories:
/gemini-cli:analyze @src/**/*.ts summarize the TypeScript architectureanalyze @main using gemini and determine the top 3 optimizationsWhy @ Syntax?
- Familiar: Both Claude and Gemini natively support it
- Explicit: Clear which files are being analyzed
- Flexible: Works with single files, multiple files, or patterns
Best Practices
1. Be Specific
// Good @src/auth/login.js explain the authentication flow // Too vague @src explain everything2. Use Patterns Wisely
// Analyze all test files @**/*.test.js are all tests passing? // Analyze specific module @modules/payment/*.js review payment logic3. Combine with Questions
@package.json @src/index.js is this properly configured?4. Speak Naturally
What does gemini think about that?ask gemini to get a second opinionToken Optimization
Gemini's massive context window allows analyzing entire codebases, saving claude tokens.
Examples
Code Review
@feature/new-api.js review this PR changesDocumentation
@src/utils/*.js generate JSDoc commentsDebugging
@error.log @src/handler.js why is this error occurring?