refactor: Streamline Gemini commands documentation and reduce duplication

- Simplify analyze.md, execute.md, bug-index.md, and plan.md command documentation
- Remove redundant content and focus on essential usage patterns
- Reduce total lines by 503 while maintaining core functionality
- Improve documentation clarity and reduce maintenance overhead

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-09 22:55:02 +08:00
parent e9cd438144
commit 47493a4db5
4 changed files with 283 additions and 526 deletions

View File

@@ -1,176 +1,98 @@
---
name: analyze
description: Advanced Gemini CLI analysis with template-driven pattern detection and comprehensive codebase insights
usage: /gemini:analyze <target>
argument-hint: "analysis target or description"
description: Quick analysis of codebase patterns, architecture, and code quality using Gemini CLI
usage: /gemini:analyze <analysis-type>
argument-hint: "analysis target or type"
examples:
- /gemini:analyze "Find all React hooks usage patterns"
- /gemini:analyze "Analyze component hierarchy and structure"
- /gemini:analyze "Scan for authentication vulnerabilities"
- /gemini:analyze "Trace user login implementation"
- /gemini:analyze "Identify potential bottlenecks"
- /gemini:analyze "Find all API endpoints"
- /gemini:analyze "React hooks patterns"
- /gemini:analyze "authentication security"
- /gemini:analyze "performance bottlenecks"
- /gemini:analyze "API design patterns"
model: haiku
---
### 🚀 Command Overview: `/gemini:analyze`
# Gemini Analysis Command (/gemini:analyze)
## Overview
Quick analysis tool for codebase insights using intelligent pattern detection and template-driven analysis.
- **Purpose**: To perform advanced, template-driven analysis on a codebase for various insights like patterns, architecture, and security.
- **Core Principle**: Leverages intelligent context detection to apply optimized analysis templates.
**Core Guidelines**: @~/.claude/workflows/gemini-unified.md
### 🔄 High-Level Execution Flow
## Analysis Types
`User Input` **->** `Intelligent Context Detection` **->** `Template-Based Analysis`
| Type | Purpose | Example |
|------|---------|---------|
| **pattern** | Code pattern detection | "React hooks usage patterns" |
| **architecture** | System structure analysis | "component hierarchy structure" |
| **security** | Security vulnerabilities | "authentication vulnerabilities" |
| **performance** | Performance bottlenecks | "rendering performance issues" |
| **quality** | Code quality assessment | "testing coverage analysis" |
| **dependencies** | Third-party analysis | "outdated package dependencies" |
### 🎯 Analysis Types
## Quick Usage
| Type | Purpose | Example Usage |
| :------------- | :------------------------------- | :------------------------------------------ |
| **pattern** | Code pattern detection | `/gemini-mode pattern "React hooks usage"` |
| **architecture** | System structure analysis | `/gemini-mode architecture "component hierarchy"` |
| **security** | Security vulnerabilities | `/gemini-mode security "auth vulnerabilities"` |
| **performance** | Performance bottlenecks | `/gemini-mode performance "rendering issues"` |
| **feature** | Feature implementation tracing | `/gemini-mode feature "user authentication"`|
| **quality** | Code quality assessment | `/gemini-mode quality "testing coverage"` |
| **dependencies** | Third-party dependencies | `/gemini-mode dependencies "outdated packages"` |
| **migration** | Legacy modernization | `/gemini-mode migration "React class to hooks"` |
| **custom** | Custom analysis | `/gemini-mode custom "find user data processing"` |
### Basic Analysis
```bash
/gemini:analyze "authentication patterns"
```
**Executes**: `gemini -p -a "@{**/*auth*} @{CLAUDE.md} $(template:analysis/pattern.txt)"`
### ⚙️ Command Options
### Targeted Analysis
```bash
/gemini:analyze "React component architecture"
```
**Executes**: `gemini -p -a "@{src/components/**/*} @{CLAUDE.md} $(template:analysis/architecture.txt)"`
| Option | Purpose |
| :--------------- | :------------------------------------ |
| `--yolo` | Auto-approve analysis (non-interactive mode). |
| `--debug` | Enable debug mode for verbose logging. |
| `--interactive` | Start an interactive session for follow-up questions. |
| `--model <name>` | Specify which Gemini model to use. |
| `--sandbox` | Run the analysis in a secure sandbox environment. |
### Security Focus
```bash
/gemini:analyze "API security vulnerabilities"
```
**Executes**: `gemini -p -a "@{**/api/**/*} @{CLAUDE.md} $(template:analysis/security.txt)"`
### 📚 Template System
## Templates Used
The command's intelligence is powered by a set of predefined templates for different analysis categories.
Templates are automatically selected based on analysis type:
- **Pattern Analysis**: `~/.claude/workflows/gemini-templates/prompts/analysis/pattern.txt`
- **Architecture Analysis**: `~/.claude/workflows/gemini-templates/prompts/analysis/architecture.txt`
- **Security Analysis**: `~/.claude/workflows/gemini-templates/prompts/analysis/security.txt`
- **Performance Analysis**: `~/.claude/workflows/gemini-templates/prompts/analysis/performance.txt`
| Template Category | Purpose | Source Reference |
| :-------------------- | :---------------------------------- | :------------------------------------------------ |
| **Unified Guidelines** | All Gemini usage rules and templates | @~/.claude/workflows/gemini-unified.md |
| **Template Library** | Actual prompt and command templates | @~/.claude/workflows/gemini-templates/ |
## Workflow Integration
### 🧠 Smart File Targeting Logic
⚠️ **Session Check**: Automatically detects active workflow session via `.workflow/.active-*` marker file.
The command automatically determines which files to analyze based on context.
**Analysis results saved to:**
- Active session: `.workflow/WFS-[topic]/.chat/analysis-[timestamp].md`
- No session: Temporary analysis output
```pseudo
FUNCTION determine_target_files(analysis_type, keywords):
// 1. Detect technology stack (e.g., React, Python)
tech_stack = detect_project_tech()
file_extensions = get_extensions_for(tech_stack) // e.g., {js,ts,jsx} for React
## Common Patterns
// 2. Generate patterns based on keywords
// Corresponds to: Keywords: "auth" -> auth files, "api" -> API files
IF "auth" in keywords:
add_pattern("@{**/auth/**/*,**/user/**/*}")
ELSE IF "api" in keywords:
add_pattern("@{api/**/*,routes/**/*,controllers/**/*}")
// 3. Generate patterns based on analysis type
// Corresponds to: Analysis type: Security -> auth/security files
CASE analysis_type:
WHEN "security":
add_pattern("@{**/auth/**/*,**/security/**/*}")
WHEN "architecture":
add_pattern("@{src/**/*,app/**/*,lib/**/*}")
// 4. Inject standard relevant context
add_pattern("@{CLAUDE.md,**/*CLAUDE.md}")
RETURN combined_patterns
END FUNCTION
### Technology Stack Analysis
```bash
/gemini:analyze "project technology stack"
# Auto-detects: package.json, config files, dependencies
```
### 📂 File Reference Syntax Guide
```
# Basic @ Syntax
@{file} # Single file
@{dir/*} # All files in directory
@{dir/**/*} # All files recursively
@{*.ext} # Files by extension
@{**/*.ext} # Files by extension recursively
# Advanced Patterns
@{file1,file2,file3} # Multiple specific files
@{dir1/**/*,dir2/**/*} # Multiple directories
@{**/*.{js,ts,jsx,tsx}} # Multiple extensions
@{**/[module]/**/*} # Pattern matching
# Context-Specific Targeting
# Frontend components
@{src/components/**/*,src/ui/**/*,src/views/**/*}
# Backend APIs
@{api/**/*,routes/**/*,controllers/**/*,middleware/**/*}
# Configuration files
@{*.config.js,*.json,.env*,config/**/*}
# Test files
@{**/*.test.*,**/*.spec.*,test/**/*,spec/**/*}
# Documentation and guidelines
@{*.md,docs/**/*,CLAUDE.md,**/*CLAUDE.md}
### Code Quality Review
```bash
/gemini:analyze "code quality and standards"
# Auto-targets: source files, test files, CLAUDE.md
```
### 🔗 Workflow Integration Patterns
⚠️ **CRITICAL**: Before analysis, MUST check for existing active session to ensure proper workflow context and documentation storage.
**Session Check Process:**
1. **Check Active Session**: Check for `.workflow/.active-*` marker file to identify active session. No file creation needed.
2. **Context Integration**: Use existing active session for proper analysis context
3. **Documentation Strategy**: Store analysis results in appropriate session directory structure
- **Planning Phase**:
`Check Active Session` **->** `Run /gemini-mode architecture` **->** `Run /gemini-mode pattern` **->** `Feed results into Task(planning-agent, ...)`
- **Code Review**:
`Check Active Session` **->** `Run /gemini-mode security "auth"` **->** `Run /gemini-mode performance "rendering"` **->** `Summarize findings for PR comments`
- **Research & Discovery**:
`Check Active Session` **->** `Run /gemini-mode architecture "overview"` **->** `Run /gemini-mode dependencies "key libraries"` **->** `Document for new team members`
### 🛠️ Task Tool Integration Example
Integrate `/gemini-mode` directly into automated tasks for analysis-driven actions.
```python
Task(subagent_type="general-purpose", prompt="""
Use /gemini-mode pattern "auth patterns" to analyze authentication.
Summarize findings for implementation planning.
""")
### Migration Planning
```bash
/gemini:analyze "legacy code modernization"
# Focuses: older patterns, deprecated APIs, upgrade paths
```
### 👍 Best Practices
## Output Format
- **Scope**: Use specific, focused targets for faster, more accurate results.
- **Chaining**: Combine analysis types (`architecture` then `pattern`) for a comprehensive view.
- **Interpretation**: Use Gemini's raw output as input for Claude to interpret, summarize, and act upon.
- **Performance**: Use `--yolo` for non-destructive analysis to skip confirmations. Be mindful that analyzing all files may be slow on large projects.
### 📋 Common Use Cases
| Use Case | Recommended Commands |
| :--------------------- | :------------------------------------------------------------------------------------ |
| **Project Onboarding** | `/gemini-mode architecture "overview"`, `/gemini-mode dependencies "key tech"` |
| **Security Audit** | `/gemini-mode security "auth vulnerabilities"`, `/gemini-mode security "XSS"` |
| **Performance Review** | `/gemini-mode performance "bottlenecks"`, `/gemini-mode performance "optimization"` |
| **Migration Planning** | `/gemini-mode migration "legacy patterns"`, `/gemini-mode migration "modernization"`|
| **Feature Research** | `/gemini-mode feature "existing system"`, `/gemini-mode pattern "approaches"` |
### 🆘 Troubleshooting
| Issue | Solution |
| :--------------------- | :-------------------------------------------------- |
| **Analysis timeout** | Use `--debug` to monitor progress and identify slow steps. |
| **Context limits** | Break the analysis into smaller, more focused scopes. |
| **Permission errors** | Ensure the CLI has read access to the target files. |
| **Complex analysis** | Use `--interactive` mode to ask follow-up questions. |
Analysis results include:
- **File References**: Specific file:line locations
- **Code Examples**: Relevant code snippets
- **Patterns Found**: Common patterns and anti-patterns
- **Recommendations**: Actionable improvements
- **Integration Points**: How components connect
For detailed syntax, patterns, and advanced usage see:
**@~/.claude/workflows/gemini-unified.md**

View File

@@ -1,7 +1,6 @@
---
name: execute
description: Intelligent context inference executor with auto-approval capabilities, supporting user descriptions and task ID execution modes
description: Auto-execution of implementation tasks with YOLO permissions and intelligent context inference
usage: /gemini:execute <description|task-id>
argument-hint: "implementation description or task-id"
examples:
@@ -13,241 +12,159 @@ allowed-tools: Bash(gemini:*)
model: sonnet
---
### 🚀 Command Overview: /gemini:execute
# Gemini Execute Command (/gemini:execute)
## Overview
- **Type**: Intelligent Context Inference Executor.
- **Purpose**: Infers context files to automatically execute implementation tasks using the Gemini CLI.
- **Key Feature**: Non-interactive, auto-approved execution by default for streamlined workflows.
- **Core Tool**: `Bash(gemini:*)`.
**⚡ YOLO-enabled execution**: Auto-approves all confirmations for streamlined implementation workflow.
### ⚙️ Execution Modes
**Purpose**: Execute implementation tasks using intelligent context inference and Gemini CLI with full permissions.
- **Direct User Description Mode**:
- **Input**: A natural language description of the task (e.g., `"implement user authentication system"`).
- **Process**: Analyzes keywords in the description to intelligently infer and collect relevant context files before execution.
- **Task ID Mode**:
- **Input**: A specific task identifier (e.g., `IMPL-001`).
- **Process**: Parses the corresponding `.task/impl-*.json` file to determine scope, type, and related files for execution.
**Core Guidelines**: @~/.claude/workflows/gemini-unified.md
### 📥 Command Parameters
## 🚨 YOLO Permissions
- `--debug`: Outputs detailed logs of the inference process and execution steps.
- `--save-session`: Saves the entire execution session to the `.workflow/WFS-[topic-slug]/.chat/` directory.
**All confirmations auto-approved by default:**
- ✅ File pattern inference confirmation
- ✅ Gemini execution confirmation
- ✅ File modification confirmation
- ✅ Implementation summary generation
**Note**: All executions run in auto-approval mode by default (equivalent to previous --yolo behavior).
### 🔄 High-Level Execution Flow
- **Description Input**: `Keyword Extraction` -> `Pattern Mapping` -> `Context Collection` -> `Gemini Execution`
- **Task ID Input**: `Task Parsing` -> `Type & Scope Analysis` -> `Reference Integration` -> `Gemini Execution`
### 🧠 Intelligent Inference Logic
This logic determines which files are collected as context before calling the Gemini CLI.
```pseudo
FUNCTION infer_context(input, user_description):
collected_files = ["@{CLAUDE.md,**/*CLAUDE.md}"] // Base context
// Check for and process user-specified file overrides first
IF user_description contains "@{...}":
user_patterns = extract_patterns_from_string(user_description)
collected_files += user_patterns
// Determine execution mode based on input format
IF input matches pattern 'IMPL-*': // Task ID Mode
task_data = read_json_file(".task/" + input + ".json")
IF task_data is not found:
RAISE_ERROR("Task ID not found")
RETURN
// Infer patterns based on task type (e.g., "feature", "bugfix")
type_patterns = get_patterns_for_task_type(task_data.type)
collected_files += type_patterns
collected_files += task_data.brainstorming_refs
ELSE: // User Description Mode
keywords = extract_tech_keywords(user_description)
// Map keywords to file patterns (e.g., "React" -> "src/components/**/*.{jsx,tsx}")
inferred_patterns = map_keywords_to_file_patterns(keywords)
collected_files += inferred_patterns
// The final collected files are used to construct the Gemini command
// This corresponds to calling the allowed tool `Bash(gemini:*)`
run_gemini_cli(collected_files, user_description)
END FUNCTION
```
### 🖐️ User Override Logic
Users can override or supplement the automatic inference.
```pseudo
FUNCTION calculate_final_patterns(description):
inferred_patterns = get_inferred_patterns(description) // e.g., **/*auth*
user_patterns = extract_user_patterns(description) // e.g., @{custom/auth/helpers.js}
// The final context is the union of inferred and user-specified patterns
final_patterns = inferred_patterns + user_patterns
RETURN final_patterns
END FUNCTION
```
### 🛠️ Gemini CLI Integration (Templated)
The following templates are used to call the `gemini` command via the `Bash` tool.
## Execution Modes
### 1. Description Mode
**Input**: Natural language description
```bash
# User Description Mode
gemini --all-files --yolo -p "@{intelligently_inferred_file_patterns} @{CLAUDE.md,**/*CLAUDE.md}
/gemini:execute "implement JWT authentication with middleware"
```
**Process**: Keyword analysis → Pattern inference → Context collection → Execution
### 2. Task ID Mode
**Input**: Workflow task identifier
```bash
/gemini:execute IMPL-001
```
**Process**: Task JSON parsing → Scope analysis → Context integration → Execution
## Context Inference Logic
**Auto-selects relevant files based on:**
- **Keywords**: "auth" → `@{**/*auth*,**/*user*}`
- **Technology**: "React" → `@{src/**/*.{jsx,tsx}}`
- **Task Type**: "api" → `@{**/api/**/*,**/routes/**/*}`
- **Always includes**: `@{CLAUDE.md,**/*CLAUDE.md}`
## Command Options
| Option | Purpose |
|--------|---------|
| `--debug` | Verbose execution logging |
| `--save-session` | Save complete execution session to workflow |
## Workflow Integration
### Session Management
⚠️ **Auto-detects active session**: Checks `.workflow/.active-*` marker file
**Session storage:**
- **Active session exists**: Saves to `.workflow/WFS-[topic]/.chat/execute-[timestamp].md`
- **No active session**: Creates new session directory
### Task Integration
```bash
# Execute specific workflow task
/gemini:execute IMPL-001
# Loads from: .task/impl-001.json
# Uses: task context, brainstorming refs, scope definitions
# Updates: workflow status, generates summary
```
## Execution Templates
### User Description Template
```bash
gemini --all-files -p "@{inferred_patterns} @{CLAUDE.md,**/*CLAUDE.md}
Implementation Task: [user_description]
Based on intelligently inferred context, please provide:
Provide:
- Specific implementation code
- File modification locations (file:line)
- Test cases
- Integration guidance"
# Task ID Mode
gemini --all-files --yolo -p "@{task_related_files} @{brainstorming_refs} @{CLAUDE.md,**/*CLAUDE.md}
Task Execution: [task_title] (ID: [task-id])
Task Description: [extracted_from_json]
Task Type: [feature/bugfix/refactor/etc]
Please execute implementation based on task definition:
- Follow task acceptance criteria
- Based on brainstorming analysis results
- Provide specific code and tests"
```
### 🔗 Workflow System Integration Logic
### Task ID Template
```bash
gemini --all-files -p "@{task_files} @{brainstorming_refs} @{CLAUDE.md,**/*CLAUDE.md}
The command integrates deeply with the workflow system with auto-approval by default.
Task: [task_title] (ID: [task-id])
Type: [task_type]
Scope: [task_scope]
```pseudo
FUNCTION execute_with_workflow(task, flags):
// All confirmation steps are automatically approved by default
confirm_inferred_files = TRUE
confirm_gemini_execution = TRUE
confirm_file_modifications = TRUE
// Execute the task with auto-approval
execute_gemini_task(task)
// Actions performed after successful execution
generate_task_summary_doc()
update_workflow_status_files() // Updates WFS & workflow-session.json
END FUNCTION
Execute implementation following task acceptance criteria."
```
### 📄 Task Summary Template (Templated)
## Auto-Generated Outputs
This template is automatically filled and generated after execution.
### 1. Implementation Summary
**Location**: `.summaries/[TASK-ID]-summary.md` or auto-generated ID
```markdown
# Task Summary: [Task-ID/Generated-ID] [Task Name/Description]
# Task Summary: [Task-ID] [Description]
## Execution Content
- **Intelligently Inferred Files**: [inferred_file_patterns]
- **Gemini Analysis Results**: [key_findings]
- **Implemented Features**: [specific_implementation_content]
- **Modified Files**: [file:line references]
## Implementation
- **Files Modified**: [file:line references]
- **Features Added**: [specific functionality]
- **Context Used**: [inferred patterns]
## Issues Resolved
- [list_of_resolved_problems]
## Links
- [🔙 Back to Task List](../TODO_LIST.md#[Task-ID])
- [📋 Implementation Plan](../IMPL_PLAN.md#[Task-ID])
## Integration
- [Links to workflow documents]
```
### 🛡️ Error Handling Protocols
### 2. Execution Session
**Location**: `.chat/execute-[timestamp].md`
- **Keyword Inference Failure**: `Use generic pattern 'src/**/*'` -> `Prompt user for manual specification`.
- **Task ID Not Found**: `Display error message` -> `List available tasks`.
- **File Pattern No Matches**: `Expand search scope` -> `Log debug info`.
- **Gemini CLI Failure**: `Attempt fallback mode (e.g., --all-files -> @{patterns})` -> `Simplify context & retry`.
### ⚡ Performance Optimizations
- **Caching**: Caches frequently used keyword-to-pattern mapping results.
- **Pattern Optimization**: Avoids overly broad file patterns like `**/*` where possible.
- **Progressive Inference**: Tries precise patterns (`src/api/auth`) before broader ones (`**/*auth*`).
- **Path Navigation**: Switches to the optimal execution directory based on inference to shorten paths.
### 🤝 Integration & Coordination
- **vs. `gemini-chat`**: `gemini-chat` is for pure analysis; `/gemini-execute` performs analysis **and** execution.
- **vs. `code-developer`**: `code-developer` requires manual context provision; `/gemini-execute` infers context automatically.
- **Typical Workflow Sequence**:
1. `workflow:session "..."`
2. `workflow:brainstorm`
3. `workflow:plan`
4. `/gemini-execute IMPL-001`
5. `workflow:review`
### 💾 Session Persistence
⚠️ **CRITICAL**: Before saving, MUST check for existing active session to avoid creating duplicate sessions.
- **Trigger**: Activated by the `--save-session` flag.
- **Action**: Saves the complete execution session, including inferred context, Gemini analysis, and implementation results.
- **Session Check**: Check for `.workflow/.active-*` marker file to identify current active session. No file creation needed.
- **Location Strategy**:
- **IF active session exists**: Save to existing `.workflow/WFS-[topic-slug]/.chat/` directory
- **IF no active session**: Create new session directory following WFS naming convention
**Session Management**: @~/.claude/workflows/workflow-architecture.md
- **File Format**: `execute-YYYYMMDD-HHMMSS.md` with timestamp for unique identification.
- **Structure**: Integrates with session management system using WFS-[topic-slug] format for consistency.
- **Coordination**: Session files coordinate with workflow-session.json and maintain document-state separation.
### 🔗 Execution Session Integration
**Storage Structure:**
```
.workflow/WFS-[topic-slug]/.chat/
├── execute-20240307-143022.md # Execution sessions with timestamps
├── execute-20240307-151445.md # Chronologically ordered
└── analysis-[topic].md # Referenced analysis sessions
```
**Execution Session Template:**
```markdown
# Execution Session: [Timestamp] - [Task/Description]
# Execution Session: [Timestamp]
## Input
[Original user description or Task ID]
[User description or Task ID]
## Context Inference
[Intelligently inferred file patterns and rationale]
## Task Details (if Task ID mode)
[Extracted task data from .task/*.json]
## Gemini Execution
[Complete Gemini CLI command and parameters]
[File patterns used with rationale]
## Implementation Results
[Code generated, files modified, test cases]
[Generated code and modifications]
## Key Outcomes
- [Files modified/created]
- [Features implemented]
- [Issues resolved]
## Integration Links
- [🔙 Workflow Session](../workflow-session.json)
- [📋 Implementation Plan](../IMPL_PLAN.md)
- [📝 Task Definitions](../.task/)
- [📑 Summary](../.summaries/)
## Status Updates
[Workflow integration updates]
```
### ✅ Quality Assurance Principles
## Error Handling
- **Inference Accuracy**: Keyword mapping tables are regularly updated based on project patterns and user feedback.
- **Execution Reliability**: Implements robust error handling and leverages debug mode for detailed tracing.
- **Documentation Completeness**: Ensures auto-generated summaries are structured and workflow statuses are synced in real-time.
### 📚 Related Documentation
- **Task ID not found**: Lists available tasks
- **Pattern inference failure**: Uses generic `src/**/*` pattern
- **Execution failure**: Attempts fallback with simplified context
- **File modification errors**: Reports specific file/permission issues
## Performance Features
- **Smart caching**: Frequently used pattern mappings
- **Progressive inference**: Precise → broad pattern fallback
- **Parallel execution**: When multiple contexts needed
- **Directory optimization**: Switches to optimal execution path
## Integration Workflow
**Typical sequence:**
1. `workflow:plan` → Creates tasks
2. `/gemini:execute IMPL-001` → Executes with YOLO permissions
3. Auto-updates workflow status and generates summaries
4. `workflow:review` → Final validation
**vs. `/gemini:analyze`**: Execute performs analysis **and implementation**, analyze is read-only.
For detailed patterns, syntax, and templates see:
**@~/.claude/workflows/gemini-unified.md**

