Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:05:57 +08:00
commit e61ef10236
5 changed files with 282 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
---
name: gemini-cli-integration
description: Use the gemini-cli-integration skill PROACTIVELY when analyzing large codebases, multiple files, or directories. Leverages Google Gemini's massive context window with @ syntax for file inclusion to handle comprehensive codebase analysis, implementation verification, and architectural understanding.
---
# Gemini CLI Plugin for Large Codebase Analysis
Use the Gemini CLI with its massive context window when analyzing large codebases or multiple files that might exceed context limits.
## Core Usage
Execute `gemini -p` with the `@` syntax to include files and directories. Paths are relative to the current working directory.
### File Inclusion Patterns
**Single file analysis:**
```bash
gemini -p "@src/main.py Explain this file's purpose and structure"
```
**Multiple files:**
```bash
gemini -p "@package.json @src/index.js Analyze the dependencies used in the code"
```
**Entire directory:**
```bash
gemini -p "@src/ Summarize the architecture of this codebase"
```
**Multiple directories:**
```bash
gemini -p "@src/ @tests/ Analyze test coverage for the source code"
```
**Current directory recursively:**
```bash
gemini -p "@./ Give me an overview of this entire project"
```
**Alternative to @ syntax:**
```bash
gemini --all_files -p "Analyze the project structure and dependencies"
```
## Implementation Verification Workflows
### Feature Implementation Analysis
Verify specific features are implemented across the codebase:
```bash
# Check for feature implementation
gemini -p "@src/ @lib/ Has dark mode been implemented in this codebase? Show me the relevant files and functions"
# Authentication verification
gemini -p "@src/ @middleware/ Is JWT authentication implemented? List all auth-related endpoints and middleware"
# Pattern detection
gemini -p "@src/ Are there any React hooks that handle WebSocket connections? List them with file paths"
```
### Security and Quality Assurance
Verify security measures and coding standards:
```bash
# Error handling verification
gemini -p "@src/ @api/ Is proper error handling implemented for all API endpoints? Show examples of try-catch blocks"
# Security measures
gemini -p "@src/ @api/ Are SQL injection protections implemented? Show how user inputs are sanitized"
# Rate limiting
gemini -p "@backend/ @middleware/ Is rate limiting implemented for the API? Show the implementation details"
```
### Infrastructure and Testing
Check infrastructure components and test coverage:
```bash
# Caching strategy verification
gemini -p "@src/ @lib/ @services/ Is Redis caching implemented? List all cache-related functions and their usage"
# Test coverage analysis
gemini -p "@src/payment/ @tests/ Is the payment processing module fully tested? List all test cases"
```
## Advanced CLI Options
For advanced usage scenarios, leverage additional CLI options:
### Safety and Approval Modes
```bash
# Auto-approve edit tools only (safer than full YOLO)
gemini --approval-mode auto_edit -p "@src/ Refactor this code for better performance"
# Full auto-approval (use with caution)
gemini --approval-mode yolo -p "@src/ @tests/ Update all tests to use new syntax"
# Specify allowed tools for selective automation
gemini --allowed-tools edit,read -p "@src/ Review and fix syntax issues"
```
### Session Management
```bash
# Resume previous analysis sessions
gemini --resume latest -p "@src/ Continue the security analysis we started"
# List available sessions
gemini --list-sessions
# Delete old sessions
gemini --delete-session 3
```
### Model and Output Configuration
```bash
# Specify Pro model for difficult analysis
gemini --model gemini-2.5-pro -p "@src/ Analyze this code architecture"
# JSON output for programmatic processing
gemini --output-format json -p "@src/ List all API endpoints" > endpoints.json
# Include additional directories beyond current workspace
gemini --include-directories ../shared-lib -p "@src/ Analyze dependencies"
```
### Extensions and MCP Integration
```bash
# Use specific extensions for enhanced analysis
gemini --extensions security-testing -p "@src/ Perform security analysis"
# List available extensions
gemini --list-extensions
# Use specific MCP servers for specialized tools
gemini --allowed-mcp-server-names code-analyzer -p "@src/ Deep code analysis"
```
## When to Use This Skill
Use `gemini` with appropriate options when:
- **Context limitations**: Analyzing entire codebases or large directories that exceed standard context windows
- **Multi-file comparison**: Comparing multiple large files simultaneously
- **Architecture understanding**: Need to understand project-wide patterns or architectural decisions
- **File size considerations**: Working with files totaling more than 100KB
- **Implementation verification**: Verifying if specific features, patterns, or security measures are implemented
- **Pattern analysis**: Checking for the presence of certain coding patterns across the entire codebase
- **Automated workflows**: Using approval modes for batch operations or refactoring tasks
- **Session continuity**: Resuming complex analyses across multiple sessions
- **Specialized analysis**: Leveraging extensions or MCP servers for domain-specific insights
## Best Practices
- **Specific queries**: Be specific about what you're looking for to get accurate results
- **Path management**: Remember that paths in @ syntax are relative to your current working directory
- **Content inclusion**: The CLI includes file contents directly in the context
- **Safety considerations**: Use appropriate approval modes - avoid --yolo for destructive operations
- **Context awareness**: Gemini's context window can handle entire codebases that would overflow Claude's context
- **Session utilization**: Use session management for complex, multi-step analyses
- **Extension leverage**: Utilize appropriate extensions for domain-specific analysis
## Reference Documentation
For complete CLI option reference, see `references/gemini-cli-help` which contains:
- All available commands and options
- Detailed parameter descriptions
- Extension management commands
- MCP server configuration options
## Query Optimization
For best results, structure queries with:
1. **Clear scope**: Specify exactly what files/directories to analyze
2. **Specific objectives**: Clearly state what you're looking for
3. **Expected format**: Request specific output formats when helpful
4. **Context scope**: Include relevant files while excluding unnecessary ones to maintain focus
5. **Tool selection**: Use --allowed-tools to restrict to specific operations when appropriate
6. **Output formatting**: Leverage --output-format json for programmatic processing of results

