mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
refactor: Streamline intelligent tools strategy with unified template system
Major Changes: - Merge tools-implementation-guide.md into intelligent-tools-strategy.md - Consolidate TEMPLATE and RULES fields into single RULES field - Standardize template references using $(cat ...) format - Reduce document length by 66% (520→177 lines) while preserving core functionality Template System Improvements: - Universal 4-field command format: PURPOSE | TASK | EXPECTED | RULES - Unified rules format: $(cat template.txt) | constraints - Comprehensive template directory structure with examples - Cross-tool template compatibility and reuse patterns Content Optimization: - Remove redundant examples and duplicate content - Focus on universal command templates and common scenarios - Simplify tool selection matrix with clear task-to-tool mapping - Streamline workflow integration with essential best practices 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -23,57 +23,16 @@ type: strategic-guideline
|
||||
3. **Not sure?** → Use both in parallel
|
||||
4. **Small task?** → Still use tools - they're faster than manual work
|
||||
|
||||
## 🎯 Tool Specifications
|
||||
## 🎯 Universal Command Template
|
||||
|
||||
### Gemini (Analysis & Understanding)
|
||||
**Command**: `~/.claude/scripts/gemini-wrapper -p "PURPOSE: [analysis goal] | TASK: [what to do] | EXPECTED: [expected results]"`
|
||||
|
||||
**Strengths**: Large context window, pattern recognition across modules
|
||||
|
||||
**Use Cases**:
|
||||
- Any project analysis (≥5 files)
|
||||
- Quick code exploration and familiarization
|
||||
- Cross-module pattern detection and consistency checks
|
||||
- Coding convention analysis and standardization
|
||||
- Refactoring planning with dependency mapping
|
||||
- Legacy code understanding and modernization paths
|
||||
- API surface analysis and integration points
|
||||
- Test coverage gaps and quality assessment
|
||||
- Configuration file analysis and optimization
|
||||
- Dependency audit and relationship mapping
|
||||
- Code review preparation and checklist generation
|
||||
- Documentation generation from existing code
|
||||
|
||||
### Codex (Development & Implementation)
|
||||
**Command**: `codex --full-auto exec "PURPOSE: [development goal] | TASK: [what to implement] | EXPECTED: [expected code/features]" -s danger-full-access`
|
||||
|
||||
**Strengths**: Mathematical reasoning, autonomous development
|
||||
|
||||
**Use Cases**:
|
||||
- Any feature development (simple to complex)
|
||||
- Quick prototyping and proof-of-concepts
|
||||
- Bug fixes and issue resolution
|
||||
- Test generation and validation
|
||||
- Code scaffolding and boilerplate creation
|
||||
- Configuration setup and environment preparation
|
||||
- Algorithm implementation and optimization
|
||||
- Security vulnerability assessment and fixes
|
||||
- Performance optimization and profiling
|
||||
- Database schema design and migration
|
||||
- API development and integration
|
||||
- DevOps automation and deployment scripts
|
||||
- Documentation automation and generation
|
||||
- Code modernization and refactoring execution
|
||||
- Dependency management and updates
|
||||
- Build system optimization and tooling
|
||||
|
||||
### Structured Prompt Templates
|
||||
### Standard Format (REQUIRED)
|
||||
```bash
|
||||
# Gemini Analysis
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [clear analysis goal]
|
||||
TASK: [specific analysis task]
|
||||
EXPECTED: [expected output]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Codex Development
|
||||
@@ -81,113 +40,138 @@ codex --full-auto exec "
|
||||
PURPOSE: [clear development goal]
|
||||
TASK: [specific development task]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
" -s danger-full-access
|
||||
```
|
||||
|
||||
**Prompt Checklist**:
|
||||
### Template Structure
|
||||
- [ ] **PURPOSE** - Clear goal and intent
|
||||
- [ ] **TASK** - Specific execution task
|
||||
- [ ] **EXPECTED** - Clear expected results
|
||||
- [ ] **RULES** - Template reference and constraints
|
||||
|
||||
## 📊 Decision Matrix
|
||||
|
||||
| Task Category | Tool | Rationale | Frequency |
|
||||
|--------------|------|-----------|-----------|
|
||||
| **Understanding & Analysis** |
|
||||
| Project Architecture | Gemini | Broad context across files | Weekly/Monthly |
|
||||
| Code Exploration | Gemini | Quick module familiarization | Daily |
|
||||
| Legacy Code Analysis | Gemini | Pattern recognition across systems | As needed |
|
||||
| Dependency Mapping | Gemini | Cross-module relationship analysis | Sprint planning |
|
||||
| Code Review Prep | Gemini | Comprehensive context understanding | Before reviews |
|
||||
| **Development & Implementation** |
|
||||
| Feature Development | Codex | Autonomous implementation capabilities | Daily |
|
||||
| Bug Fixes | Codex | Targeted problem resolution | As issues arise |
|
||||
| Prototyping | Codex | Rapid development and iteration | Weekly |
|
||||
| Test Generation | Codex | Automated test creation | After feature work |
|
||||
| Configuration Setup | Codex | Environment and tooling setup | Project setup |
|
||||
| **Optimization & Maintenance** |
|
||||
| Algorithm Optimization | Codex | Mathematical reasoning capabilities | Performance sprints |
|
||||
| Security Analysis | Codex | Security knowledge and fixes | Security reviews |
|
||||
| Performance Tuning | Codex | Mathematical optimization | Performance reviews |
|
||||
| Code Modernization | Both | Gemini for planning, Codex for execution | Quarterly |
|
||||
| **Documentation & Quality** |
|
||||
| Documentation Generation | Both | Gemini for analysis, Codex for automation | Continuous |
|
||||
| Coding Standards | Gemini | Pattern recognition and consistency | Code reviews |
|
||||
| Test Coverage Analysis | Gemini | Cross-module test understanding | Sprint retrospectives |
|
||||
|
||||
## 📋 Workflow Integration
|
||||
|
||||
### Mandatory Planning Process
|
||||
When planning any coding task, **ALWAYS** integrate CLI tools:
|
||||
|
||||
#### 1. Understanding Phase (Required)
|
||||
- **Gemini Analysis**: Understand existing patterns, architecture, dependencies
|
||||
- **Context Discovery**: Map related modules and integration points
|
||||
- **Pattern Recognition**: Identify existing conventions and standards
|
||||
|
||||
#### 2. Development Strategy
|
||||
- **Understanding/Analysis**: Gemini (primary), Codex (occasional)
|
||||
- **Implementation**: Codex (occasional), manual development (primary)
|
||||
- **Complex Tasks**: Both tools in sequence
|
||||
|
||||
#### 3. Workflow Pattern
|
||||
```
|
||||
Planning → Gemini Analysis → Manual Development → Codex Assistance (as needed)
|
||||
### Rules Field Format
|
||||
```bash
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) | [constraints]
|
||||
```
|
||||
|
||||
### Tool Usage Guidelines
|
||||
**Examples**:
|
||||
- Single template: `$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) | Focus on security`
|
||||
- Multiple templates: `$(cat template1.txt) $(cat template2.txt) | Enterprise standards`
|
||||
- No template: `Focus on security patterns, include dependency analysis`
|
||||
- File patterns: `@{src/**/*.ts,CLAUDE.md} - Stay within scope`
|
||||
|
||||
#### Gemini (Primary for Understanding)
|
||||
- Always use for initial codebase analysis
|
||||
- Pattern discovery and convention mapping
|
||||
- Architecture understanding before implementation
|
||||
- Dependency analysis and impact assessment
|
||||
- Code review preparation
|
||||
## 📊 Tool Selection Matrix
|
||||
|
||||
#### Codex (Occasional for Development)
|
||||
- Selective use for complex algorithms
|
||||
- Prototype generation for proof-of-concepts
|
||||
- Boilerplate creation when patterns are clear
|
||||
- Test generation and validation
|
||||
- Performance optimization tasks
|
||||
| Task Type | Tool | Use Case | Template |
|
||||
|-----------|------|----------|-----------|
|
||||
| **Analysis** | Gemini | Code exploration, architecture review, patterns | `analysis/pattern.txt` |
|
||||
| **Development** | Codex | Feature implementation, bug fixes, testing | `development/feature.txt` |
|
||||
| **Planning** | Both | Task breakdown, migration planning | `planning/task-breakdown.txt` |
|
||||
| **Documentation** | Both | Code docs, API specs, guides | `analysis/quality.txt` |
|
||||
| **Security** | Codex | Vulnerability assessment, fixes | `analysis/security.txt` |
|
||||
| **Refactoring** | Both | Gemini for analysis, Codex for execution | `development/refactor.txt` |
|
||||
|
||||
### Planning Checklist
|
||||
For every development task:
|
||||
- [ ] **Gemini analysis** completed for understanding
|
||||
- [ ] **Existing patterns** identified and documented
|
||||
- [ ] **Dependencies mapped** and integration points clear
|
||||
- [ ] **CLI tool usage points** identified in workflow
|
||||
- [ ] **Manual development approach** defined
|
||||
- [ ] **Codex assistance triggers** identified (if applicable)
|
||||
## 📁 Template System
|
||||
|
||||
**Base Structure**: `~/.claude/workflows/cli-templates/`
|
||||
|
||||
### Available Templates
|
||||
```
|
||||
prompts/
|
||||
├── analysis/
|
||||
│ ├── pattern.txt - Code pattern analysis
|
||||
│ ├── architecture.txt - System architecture review
|
||||
│ ├── security.txt - Security assessment
|
||||
│ └── quality.txt - Code quality review
|
||||
├── development/
|
||||
│ ├── feature.txt - Feature implementation
|
||||
│ ├── refactor.txt - Refactoring tasks
|
||||
│ └── testing.txt - Test generation
|
||||
└── planning/
|
||||
└── task-breakdown.txt - Task decomposition
|
||||
|
||||
planning-roles/
|
||||
├── system-architect.md - System design perspective
|
||||
├── security-expert.md - Security architecture
|
||||
└── feature-planner.md - Feature specification
|
||||
|
||||
tech-stacks/
|
||||
├── typescript-dev.md - TypeScript guidelines
|
||||
├── python-dev.md - Python conventions
|
||||
└── react-dev.md - React architecture
|
||||
```
|
||||
|
||||
## 🚀 Usage Patterns
|
||||
|
||||
### Immediate Engagement Triggers
|
||||
- **New codebase**: Use Gemini to understand structure before changes
|
||||
- **Bug reports**: Use Codex to investigate and propose fixes
|
||||
- **Feature requests**: Use Codex for rapid prototyping and implementation
|
||||
- **Code reviews**: Use Gemini to prepare comprehensive analysis
|
||||
- **Refactoring needs**: Use Gemini for impact analysis, Codex for execution
|
||||
### Workflow Integration (REQUIRED)
|
||||
When planning any coding task, **ALWAYS** integrate CLI tools:
|
||||
|
||||
### Daily Integration Points
|
||||
- **Morning standup prep**: Gemini for codebase overview
|
||||
- **Sprint planning**: Both tools for effort estimation
|
||||
- **Development tasks**: Codex for implementation
|
||||
- **Testing**: Codex for test generation and coverage
|
||||
- **Documentation**: Both tools for comprehensive docs
|
||||
1. **Understanding Phase**: Use Gemini for analysis
|
||||
2. **Implementation Phase**: Use Codex for development
|
||||
3. **Quality Phase**: Use Codex for testing and validation
|
||||
|
||||
### Parallel Strategy
|
||||
For complex projects requiring both broad context and deep analysis:
|
||||
- **Gemini** for architectural understanding
|
||||
- **Codex** for focused development tasks
|
||||
- Run both via Task agents when comprehensive coverage needed
|
||||
### Common Scenarios
|
||||
```bash
|
||||
# Project Analysis
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Understand codebase architecture
|
||||
TASK: Analyze project structure and identify patterns
|
||||
EXPECTED: Architecture overview and integration points
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt) | Focus on integration points
|
||||
"
|
||||
|
||||
### Frequency Guidelines
|
||||
- **Daily**: Use tools for routine development tasks
|
||||
- **Immediate**: Engage tools at first sign of complexity
|
||||
- **Continuous**: Integrate tools into regular workflow
|
||||
- **Proactive**: Don't wait for problems - use tools preventively
|
||||
# Feature Development
|
||||
codex --full-auto exec "
|
||||
PURPOSE: Implement user authentication
|
||||
TASK: Create JWT-based authentication system
|
||||
EXPECTED: Complete auth module with tests
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt) | Follow security best practices
|
||||
" -s danger-full-access
|
||||
|
||||
## 🔗 Reference
|
||||
# Code Review Preparation
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Prepare comprehensive code review
|
||||
TASK: Analyze code changes and identify potential issues
|
||||
EXPECTED: Review checklist and improvement suggestions
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/quality.txt) | Focus on maintainability
|
||||
"
|
||||
```
|
||||
|
||||
**Complete syntax and usage patterns**: @~/.claude/workflows/tools-implementation-guide.md
|
||||
## 📋 Planning Checklist
|
||||
|
||||
For every development task:
|
||||
- [ ] **Purpose defined** - Clear goal and intent
|
||||
- [ ] **Gemini analysis** completed for understanding
|
||||
- [ ] **Template selected** - Appropriate template chosen
|
||||
- [ ] **Constraints specified** - File patterns, scope, requirements
|
||||
- [ ] **Implementation approach** - Tool selection and workflow
|
||||
- [ ] **Quality measures** - Testing and validation plan
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
### Gemini
|
||||
- **Command**: `~/.claude/scripts/gemini-wrapper`
|
||||
- **Strengths**: Large context window, pattern recognition
|
||||
- **Best For**: Analysis, architecture review, code exploration
|
||||
|
||||
### Codex
|
||||
- **Command**: `codex --full-auto exec`
|
||||
- **Strengths**: Autonomous development, mathematical reasoning
|
||||
- **Best For**: Implementation, testing, automation
|
||||
- **Required**: `-s danger-full-access` for development
|
||||
|
||||
### File Patterns
|
||||
- All files: `@{**/*}`
|
||||
- Source files: `@{src/**/*}`
|
||||
- TypeScript: `@{*.ts,*.tsx}`
|
||||
- With docs: `@{CLAUDE.md,**/*CLAUDE.md}`
|
||||
- Tests: `@{src/**/*.test.*}`
|
||||
|
||||
## 🔧 Best Practices
|
||||
|
||||
- **Start with templates** - Use predefined templates for consistency
|
||||
- **Be specific** - Clear PURPOSE, TASK, and EXPECTED fields
|
||||
- **Include constraints** - File patterns, scope, requirements in RULES
|
||||
- **Test patterns first** - Validate file patterns with `ls`
|
||||
- **Document context** - Always reference CLAUDE.md for context
|
||||
Reference in New Issue
Block a user