View File

@@ -1,6 +1,5 @@
---
name: bug-index
description: Bug analysis and fix suggestions using specialized template
usage: /gemini:pre:bug-index "bug description"
argument-hint: "description of the bug or error you're experiencing"
@@ -12,102 +11,63 @@ allowed-tools: Bash(gemini:*)
model: sonnet
---
### 🐛 **Command Overview: `/gemini:pre:bug-index`**
# Bug Analysis Command (/gemini:pre:bug-index)
- **Type**: Template-based Gemini CLI Wrapper
- **Purpose**: Specialized bug analysis and fix suggestions using expert diagnostic template
- **Template**: Bug fix analysis template for systematic problem diagnosis
- **Core Tool**: `Bash(gemini:*)` - Executes Gemini CLI with bug-fix template
## Overview
Systematic bug analysis and fix suggestions using expert diagnostic template.
### 📥 **Parameters & Usage**
## Usage
- **`<bug description>` (Required)**: Description of the bug, error, or unexpected behavior
- **`--all-files` (Optional)**: Includes entire codebase for comprehensive analysis
- **`--save-session` (Optional)**: Saves the bug analysis to current workflow session
### 🔄 **Execution Workflow**
`Parse Bug Description` **->** `Load Bug-Fix Template` **->** `Assemble Context` **->** `Execute Gemini CLI` **->** `(Optional) Save Session`
### 📋 **Bug Analysis Focus**
The bug-fix template provides structured analysis covering:
- **Root Cause Analysis**: Systematic investigation of underlying issues
- **Code Path Tracing**: Following execution flow to identify failure points
- **Hypothesis Validation**: Testing theories about bug origins
- **Targeted Solutions**: Specific, minimal fixes rather than broad refactoring
- **Impact Assessment**: Understanding side effects of proposed fixes
### 📚 **Context Assembly**
Context includes:
1. **Bug-Fix Template**: @~/.claude/prompt-templates/bug-fix.md
2. **Project Guidelines**: @{CLAUDE.md,**/*CLAUDE.md}
3. **Relevant Files**: User-specified files or all files if `--all-files` used
### 📝 **Prompt Structure**
```
=== SYSTEM PROMPT ===
@~/.claude/prompt-templates/bug-fix.md
=== CONTEXT ===
@{CLAUDE.md,**/*CLAUDE.md}
@{target_files}
=== USER INPUT ===
[Bug description and any relevant details]
### Basic Bug Analysis
```bash
/gemini:pre:bug-index "authentication error during login"
```
### ⚙️ **Implementation**
```pseudo
FUNCTION execute_bug_fix_analysis(bug_description, flags):
// Load bug-fix template
template = load_file(@~/.claude/prompt-templates/bug-fix.md)
// Construct prompt with template
prompt = "=== SYSTEM PROMPT ===\n" + template + "\n\n"
prompt += "=== CONTEXT ===\n"
prompt += "@{CLAUDE.md,**/*CLAUDE.md}\n"
// Execute with appropriate context
IF flags contain "--all-files":
result = execute_tool("Bash(gemini:*)", "--all-files", "-p", prompt + bug_description)
ELSE:
prompt += "\n=== USER INPUT ===\n" + bug_description
result = execute_tool("Bash(gemini:*)", "-p", prompt)
// Save session if requested
IF flags contain "--save-session":
save_bug_analysis_session(bug_description, result)
RETURN result
END FUNCTION
### With All Files Context
```bash
/gemini:pre:bug-index "React state not updating" --all-files
```
### 💾 **Session Integration**
### Save to Workflow Session
```bash
/gemini:pre:bug-index "API timeout issues" --save-session
```
When `--save-session` is used:
- Saves to `.workflow/WFS-[topic]/.chat/` directory
- File named: `bug-index-YYYYMMDD-HHMMSS.md`
- Includes template used, bug description, analysis, and recommendations
## Command Execution
**Session Template:**
```markdown
# Bug Fix Analysis: [Timestamp]
**Template Used**: `~/.claude/prompt-templates/bug-fix.md`
## Bug Description
[Original bug description]
**Executes**:
```bash
gemini --all-files -p "$(cat ~/.claude/prompt-templates/bug-fix.md)
## Template Used
bug-fix.md - Expert diagnostic analysis template
Context: @{CLAUDE.md,**/*CLAUDE.md}
## Analysis Results
[Complete Gemini response with root cause analysis and fix suggestions]
Bug Description: [user_description]"
```
## Recommended Actions
- [Immediate fixes]
- [Prevention measures]
- [Testing recommendations]
```
## Analysis Focus
The bug-fix template provides:
- **Root Cause Analysis**: Systematic investigation
- **Code Path Tracing**: Following execution flow
- **Targeted Solutions**: Specific, minimal fixes
- **Impact Assessment**: Understanding side effects
## Options
| Option | Purpose |
|--------|---------|
| `--all-files` | Include entire codebase for analysis |
| `--save-session` | Save analysis to workflow session |
## Session Output
When `--save-session` used, saves to:
`.workflow/WFS-[topic]/.chat/bug-index-[timestamp].md`
**Includes:**
- Bug description
- Template used
- Analysis results
- Recommended actions

View File

@@ -1,117 +1,75 @@
---
name: plan
description: Project planning and architecture analysis using specialized template
usage: /gemini:chat:plan "planning topic"
usage: /gemini:pre:plan "planning topic"
argument-hint: "planning topic or architectural challenge to analyze"
examples:
- /gemini:chat:plan "design user dashboard feature architecture"
- /gemini:chat:plan "plan microservices migration strategy"
- /gemini:chat:plan "implement real-time notification system"
- /gemini:pre:plan "design user dashboard feature architecture"
- /gemini:pre:plan "plan microservices migration strategy"
- /gemini:pre:plan "implement real-time notification system"
allowed-tools: Bash(gemini:*)
model: sonnet
---
### 📋 **Command Overview: `/gemini:chat:plan`**
# Planning Analysis Command (/gemini:pre:plan)
- **Type**: Template-based Gemini CLI Wrapper
- **Purpose**: Comprehensive project planning and architecture analysis using expert planning template
- **Template**: Planning analysis template for systematic feature and system design
- **Core Tool**: `Bash(gemini:*)` - Executes Gemini CLI with planning template
## Overview
Comprehensive project planning and architecture analysis using expert planning template.
### 📥 **Parameters & Usage**
## Usage
- **`<planning topic>` (Required)**: Description of the feature, system, or architectural challenge to plan
- **`--all-files` (Optional)**: Includes entire codebase for comprehensive planning context
- **`--save-session` (Optional)**: Saves the planning analysis to current workflow session
### 🔄 **Execution Workflow**
`Parse Planning Topic` **->** `Load Planning Template` **->** `Assemble Context` **->** `Execute Gemini CLI` **->** `(Optional) Save Session`
### 📋 **Planning Analysis Focus**
The planning template provides structured analysis covering:
- **Requirements Analysis**: Understanding functional and non-functional requirements
- **Architecture Design**: System structure, components, and interactions
- **Implementation Strategy**: Step-by-step development approach
- **Risk Assessment**: Identifying potential challenges and mitigation strategies
- **Resource Planning**: Time, effort, and technology requirements
### 📚 **Context Assembly**
Context includes:
1. **Planning Template**: @~/.claude/prompt-templates/plan.md
2. **Project Guidelines**: @{CLAUDE.md,**/*CLAUDE.md}
3. **Relevant Files**: User-specified files or all files if `--all-files` used
### 📝 **Prompt Structure**
```
=== SYSTEM PROMPT ===
@~/.claude/prompt-templates/plan.md
=== CONTEXT ===
@{CLAUDE.md,**/*CLAUDE.md}
@{target_files}
=== USER INPUT ===
[Planning topic and any specific requirements or constraints]
### Basic Planning Analysis
```bash
/gemini:pre:plan "design authentication system"
```
### ⚙️ **Implementation**
```pseudo
FUNCTION execute_planning_analysis(planning_topic, flags):
// Load planning template
template = load_file(@~/.claude/prompt-templates/plan.md)
// Construct prompt with template
prompt = "=== SYSTEM PROMPT ===\n" + template + "\n\n"
prompt += "=== CONTEXT ===\n"
prompt += "@{CLAUDE.md,**/*CLAUDE.md}\n"
// Execute with appropriate context
IF flags contain "--all-files":
result = execute_tool("Bash(gemini:*)", "--all-files", "-p", prompt + planning_topic)
ELSE:
prompt += "\n=== USER INPUT ===\n" + planning_topic
result = execute_tool("Bash(gemini:*)", "-p", prompt)
// Save session if requested
IF flags contain "--save-session":
save_planning_session(planning_topic, result)
RETURN result
END FUNCTION
### With All Files Context
```bash
/gemini:pre:plan "microservices migration" --all-files
```
### 💾 **Session Integration**
### Save to Workflow Session
```bash
/gemini:pre:plan "real-time notifications" --save-session
```
When `--save-session` is used:
- Saves to `.workflow/WFS-[topic]/.chat/` directory
- File named: `plan-YYYYMMDD-HHMMSS.md`
- Includes template used, planning topic, analysis, and implementation roadmap
## Command Execution
**Session Template:**
```markdown
# Planning Analysis: [Timestamp]
**Template Used**: `~/.claude/prompt-templates/plan.md`
## Planning Topic
[Original planning topic description]
**Executes**:
```bash
gemini --all-files -p "$(cat ~/.claude/prompt-templates/plan.md)
## Template Used
plan.md - Expert planning and architecture analysis template
Context: @{CLAUDE.md,**/*CLAUDE.md}
## Analysis Results
[Complete Gemini response with requirements, architecture, and implementation plan]
Planning Topic: [user_description]"
```
## Implementation Roadmap
- [Phase 1: Foundation work]
- [Phase 2: Core implementation]
- [Phase 3: Integration and testing]
## Planning Focus
## Key Decisions
- [Architecture choices]
- [Technology selections]
- [Risk mitigation strategies]
```
The planning template provides:
- **Requirements Analysis**: Functional and non-functional requirements
- **Architecture Design**: System structure and interactions
- **Implementation Strategy**: Step-by-step development approach
- **Risk Assessment**: Challenges and mitigation strategies
- **Resource Planning**: Time, effort, and technology needs
## Options
| Option | Purpose |
|--------|---------|
| `--all-files` | Include entire codebase for context |
| `--save-session` | Save analysis to workflow session |
## Session Output
When `--save-session` used, saves to:
`.workflow/WFS-[topic]/.chat/plan-[timestamp].md`
**Includes:**
- Planning topic
- Template used
- Analysis results
- Implementation roadmap
- Key decisions