View File

@@ -0,0 +1,40 @@
```bash
gemini --help
Usage: gemini [options] [command]
Gemini CLI - Launch an interactive CLI, use -p/--prompt for non-interactive mode
Commands:
gemini [query..] Launch Gemini CLI [default]
gemini mcp Manage MCP servers
gemini extensions <command> Manage Gemini CLI extensions. [aliases: extension]
Positionals:
query Positional prompt. Defaults to one-shot; use -i/--prompt-interactive for interactive.
Options:
-d, --debug Run in debug mode? [boolean] [default: false]
-m, --model Model [string]
-p, --prompt Prompt. Appended to input on stdin (if any).
[deprecated: Use the positional prompt instead. This flag will be removed in a future version.] [string]
-i, --prompt-interactive Execute the provided prompt and continue in interactive mode [string]
-s, --sandbox Run in sandbox? [boolean]
-y, --yolo Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more
details)? [boolean] [default: false]
--approval-mode Set the approval mode: default (prompt for approval), auto_edit (auto-approve edit tools), yolo
(auto-approve all tools) [string] [choices: "default", "auto_edit", "yolo"]
--experimental-acp Starts the agent in ACP mode [boolean]
--allowed-mcp-server-names Allowed MCP server names [array]
--allowed-tools Tools that are allowed to run without confirmation [array]
-e, --extensions A list of extensions to use. If not provided, all extensions are used. [array]
-l, --list-extensions List all available extensions and exit. [boolean]
-r, --resume Resume a previous session. Use "latest" for most recent or index number (e.g. --resume 5) [string]
--list-sessions List available sessions for the current project and exit. [boolean]
--delete-session Delete a session by index number (use --list-sessions to see available sessions). [string]
--include-directories Additional directories to include in the workspace (comma-separated or multiple --include-directories)
[array]
--screen-reader Enable screen reader mode for accessibility. [boolean]
-o, --output-format The format of the CLI output. [string] [choices: "text", "json", "stream-json"]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
```