mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
- Add 5-minute timeout for Bash commands in both gemini and codex workflows - Mark --all-files as default behavior for gemini with fallback on content limits - Update all examples to show explicit --all-files usage in gemini-unified.md - Add execution settings section for both workflow guides 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
168 lines
6.2 KiB
Markdown
168 lines
6.2 KiB
Markdown
---
|
|
name: gemini-unified
|
|
description: Consolidated Gemini CLI guidelines - core rules, syntax, patterns, templates, and best practices
|
|
type: technical-guideline
|
|
---
|
|
|
|
### 🚀 Command Overview: `gemini`
|
|
|
|
- **Purpose**: A CLI tool for comprehensive codebase analysis, context gathering, and pattern detection across multiple files.
|
|
- **Directory Analysis Rule**: When user intends to analyze specific directory (cd XXX), always navigate first: `cd XXX && gemini --all-files -p "prompt"`
|
|
- **Primary Triggers**:
|
|
- When user intent is to "analyze", "get context", or "understand the codebase".
|
|
- When a task requires understanding relationships between multiple files.
|
|
- When the problem scope exceeds a single file.
|
|
- **Core Use Cases**:
|
|
- Project-wide context acquisition.
|
|
- Architectural analysis and pattern detection.
|
|
- Identification of coding standards and conventions.
|
|
|
|
### ⚙️ Command Syntax & Arguments
|
|
|
|
- **Basic Structure**:
|
|
```bash
|
|
gemini [flags] -p "@{patterns} {template} prompt"
|
|
```
|
|
- **Key Arguments**:
|
|
- `--all-files`: Includes all files in the current working directory. **Default behavior unless content limit exceeded**.
|
|
- `-p`: The prompt string, which must contain file reference patterns and the analysis query.
|
|
- `{template}`: Template injection using `$(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt)` for standardized analysis
|
|
- `@{pattern}`: A special syntax for referencing files and directories.
|
|
|
|
- **Template Usage**:
|
|
```bash
|
|
# Without template (manual prompt) - --all-files is default
|
|
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} Analyze code patterns and conventions"
|
|
|
|
# With template (recommended) - --all-files is default
|
|
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)"
|
|
|
|
# Multi-template composition - --all-files is default
|
|
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat <<'EOF'
|
|
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt)
|
|
|
|
Additional Security Focus:
|
|
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/security.txt)
|
|
EOF
|
|
)"
|
|
```
|
|
|
|
|
|
### 📂 File Pattern Rules
|
|
|
|
- **Syntax**:
|
|
- `@{pattern}`: Single file or directory pattern.
|
|
- `@{pattern1,pattern2}`: Multiple patterns, comma-separated.
|
|
- **Wildcards**:
|
|
```bash
|
|
* # Any character (excluding path separators)
|
|
** # Any directory levels (recursive)
|
|
? # Any single character
|
|
[abc] # Any character within the brackets
|
|
{a,b,c} # Any of the options within the braces
|
|
```
|
|
- **Cross-Platform Rules**:
|
|
- Always use forward slashes (`/`) for paths.
|
|
- Enclose paths with spaces in quotes: `@{"My Project/src/**/*"}`.
|
|
- Escape special characters like brackets: `@{src/**/*\[bracket\]*}`.
|
|
|
|
### ⏱️ Execution Settings
|
|
|
|
- **Default Timeout**: Bash command execution extended to **5 minutes** to handle large codebase analysis.
|
|
- **Content Limits**: When `--all-files` exceeds token limits, automatically fall back to selective `@` patterns.
|
|
|
|
|
|
### TPL (Templates)
|
|
|
|
> **📋 Complete Template Reference**: See [Shared Template System](./shared-template-system.md) for comprehensive template directory structure, selection guide, and cross-tool compatibility details.
|
|
|
|
> **💡 Template Usage**: All templates work with both `$(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt)` syntax and multi-template composition patterns.
|
|
|
|
|
|
### 📦 Standard Command Structures
|
|
|
|
These are recommended command templates for common scenarios.
|
|
|
|
- **Module-Specific Analysis (Quick Module Analysis)**
|
|
```bash
|
|
# Navigate to module directory for focused analysis
|
|
cd src/auth && gemini --all-files -p "Analyze authentication module patterns and implementation"
|
|
|
|
# Or specify module from root directory
|
|
cd backend/services && gemini --all-files -p "Review service architecture and dependencies"
|
|
|
|
# Template-enhanced module analysis (see shared-template-system.md for all available templates)
|
|
cd frontend/components && gemini --all-files -p "$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)"
|
|
```
|
|
|
|
- **Basic Structure (Manual Prompt)**
|
|
```bash
|
|
gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md}
|
|
|
|
Context: [Analysis type] targeting @{target_patterns}
|
|
Guidelines: Include CLAUDE.md standards
|
|
|
|
## Analysis:
|
|
1. [Point 1]
|
|
2. [Point 2]
|
|
|
|
## Output:
|
|
- File:line references
|
|
- Code examples"
|
|
```
|
|
|
|
- **Template-Enhanced (Recommended)**
|
|
```bash
|
|
# Using a predefined template for consistent, high-quality analysis
|
|
gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt)
|
|
|
|
## Analysis:
|
|
1. [Point 1]
|
|
2. [Point 2]
|
|
|
|
## Output:
|
|
- File:line references
|
|
- Code examples"
|
|
"
|
|
```
|
|
|
|
- **Multi-Template Composition**
|
|
```bash
|
|
gemini --all-files -p "@{src/**/*} @{CLAUDE.md}
|
|
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
|
|
|
|
Additional Security Focus:
|
|
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/security.txt)
|
|
|
|
## Analysis:
|
|
1. [Point 1]
|
|
2. [Point 2]
|
|
|
|
## Output:
|
|
- File:line references
|
|
- Code examples"
|
|
"
|
|
```
|
|
|
|
### ⭐ Best Practices & Rules
|
|
|
|
|
|
**When to Use @ Patterns:**
|
|
1. **User explicitly provides @ patterns** - ALWAYS preserve them exactly
|
|
2. **Cross-directory analysis** - When analyzing relationships between modules
|
|
3. **Configuration files** - When analyzing scattered config files
|
|
4. **Selective inclusion** - When you only need specific file types
|
|
|
|
**CLAUDE.md Loading Rules:**
|
|
- **With --all-files**: CLAUDE.md files automatically included (no @ needed)
|
|
- **Without --all-files**: Must use `@{CLAUDE.md}` or `@{**/CLAUDE.md}`
|
|
|
|
|
|
#### ⚠️ Error Prevention
|
|
|
|
- **Quote paths with spaces**: Use proper shell quoting
|
|
- **Test patterns first**: Validate @ patterns match existing files
|
|
- **Prefer directory navigation**: Reduces complexity and improves performance
|
|
- **Preserve user patterns**: When user provides @, always keep them
|
|
|