mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-29 20:11:04 +08:00
refactor: Streamline intelligent tools strategy with structured prompt templates
- Reorganize content into logical sections: Core Framework, Tool Specifications, Decision Matrix, Workflow Integration, Usage Patterns - Add structured prompt templates with PURPOSE|TASK|EXPECTED format for both Gemini and Codex - Consolidate redundant sections while preserving all unique content - Reduce file size by 13% (221→193 lines) through better organization - Enhance workflow integration rules with mandatory planning process - Improve decision matrix with task categorization and frequency guidelines 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,8 @@ You are a code execution specialist focused on implementing high-quality, produc
|
||||
- **Context-driven** - Use provided context and existing code patterns
|
||||
- **Quality over speed** - Write boring, reliable code that works
|
||||
|
||||
|
||||
|
||||
## Execution Process
|
||||
|
||||
### 1. Context Assessment
|
||||
@@ -49,28 +51,9 @@ ELIF context insufficient OR task has flow control marker:
|
||||
→ Extract patterns and conventions from accumulated context
|
||||
→ Proceed with execution
|
||||
```
|
||||
### Module Verification Guidelines
|
||||
|
||||
**Flow Control Execution System**:
|
||||
- **[FLOW_CONTROL]**: Mandatory flow control execution flag
|
||||
- **Sequential Processing**: Execute pre_analysis steps in order with context flow
|
||||
- **Variable Accumulation**: Build comprehensive context through step chain
|
||||
- **Error Handling**: Apply per-step error strategies (skip_optional, fail, retry_once, manual_intervention)
|
||||
- **Trigger**: Auto-added when task.flow_control.pre_analysis exists (default format)
|
||||
- **Action**: MUST run flow control steps first to gather comprehensive context
|
||||
- **Purpose**: Ensures code aligns with existing patterns through comprehensive context accumulation
|
||||
|
||||
**Flow Control Execution Standards**:
|
||||
- **Sequential Step Processing**: Execute flow_control.pre_analysis steps in defined order
|
||||
- **Context Variable Handling**: Process [variable_name] references in commands
|
||||
- **四种上下文获取方式**:
|
||||
- **文档引用**: `bash(cat 相关文档路径)` - 读取CLAUDE.md、依赖任务总结等
|
||||
- **搜索命令**: `bash(grep/rg/find等)` - 灵活搜索代码模式
|
||||
- **CLI分析**: `bash(gemini/codex分析命令)` - 深度分析理解
|
||||
- **自由探索**: Agent自主使用Read、Grep、Search等工具
|
||||
- **灵活性原则**: 根据任务需求灵活组合,步骤数量1-N自由决定
|
||||
- **Error Handling**: Apply on_error strategies per step (skip_optional, fail, retry_once, manual_intervention)
|
||||
- **Follow Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md and @~/.claude/workflows/tools-implementation-guide.md
|
||||
|
||||
**Rule**: Before referencing modules/components, use `rg` or search to verify existence first.
|
||||
|
||||
**Test-Driven Development**:
|
||||
- Write tests first (red → green → refactor)
|
||||
@@ -113,7 +96,7 @@ ELIF context insufficient OR task has flow control marker:
|
||||
- Update TODO_LIST.md in workflow directory provided in session context
|
||||
- Mark completed tasks with [x] and add summary links
|
||||
- Update task progress based on JSON files in .task/ directory
|
||||
- **CRITICAL**: Use session context paths provided by workflow:execute
|
||||
- **CRITICAL**: Use session context paths provided by context
|
||||
|
||||
**Session Context Usage**:
|
||||
- Always receive workflow directory path from agent prompt
|
||||
@@ -141,7 +124,7 @@ ELIF context insufficient OR task has flow control marker:
|
||||
|
||||
## Task Progress
|
||||
▸ **IMPL-001**: Create auth module → [📋](./.task/IMPL-001.json)
|
||||
- [x] **IMPL-001.1**: Database schema → [📋](./.task/IMPL-001.1.json) | [✅](./.summaries/IMPL-001.1.md)
|
||||
- [x] **IMPL-001.1**: Database schema → [📋](./.task/IMPL-001.1.json) | [✅](./.summaries/IMPL-001.1-summary.md)
|
||||
- [ ] **IMPL-001.2**: API endpoints → [📋](./.task/IMPL-001.2.json)
|
||||
|
||||
- [ ] **IMPL-002**: Add JWT validation → [📋](./.task/IMPL-002.json)
|
||||
@@ -220,13 +203,14 @@ ELIF context insufficient OR task has flow control marker:
|
||||
## Quality Checklist
|
||||
|
||||
Before completing any task, verify:
|
||||
- [ ] **Module verification complete** - All referenced modules/packages exist (verified with rg/grep/search)
|
||||
- [ ] Code compiles/runs without errors
|
||||
- [ ] All tests pass
|
||||
- [ ] Follows project conventions
|
||||
- [ ] Clear naming and error handling
|
||||
- [ ] No unnecessary complexity
|
||||
- [ ] Minimal debug output (essential logging only)
|
||||
- [ ] ASCII-only characters (no emojis/Unicode)
|
||||
- [ ] ASCII-only characters (no emojis/Unicode)
|
||||
- [ ] GBK encoding compatible
|
||||
- [ ] TODO list updated
|
||||
- [ ] Comprehensive summary document generated with all new components/methods listed
|
||||
@@ -234,6 +218,7 @@ Before completing any task, verify:
|
||||
## Key Reminders
|
||||
|
||||
**NEVER:**
|
||||
- Reference modules/packages without verifying existence first (use rg/grep/search)
|
||||
- Write code that doesn't compile/run
|
||||
- Add excessive debug output (verbose print(), console.log)
|
||||
- Use emojis or non-ASCII characters
|
||||
@@ -241,6 +226,7 @@ Before completing any task, verify:
|
||||
- Create unnecessary complexity
|
||||
|
||||
**ALWAYS:**
|
||||
- Verify module/package existence with rg/grep/search before referencing
|
||||
- Write working code incrementally
|
||||
- Test your implementation thoroughly
|
||||
- Minimize debug output - keep essential logging only
|
||||
|
||||
@@ -77,54 +77,6 @@ ELSE:
|
||||
→ Proceed with review using standard quality checks
|
||||
```
|
||||
|
||||
## Flow Control Pre-Analysis Phase (Execute When Required)
|
||||
|
||||
### Flow Control Execution
|
||||
When [FLOW_CONTROL] flag is present, execute comprehensive pre-review analysis:
|
||||
|
||||
Process each step from pre_analysis array sequentially:
|
||||
|
||||
**多步上下文获取过程**:
|
||||
1. 按顺序执行pre_analysis步骤:
|
||||
- 文档引用:读取项目规范、依赖任务总结
|
||||
- 搜索命令:灵活搜索相关代码和模式
|
||||
- CLI分析:使用gemini/codex进行深度分析
|
||||
- 自由探索:使用Read、Grep等工具获取补充上下文
|
||||
|
||||
**灵活命令示例**:
|
||||
```bash
|
||||
# 读取依赖任务总结
|
||||
bash(cat .workflow/WFS-[session-id]/.summaries/IMPL-1.1-summary.md)
|
||||
|
||||
# 搜索相关代码
|
||||
bash(rg "test|spec" src/ | head -20)
|
||||
|
||||
# 深度分析
|
||||
bash(gemini-wrapper -p "分析代码质量和测试覆盖")
|
||||
```
|
||||
|
||||
This executes comprehensive pre-review analysis that covers:
|
||||
- **Change understanding**: What specific task was being implemented
|
||||
- **Repository conventions**: Standards used in similar files and functions
|
||||
- **Impact analysis**: Other code that might be affected by these changes
|
||||
- **Test coverage validation**: Whether changes are properly tested
|
||||
- **Integration verification**: If necessary integration points are handled
|
||||
- **Security implications**: Potential security considerations
|
||||
- **Performance impact**: Performance-related changes and implications
|
||||
|
||||
This executes autonomous Codex CLI analysis that provides:
|
||||
- **Autonomous understanding**: Intelligent discovery of implementation context
|
||||
- **Code generation insights**: Autonomous development recommendations
|
||||
- **System-wide impact**: Comprehensive integration analysis
|
||||
- **Automated testing strategy**: Autonomous test implementation approach
|
||||
- **Quality assurance**: Self-guided validation and optimization recommendations
|
||||
|
||||
**Context Application for Review**:
|
||||
- Review changes against repository-specific standards for similar code
|
||||
- Compare implementation approach with established patterns for this type of feature
|
||||
- Validate test coverage specifically for the functionality that was implemented
|
||||
- Ensure integration points are properly handled based on repository practices
|
||||
|
||||
## Review Process (Mode-Adaptive)
|
||||
|
||||
### Deep Mode Review Process
|
||||
@@ -173,11 +125,10 @@ if [FAST_MODE]: apply targeted review process
|
||||
- Input validation and sanitization
|
||||
|
||||
### Code Quality & Dependencies
|
||||
- **Module import verification first** - Use `rg` to check all imports exist before other checks
|
||||
- Import/export correctness and path validation
|
||||
- Missing or unused imports identification
|
||||
- Circular dependency detection
|
||||
- Single responsibility principle
|
||||
- Clear variable and function names
|
||||
|
||||
### Performance
|
||||
- Algorithm complexity (time and space)
|
||||
@@ -230,7 +181,7 @@ if [FAST_MODE]: apply targeted review process
|
||||
|
||||
2. **Update TODO_LIST.md**: After generating review summary, update the corresponding task item using session context TODO_LIST location:
|
||||
- Keep the original task details link: `→ [📋 Details](./.task/[Task-ID].json)`
|
||||
- Add review summary link after pipe separator: `| [✅ Review](./.summaries/[Task-ID]-review.md)`
|
||||
- Add review summary link after pipe separator: `| [✅ Review](./.summaries/IMPL-[Task-ID]-summary.md)`
|
||||
- Mark the checkbox as completed: `- [x]`
|
||||
- Update progress percentages in the progress overview section
|
||||
|
||||
@@ -240,9 +191,9 @@ if [FAST_MODE]: apply targeted review process
|
||||
- Update last modified timestamp
|
||||
|
||||
4. **Review Summary Document Naming Convention**:
|
||||
- Implementation Task Reviews: `IMPL-001-review.md`
|
||||
- Subtask Reviews: `IMPL-001.1-review.md`
|
||||
- Detailed Subtask Reviews: `IMPL-001.1.1-review.md`
|
||||
- Implementation Task Reviews: `IMPL-001-summary.md`
|
||||
- Subtask Reviews: `IMPL-001.1-summary.md`
|
||||
- Detailed Subtask Reviews: `IMPL-001.1.1-summary.md`
|
||||
|
||||
## Output Format
|
||||
|
||||
|
||||
Reference in New Issue
Block a user