From 967e3805b7dfd3b6b364e4c81041d5fcf8d2ce9a Mon Sep 17 00:00:00 2001 From: catlog22 Date: Wed, 5 Nov 2025 21:48:43 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=A0=87=E5=87=86=E5=8C=96=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E8=A1=A8=E6=83=85=E7=AC=A6=E5=8F=B7=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=91=BD=E4=BB=A4=E6=A8=A1=E6=9D=BF=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新所有命令文档以提高可读性和一致性: - 移除所有表情符号(⚠️, ✅, ❌, ▸等),使用纯文本替代 - 统一标题格式,改进章节结构 - 简化状态指示器和格式标记 - 添加三个新的命令模板规范文档 新增文档: - COMMAND_FLOW_STANDARD.md - 标准命令流程规范 - COMMAND_TEMPLATE_EXECUTOR.md - 执行器命令模板 - COMMAND_TEMPLATE_ORCHESTRATOR.md - 编排器命令模板 影响范围: - CLI命令(cli-init, codex-execute, discuss-plan, execute) - 内存管理命令(skill-memory, tech-research, workflow-skill-memory) - 任务管理命令(breakdown, create, execute, replan) - 工作流命令(所有workflow相关命令) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/commands/cli/cli-init.md | 2 +- .claude/commands/cli/codex-execute.md | 32 +- .claude/commands/cli/discuss-plan.md | 10 +- .claude/commands/cli/execute.md | 22 +- .claude/commands/memory/skill-memory.md | 18 +- .claude/commands/memory/tech-research.md | 2 +- .../commands/memory/workflow-skill-memory.md | 8 +- .claude/commands/task/breakdown.md | 51 ++-- .claude/commands/task/create.md | 28 +- .claude/commands/task/execute.md | 28 +- .claude/commands/task/replan.md | 80 +++-- .../commands/workflow/action-plan-verify.md | 14 +- .claude/commands/workflow/execute.md | 4 +- .claude/commands/workflow/plan.md | 55 ++-- .claude/commands/workflow/resume.md | 12 + .claude/commands/workflow/review.md | 36 +-- .claude/commands/workflow/status.md | 19 +- .claude/commands/workflow/tdd-plan.md | 51 ++-- .claude/commands/workflow/tdd-verify.md | 45 ++- .../commands/workflow/test-cycle-execute.md | 29 +- .claude/commands/workflow/test-fix-gen.md | 40 ++- .claude/commands/workflow/test-gen.md | 38 ++- COMMAND_FLOW_STANDARD.md | 274 ++++++++++++++++++ COMMAND_TEMPLATE_EXECUTOR.md | 135 +++++++++ COMMAND_TEMPLATE_ORCHESTRATOR.md | 140 +++++++++ 25 files changed, 863 insertions(+), 310 deletions(-) create mode 100644 COMMAND_FLOW_STANDARD.md create mode 100644 COMMAND_TEMPLATE_EXECUTOR.md create mode 100644 COMMAND_TEMPLATE_ORCHESTRATOR.md diff --git a/.claude/commands/cli/cli-init.md b/.claude/commands/cli/cli-init.md index faee8114..7feb18c1 100644 --- a/.claude/commands/cli/cli-init.md +++ b/.claude/commands/cli/cli-init.md @@ -178,7 +178,7 @@ target/ /cli:cli-init --tool all --output=.config/ ``` -## EXECUTION INSTRUCTIONS ⚡ START HERE +## EXECUTION INSTRUCTIONS - START HERE **When this command is triggered, follow these exact steps:** diff --git a/.claude/commands/cli/codex-execute.md b/.claude/commands/cli/codex-execute.md index 840af018..8a0495c2 100644 --- a/.claude/commands/cli/codex-execute.md +++ b/.claude/commands/cli/codex-execute.md @@ -257,12 +257,12 @@ TodoWrite({ **When to Resume vs New Session**: ``` -✅ RESUME (same group): +RESUME (same group): - Subtasks share files/modules - Logical continuation of previous work - Same architectural domain -❌ NEW SESSION (different group): +NEW SESSION (different group): - Independent task area - Different files/modules - Switching architectural domains @@ -318,7 +318,7 @@ AskUserQuestion({ **During Execution**: ``` -📊 Task Flow Diagram: +Task Flow Diagram: [Group A: Auth Core] A1: Create user model ──┐ A2: Add validation ─┤─► [resume] ─► A3: Database schema @@ -331,7 +331,7 @@ AskUserQuestion({ C1: Unit tests ─────────────► [new session] C2: Integration tests ──────► [resume] -📋 Task Decomposition: +Task Decomposition: [Group A] 1. Create user model [Group A] 2. Add validation logic [resume] [Group A] 3. Implement database schema [resume] @@ -341,28 +341,28 @@ AskUserQuestion({ [Group C] 7. Unit tests [new session] [Group C] 8. Integration tests [resume] -▶️ [Group A] Executing Subtask 1/8: Create user model +[Group A] Executing Subtask 1/8: Create user model Starting new Codex session for Group A... [Codex output] - ✅ Subtask 1 completed + Subtask 1 completed -🔍 Git Verification: +Git Verification: M src/models/user.ts - ✅ Changes verified + Changes verified -▶️ [Group A] Executing Subtask 2/8: Add validation logic +[Group A] Executing Subtask 2/8: Add validation logic Resuming Codex session (same group)... [Codex output] - ✅ Subtask 2 completed + Subtask 2 completed -▶️ [Group B] Executing Subtask 4/8: Create auth endpoints +[Group B] Executing Subtask 4/8: Create auth endpoints Starting NEW Codex session for Group B... [Codex output] - ✅ Subtask 4 completed + Subtask 4 completed ... -✅ All Subtasks Completed -📊 Summary: [file references, changes, next steps] +All Subtasks Completed +Summary: [file references, changes, next steps] ``` **Final Summary**: @@ -370,8 +370,8 @@ AskUserQuestion({ # Task Execution Summary: [Task Description] ## Subtasks Completed -1. ✅ [Subtask 1]: [files modified] -2. ✅ [Subtask 2]: [files modified] +1. [Subtask 1]: [files modified] +2. [Subtask 2]: [files modified] ... ## Files Modified diff --git a/.claude/commands/cli/discuss-plan.md b/.claude/commands/cli/discuss-plan.md index 5180e67d..f92fa02a 100644 --- a/.claude/commands/cli/discuss-plan.md +++ b/.claude/commands/cli/discuss-plan.md @@ -279,11 +279,11 @@ Each round's output is structured as: | Command | Models | Rounds | Discussion | Implementation | Use Case | |---------|--------|--------|------------|----------------|----------| -| `/cli:mode:plan` | Gemini | 1 | ❌ NO | ❌ NO | Single-model planning | -| `/cli:analyze` | Gemini/Qwen | 1 | ❌ NO | ❌ NO | Code analysis | -| `/cli:execute` | Any | 1 | ❌ NO | ✅ YES | Direct implementation | -| `/cli:codex-execute` | Codex | 1 | ❌ NO | ✅ YES | Multi-stage implementation | -| `/cli:discuss-plan` | **Gemini+Codex+Claude** | **Multiple** | ✅ **YES** | ❌ **NO** | **Multi-perspective planning** | +| `/cli:mode:plan` | Gemini | 1 | NO | NO | Single-model planning | +| `/cli:analyze` | Gemini/Qwen | 1 | NO | NO | Code analysis | +| `/cli:execute` | Any | 1 | NO | YES | Direct implementation | +| `/cli:codex-execute` | Codex | 1 | NO | YES | Multi-stage implementation | +| `/cli:discuss-plan` | **Gemini+Codex+Claude** | **Multiple** | **YES** | **NO** | **Multi-perspective planning** | ## Best Practices diff --git a/.claude/commands/cli/execute.md b/.claude/commands/cli/execute.md index 34c83a43..c19d8907 100644 --- a/.claude/commands/cli/execute.md +++ b/.claude/commands/cli/execute.md @@ -27,7 +27,7 @@ Execute implementation tasks with **YOLO permissions** (auto-approves all confir ### YOLO Permissions Auto-approves: file pattern inference, execution, **file modifications**, summary generation -**⚠️ WARNING**: This command will make actual code changes without manual confirmation +**WARNING**: This command will make actual code changes without manual confirmation ### Execution Modes @@ -158,14 +158,14 @@ The agent handles all phases internally, including complexity-based tool selecti ## Examples -**Basic Implementation (Standard Mode)** (⚠️ modifies code): +**Basic Implementation (Standard Mode)** (modifies code): ```bash /cli:execute "implement JWT authentication with middleware" # Executes: Creates auth middleware, updates routes, modifies config # Result: NEW/MODIFIED code files with JWT implementation ``` -**Intelligent Implementation (Agent Mode)** (⚠️ modifies code): +**Intelligent Implementation (Agent Mode)** (modifies code): ```bash /cli:execute --agent "implement OAuth2 authentication with token refresh" # Phase 1: Classifies intent=execute, complexity=complex, keywords=['oauth2', 'auth', 'token', 'refresh'] @@ -176,7 +176,7 @@ The agent handles all phases internally, including complexity-based tool selecti # Result: Complete OAuth2 implementation + detailed execution log ``` -**Enhanced Implementation** (⚠️ modifies code): +**Enhanced Implementation** (modifies code): ```bash /cli:execute --enhance "implement JWT authentication" # Step 1: Enhance to expand requirements @@ -184,7 +184,7 @@ The agent handles all phases internally, including complexity-based tool selecti # Result: Complete auth system with MODIFIED code files ``` -**Task Execution** (⚠️ modifies code): +**Task Execution** (modifies code): ```bash /cli:execute IMPL-001 # Reads: .task/IMPL-001.json for requirements @@ -192,14 +192,14 @@ The agent handles all phases internally, including complexity-based tool selecti # Result: Code changes per task definition ``` -**Codex Implementation** (⚠️ modifies code): +**Codex Implementation** (modifies code): ```bash /cli:execute --tool codex "optimize database queries" # Executes: Codex with full file access # Result: MODIFIED query code, new indexes, updated tests ``` -**Qwen Code Generation** (⚠️ modifies code): +**Qwen Code Generation** (modifies code): ```bash /cli:execute --tool qwen --enhance "refactor auth module" # Step 1: Enhanced refactoring plan @@ -211,11 +211,11 @@ The agent handles all phases internally, including complexity-based tool selecti | Command | Intent | Code Changes | Auto-Approve | |---------|--------|--------------|--------------| -| `/cli:analyze` | Understand code | ❌ NO | N/A | -| `/cli:chat` | Ask questions | ❌ NO | N/A | -| `/cli:execute` | **Implement** | ✅ **YES** | ✅ **YES** | +| `/cli:analyze` | Understand code | NO | N/A | +| `/cli:chat` | Ask questions | NO | N/A | +| `/cli:execute` | **Implement** | **YES** | **YES** | ## Notes - Command templates, YOLO mode details, and session management: see intelligent-tools-strategy.md (loaded in memory) -- **⚠️ Code Modification**: This command modifies code - execution logs document changes made +- **Code Modification**: This command modifies code - execution logs document changes made diff --git a/.claude/commands/memory/skill-memory.md b/.claude/commands/memory/skill-memory.md index 83ba9ddc..0c8d918d 100644 --- a/.claude/commands/memory/skill-memory.md +++ b/.claude/commands/memory/skill-memory.md @@ -245,7 +245,7 @@ Everything + [Examples](../../../.workflow/docs/{project_name}/EXAMPLES.md) **Return to User**: ``` -✅ SKILL Package Generation Complete +SKILL Package Generation Complete Project: {project_name} Documentation: .workflow/docs/{project_name}/ ({doc_count} files) @@ -510,14 +510,14 @@ User triggers command ## Benefits -- ✅ **Pure Orchestrator**: No task JSON generation, delegates to /memory:docs -- ✅ **Auto-Continue**: Autonomous 4-phase execution without user interaction -- ✅ **Intelligent Skip**: Detects existing docs and skips regeneration for fast SKILL updates -- ✅ **Always Fresh Index**: Phase 4 always executes to ensure SKILL.md stays synchronized -- ✅ **Simplified**: ~70% less code than previous version -- ✅ **Maintainable**: Changes to /memory:docs automatically apply -- ✅ **Direct Generation**: Phase 4 directly writes SKILL.md -- ✅ **Flexible**: Supports all /memory:docs options (tool, mode, cli-execute) +- **Pure Orchestrator**: No task JSON generation, delegates to /memory:docs +- **Auto-Continue**: Autonomous 4-phase execution without user interaction +- **Intelligent Skip**: Detects existing docs and skips regeneration for fast SKILL updates +- **Always Fresh Index**: Phase 4 always executes to ensure SKILL.md stays synchronized +- **Simplified**: ~70% less code than previous version +- **Maintainable**: Changes to /memory:docs automatically apply +- **Direct Generation**: Phase 4 directly writes SKILL.md +- **Flexible**: Supports all /memory:docs options (tool, mode, cli-execute) ## Architecture diff --git a/.claude/commands/memory/tech-research.md b/.claude/commands/memory/tech-research.md index c64eebb6..561a276a 100644 --- a/.claude/commands/memory/tech-research.md +++ b/.claude/commands/memory/tech-research.md @@ -297,7 +297,7 @@ Generate a complete tech stack SKILL package with Exa research. **Final Report**: ``` -✅ Tech Stack SKILL Package Complete +Tech Stack SKILL Package Complete Tech Stack: {TECH_STACK_NAME} Location: .claude/skills/{TECH_STACK_NAME}/ diff --git a/.claude/commands/memory/workflow-skill-memory.md b/.claude/commands/memory/workflow-skill-memory.md index cde3a7a0..b74c5198 100644 --- a/.claude/commands/memory/workflow-skill-memory.md +++ b/.claude/commands/memory/workflow-skill-memory.md @@ -43,7 +43,7 @@ Generate SKILL package from archived workflow sessions using agent-driven analys **Expected Output**: ``` -✅ Session WFS-user-auth processed +Session WFS-user-auth processed Updated: - sessions-timeline.md (1 session added) - lessons-learned.md (3 lessons merged) @@ -73,7 +73,7 @@ Updated: **Expected Output**: ``` -✅ All sessions processed in parallel +All sessions processed in parallel Sessions: 8 total Updated: - sessions-timeline.md (8 sessions) @@ -395,7 +395,7 @@ Mark all tasks as completed. **Single Session Mode**: ``` -✅ Session {session_id} processed successfully +Session {session_id} processed successfully Updated: - sessions-timeline.md @@ -408,7 +408,7 @@ SKILL Location: .claude/skills/workflow-progress/SKILL.md **All Sessions Mode**: ``` -✅ All sessions processed in parallel +All sessions processed in parallel Sessions: {count} total Functional Domains: {domain_list} diff --git a/.claude/commands/task/breakdown.md b/.claude/commands/task/breakdown.md index 14b6f213..a68a15ca 100644 --- a/.claude/commands/task/breakdown.md +++ b/.claude/commands/task/breakdown.md @@ -15,7 +15,7 @@ Breaks down complex tasks into executable subtasks with context inheritance and ## Core Features -⚠️ **CRITICAL**: Manual breakdown with safety controls to prevent file conflicts and task limit violations. +**CRITICAL**: Manual breakdown with safety controls to prevent file conflicts and task limit violations. ### Breakdown Process 1. **Session Check**: Verify active session contains parent task @@ -50,7 +50,7 @@ Interactive process: Task: Build authentication module Current total tasks: 6/10 -⚠️ MANUAL BREAKDOWN REQUIRED +MANUAL BREAKDOWN REQUIRED Define subtasks manually (remaining capacity: 4 tasks): 1. Enter subtask title: User authentication core @@ -59,11 +59,11 @@ Define subtasks manually (remaining capacity: 4 tasks): 2. Enter subtask title: OAuth integration Focus files: services/OAuthService.js, routes/oauth.js -⚠️ FILE CONFLICT DETECTED: +FILE CONFLICT DETECTED: - routes/auth.js appears in multiple subtasks - Recommendation: Merge related authentication routes -⚠️ SIMILAR FUNCTIONALITY WARNING: +SIMILAR FUNCTIONALITY WARNING: - "User authentication" and "OAuth integration" both handle auth - Consider combining into single task @@ -83,10 +83,10 @@ AskUserQuestion({ User selected: "Proceed with breakdown" -✅ Task IMPL-1 broken down: -▸ IMPL-1: Build authentication module (container) - ├── IMPL-1.1: User authentication core → @code-developer - └── IMPL-1.2: OAuth integration → @code-developer +Task IMPL-1 broken down: +IMPL-1: Build authentication module (container) + ├── IMPL-1.1: User authentication core -> @code-developer + └── IMPL-1.2: OAuth integration -> @code-developer Files updated: .task/IMPL-1.json + 2 subtask files + TODO_LIST.md ``` @@ -167,45 +167,38 @@ Files updated: .task/IMPL-1.json + 2 subtask files + TODO_LIST.md ```bash /task:breakdown impl-1 -▸ impl-1: Build authentication (container) - ├── impl-1.1: Design schema → @planning-agent - ├── impl-1.2: Implement logic + tests → @code-developer - └── impl-1.3: Execute & fix tests → @test-fix-agent +impl-1: Build authentication (container) + ├── impl-1.1: Design schema -> @planning-agent + ├── impl-1.2: Implement logic + tests -> @code-developer + └── impl-1.3: Execute & fix tests -> @test-fix-agent ``` ## Error Handling ```bash # Task not found -❌ Task IMPL-5 not found +Task IMPL-5 not found # Already broken down -⚠️ Task IMPL-1 already has subtasks +Task IMPL-1 already has subtasks # Wrong status -❌ Cannot breakdown completed task IMPL-2 +Cannot breakdown completed task IMPL-2 # 10-task limit exceeded -❌ Breakdown would exceed 10-task limit (current: 8, proposed: 4) - Suggestion: Re-scope project into smaller iterations +Breakdown would exceed 10-task limit (current: 8, proposed: 4) +Suggestion: Re-scope project into smaller iterations # File conflicts detected -⚠️ File conflict: routes/auth.js appears in IMPL-1.1 and IMPL-1.2 - Recommendation: Merge subtasks or redistribute files +File conflict: routes/auth.js appears in IMPL-1.1 and IMPL-1.2 +Recommendation: Merge subtasks or redistribute files # Similar functionality warning -⚠️ Similar functions detected: "user login" and "authentication" - Consider consolidating related functionality +Similar functions detected: "user login" and "authentication" +Consider consolidating related functionality # Manual breakdown required -❌ Automatic breakdown disabled. Use manual breakdown process. +Automatic breakdown disabled. Use manual breakdown process. ``` -## Related Commands - -- `/task:create` - Create new tasks -- `/task:execute` - Execute subtasks -- `/workflow:status` - View task hierarchy -- `/workflow:plan` - Plan within 10-task limit - **System ensures**: Manual breakdown control with file cohesion enforcement, similar functionality detection, and 10-task limit compliance \ No newline at end of file diff --git a/.claude/commands/task/create.md b/.claude/commands/task/create.md index 20097709..c8ffd4f8 100644 --- a/.claude/commands/task/create.md +++ b/.claude/commands/task/create.md @@ -37,7 +37,7 @@ Creates new implementation tasks with automatic context awareness and ID generat Output: ``` -✅ Task created: IMPL-1 +Task created: IMPL-1 Title: Build authentication module Type: feature Agent: code-developer @@ -73,7 +73,7 @@ Status: pending ### Analysis Triggers When implementation details incomplete: ```bash -⚠️ Task requires analysis for implementation details +Task requires analysis for implementation details Suggest running: gemini analysis for file locations and dependencies ``` @@ -117,16 +117,16 @@ Based on task type and title keywords: ```bash # No workflow session -❌ No active workflow found -→ Use: /workflow init "project name" +No active workflow found +Use: /workflow init "project name" # Duplicate task -⚠️ Similar task exists: IMPL-3 -→ Continue anyway? (y/n) +Similar task exists: IMPL-3 +Continue anyway? (y/n) # Max depth exceeded -❌ Cannot create IMPL-1.2.1 (max 2 levels) -→ Use: IMPL-2 for new main task +Cannot create IMPL-1.2.1 (max 2 levels) +Use: IMPL-2 for new main task ``` ## Examples @@ -135,7 +135,7 @@ Based on task type and title keywords: ```bash /task:create "Implement user authentication" -✅ Created IMPL-1: Implement user authentication +Created IMPL-1: Implement user authentication Type: feature Agent: code-developer Status: pending @@ -145,14 +145,8 @@ Status: pending ```bash /task:create "Fix login validation bug" --type=bugfix -✅ Created IMPL-2: Fix login validation bug +Created IMPL-2: Fix login validation bug Type: bugfix Agent: code-developer Status: pending -``` - -## Related Commands - -- `/task:breakdown` - Break into subtasks -- `/task:execute` - Execute with agent -- `/context` - View task details \ No newline at end of file +``` \ No newline at end of file diff --git a/.claude/commands/task/execute.md b/.claude/commands/task/execute.md index ace5cb79..06cc1604 100644 --- a/.claude/commands/task/execute.md +++ b/.claude/commands/task/execute.md @@ -4,12 +4,12 @@ description: Execute tasks with appropriate agents and context-aware orchestrati argument-hint: "task-id" --- -### 🚀 **Command Overview: `/task:execute`** +## Command Overview: /task:execute -- **Purpose**: Executes tasks using intelligent agent selection, context preparation, and progress tracking. +**Purpose**: Executes tasks using intelligent agent selection, context preparation, and progress tracking. -### ⚙️ **Execution Modes** +## Execution Modes - **auto (Default)** - Fully autonomous execution with automatic agent selection. @@ -22,7 +22,7 @@ argument-hint: "task-id" - Optional manual review using `@universal-executor`. - Used only when explicitly requested by user. -### 🤖 **Agent Selection Logic** +## Agent Selection Logic The system determines the appropriate agent for a task using the following logic. @@ -52,11 +52,11 @@ FUNCTION select_agent(task, agent_override): END FUNCTION ``` -### 🔄 **Core Execution Protocol** +## Core Execution Protocol -`Pre-Execution` **->** `Execution` **->** `Post-Execution` +`Pre-Execution` -> `Execution` -> `Post-Execution` -### ✅ **Pre-Execution Protocol** +### Pre-Execution Protocol `Validate Task & Dependencies` **->** `Prepare Execution Context` **->** `Coordinate with TodoWrite` @@ -65,7 +65,7 @@ END FUNCTION - **Session Context Injection**: Provides workflow directory paths to agents for TODO_LIST.md and summary management. - **TodoWrite Coordination**: Generates execution Todos and checkpoints, syncing with `TODO_LIST.md`. -### 🏁 **Post-Execution Protocol** +### Post-Execution Protocol `Update Task Status` **->** `Generate Summary` **->** `Save Artifacts` **->** `Sync All Progress` **->** `Validate File Integrity` @@ -73,7 +73,7 @@ END FUNCTION - Creates a summary in `.summaries/`. - Stores outputs and syncs progress across the entire workflow session. -### 🧠 **Task & Subtask Execution Logic** +### Task & Subtask Execution Logic This logic defines how single, multiple, or parent tasks are handled. @@ -99,7 +99,7 @@ FUNCTION execute_task_command(task_id, mode, parallel_flag): END FUNCTION ``` -### 🛡️ **Error Handling & Recovery Logic** +### Error Handling & Recovery Logic ```pseudo FUNCTION pre_execution_check(task): @@ -124,7 +124,7 @@ END FUNCTION ``` -### 📄 **Simplified Context Structure (JSON)** +### Simplified Context Structure (JSON) This is the simplified data structure loaded to provide context for task execution. @@ -213,7 +213,7 @@ This is the simplified data structure loaded to provide context for task executi } ``` -### 🎯 **Agent-Specific Context** +### Agent-Specific Context Different agents receive context tailored to their function, including implementation details: @@ -243,13 +243,13 @@ Different agents receive context tailored to their function, including implement - Dependency validation from implementation.context_notes.dependencies - Architecture compliance checks -### 🗃️ **Simplified File Output** +### Simplified File Output - **Task JSON File (`.task/.json`)**: Updated with status and last attempt time only. - **Session File (`workflow-session.json`)**: Updated task stats (completed count). - **Summary File**: Generated in `.summaries/` upon completion (optional). -### 📝 **Simplified Summary Template** +### Simplified Summary Template Optional summary file generated at `.summaries/IMPL-[task-id]-summary.md`. diff --git a/.claude/commands/task/replan.md b/.claude/commands/task/replan.md index 7bf8321b..7646fb62 100644 --- a/.claude/commands/task/replan.md +++ b/.claude/commands/task/replan.md @@ -24,7 +24,7 @@ Replans individual tasks or batch processes multiple tasks with change tracking - **Change Documentation**: Track all modifications - **Progress Tracking**: TodoWrite integration for batch operations -⚠️ **CRITICAL**: Validates active session before replanning +**CRITICAL**: Validates active session before replanning ## Operation Modes @@ -189,7 +189,7 @@ AskUserQuestion({ User selected: "Yes, rollback" -✅ Task rolled back to version 1.1 +Task rolled back to version 1.1 ``` ## Batch Processing with TodoWrite @@ -201,7 +201,7 @@ When processing multiple tasks, automatically creates TodoWrite task list: **Batch Replan Progress**: - [x] IMPL-002: Add FR-12 draft saving acceptance criteria - [x] IMPL-003: Add FR-14 history tracking acceptance criteria -- [⧗] IMPL-004: Add FR-09 response surface explicit coverage +- [ ] IMPL-004: Add FR-09 response surface explicit coverage - [ ] IMPL-008: Add NFR performance validation steps ``` @@ -255,9 +255,9 @@ AskUserQuestion({ User selected: "Yes, apply" -✓ Version 1.2 created -✓ Context updated -✓ Backup saved to .task/backup/IMPL-1-v1.1.json +Version 1.2 created +Context updated +Backup saved to .task/backup/IMPL-1-v1.1.json ``` ### Single Task - File Input @@ -267,9 +267,9 @@ User selected: "Yes, apply" Loading requirements.md... Applying specification changes... -✓ Task updated with new requirements -✓ Version 1.1 created -✓ Backup saved to .task/backup/IMPL-2-v1.0.json +Task updated with new requirements +Version 1.1 created +Backup saved to .task/backup/IMPL-2-v1.0.json ``` ### Batch Mode - From Verification Report @@ -286,23 +286,23 @@ Found 4 tasks requiring replanning: Creating task tracking list... Processing IMPL-002... -✓ Backup created: .task/backup/IMPL-002-v1.0.json -✓ Updated to v1.1 +Backup created: .task/backup/IMPL-002-v1.0.json +Updated to v1.1 Processing IMPL-003... -✓ Backup created: .task/backup/IMPL-003-v1.0.json -✓ Updated to v1.1 +Backup created: .task/backup/IMPL-003-v1.0.json +Updated to v1.1 Processing IMPL-004... -✓ Backup created: .task/backup/IMPL-004-v1.0.json -✓ Updated to v1.1 +Backup created: .task/backup/IMPL-004-v1.0.json +Updated to v1.1 Processing IMPL-008... -✓ Backup created: .task/backup/IMPL-008-v1.0.json -✓ Updated to v1.1 +Backup created: .task/backup/IMPL-008-v1.0.json +Updated to v1.1 -✅ Batch replan completed: 4/4 successful -📋 Summary report saved +Batch replan completed: 4/4 successful +Summary report saved ``` ### Batch Mode - Auto-detection @@ -320,35 +320,35 @@ Entering batch mode... ### Single Task Errors ```bash # Task not found -❌ Task IMPL-5 not found -→ Check task ID with /workflow:status +Task IMPL-5 not found +Check task ID with /workflow:status # Task completed -⚠️ Task IMPL-1 is completed (cannot replan) -→ Create new task for additional work +Task IMPL-1 is completed (cannot replan) +Create new task for additional work # File not found -❌ File requirements.md not found -→ Check file path +File requirements.md not found +Check file path # No input provided -❌ Please specify changes needed -→ Provide text, file, or verification report +Please specify changes needed +Provide text, file, or verification report ``` ### Batch Mode Errors ```bash # Invalid verification report -❌ File does not contain valid verification report format -→ Check report structure or use single task mode +File does not contain valid verification report format +Check report structure or use single task mode # Partial failures -⚠️ Batch completed with errors: 3/4 successful -→ Review error details in summary report +Batch completed with errors: 3/4 successful +Review error details in summary report # No replan recommendations found -❌ Verification report contains no replan recommendations -→ Check report content or use /workflow:action-plan-verify first +Verification report contains no replan recommendations +Check report content or use /workflow:action-plan-verify first ``` ## Batch Mode Integration @@ -429,16 +429,4 @@ TodoWrite({ TodoWrite({ todos: updateTaskStatus(taskId, "completed") }); -``` - -## Related Commands - -- `/workflow:status` - View task structure and versions -- `/workflow:action-plan-verify` - Generate verification report for batch mode -- `/task:execute` - Execute replanned task -- `/task:create` - Create new tasks -- `/task:breakdown` - Break down complex tasks - -## Context - -$ARGUMENTS \ No newline at end of file +``` \ No newline at end of file diff --git a/.claude/commands/workflow/action-plan-verify.md b/.claude/commands/workflow/action-plan-verify.md index c090bac1..09d0322b 100644 --- a/.claude/commands/workflow/action-plan-verify.md +++ b/.claude/commands/workflow/action-plan-verify.md @@ -242,10 +242,10 @@ Output a Markdown report (no file writes) with the following structure: | Requirement ID | Requirement Summary | Has Task? | Task IDs | Priority Match | Notes | |----------------|---------------------|-----------|----------|----------------|-------| -| FR-01 | User authentication | ✅ Yes | IMPL-1.1, IMPL-1.2 | ✅ Match | Complete | -| FR-02 | Data export | ✅ Yes | IMPL-2.3 | ⚠️ Mismatch | High req → Med priority task | -| FR-03 | Profile management | ❌ No | - | - | **CRITICAL: Zero coverage** | -| NFR-01 | Response time <200ms | ❌ No | - | - | **HIGH: No performance tasks** | +| FR-01 | User authentication | Yes | IMPL-1.1, IMPL-1.2 | Match | Complete | +| FR-02 | Data export | Yes | IMPL-2.3 | Mismatch | High req → Med priority task | +| FR-03 | Profile management | No | - | - | **CRITICAL: Zero coverage** | +| NFR-01 | Response time <200ms | No | - | - | **HIGH: No performance tasks** | **Coverage Metrics**: - Functional Requirements: 85% (17/20 covered) @@ -264,7 +264,7 @@ Output a Markdown report (no file writes) with the following structure: ### Dependency Graph Issues -**Circular Dependencies**: None detected ✅ +**Circular Dependencies**: None detected **Broken Dependencies**: - IMPL-2.3 depends on "IMPL-2.4" (non-existent) @@ -323,12 +323,12 @@ Output a Markdown report (no file writes) with the following structure: #### Action Recommendations **If CRITICAL Issues Exist**: -- ❌ **BLOCK EXECUTION** - Resolve critical issues before proceeding +- **BLOCK EXECUTION** - Resolve critical issues before proceeding - Use TodoWrite to track all required fixes - Fix broken dependencies and circular references **If Only HIGH/MEDIUM/LOW Issues**: -- ⚠️ **PROCEED WITH CAUTION** - Fix high-priority issues first +- **PROCEED WITH CAUTION** - Fix high-priority issues first - Use TodoWrite to systematically track and complete all improvements #### TodoWrite-Based Remediation Workflow diff --git a/.claude/commands/workflow/execute.md b/.claude/commands/workflow/execute.md index 9b36ff36..17c03461 100644 --- a/.claude/commands/workflow/execute.md +++ b/.claude/commands/workflow/execute.md @@ -406,8 +406,8 @@ TodoWrite({ #### TODO_LIST.md Update Timing **Single source of truth for task status** - enables lazy loading by providing task metadata without reading JSONs -- **Before Agent Launch**: Mark task as `in_progress` (⚠️) -- **After Task Complete**: Mark as `completed` (✅), advance to next +- **Before Agent Launch**: Mark task as `in_progress` +- **After Task Complete**: Mark as `completed`, advance to next - **On Error**: Keep as `in_progress`, add error note - **Workflow Complete**: Call `/workflow:session:complete` diff --git a/.claude/commands/workflow/plan.md b/.claude/commands/workflow/plan.md index 3b9bc7ab..b7670384 100644 --- a/.claude/commands/workflow/plan.md +++ b/.claude/commands/workflow/plan.md @@ -153,7 +153,7 @@ CONTEXT: Existing user database schema, REST API endpoints **Relationship with Brainstorm Phase**: - If brainstorm role analyses exist ([role]/analysis.md files), Phase 3 analysis incorporates them as input -- **⚠️ User's original intent is ALWAYS primary**: New or refined user goals override brainstorm recommendations +- **User's original intent is ALWAYS primary**: New or refined user goals override brainstorm recommendations - **Role analysis.md files define "WHAT"**: Requirements, design specs, role-specific insights - **IMPL_PLAN.md defines "HOW"**: Executable task breakdown, dependencies, implementation sequence - Task generation translates high-level role analyses into concrete, actionable work items @@ -192,12 +192,12 @@ Planning complete for session: [sessionId] Tasks generated: [count] Plan: .workflow/[sessionId]/IMPL_PLAN.md -✅ Recommended Next Steps: +Recommended Next Steps: 1. /workflow:action-plan-verify --session [sessionId] # Verify plan quality before execution 2. /workflow:status # Review task breakdown 3. /workflow:execute # Start implementation (after verification) -⚠️ Quality Gate: Consider running /workflow:action-plan-verify to catch issues early +Quality Gate: Consider running /workflow:action-plan-verify to catch issues early ``` ## TodoWrite Pattern @@ -323,24 +323,24 @@ Return summary to user ## Coordinator Checklist -✅ **Pre-Phase**: Convert user input to structured format (GOAL/SCOPE/CONTEXT) -✅ Initialize TodoWrite before any command (Phase 3 added dynamically after Phase 2) -✅ Execute Phase 1 immediately with structured description -✅ Parse session ID from Phase 1 output, store in memory -✅ Pass session ID and structured description to Phase 2 command -✅ Parse context path from Phase 2 output, store in memory -✅ **Extract conflict_risk from context-package.json**: Determine Phase 3 execution -✅ **If conflict_risk ≥ medium**: Launch Phase 3 conflict-resolution with sessionId and contextPath -✅ Wait for Phase 3 completion (if executed), verify CONFLICT_RESOLUTION.md created -✅ **If conflict_risk is none/low**: Skip Phase 3, proceed directly to Phase 4 -✅ **Build Phase 4 command** based on flags: +- **Pre-Phase**: Convert user input to structured format (GOAL/SCOPE/CONTEXT) +- Initialize TodoWrite before any command (Phase 3 added dynamically after Phase 2) +- Execute Phase 1 immediately with structured description +- Parse session ID from Phase 1 output, store in memory +- Pass session ID and structured description to Phase 2 command +- Parse context path from Phase 2 output, store in memory +- **Extract conflict_risk from context-package.json**: Determine Phase 3 execution +- **If conflict_risk ≥ medium**: Launch Phase 3 conflict-resolution with sessionId and contextPath +- Wait for Phase 3 completion (if executed), verify CONFLICT_RESOLUTION.md created +- **If conflict_risk is none/low**: Skip Phase 3, proceed directly to Phase 4 +- **Build Phase 4 command** based on flags: - Base command: `/workflow:tools:task-generate` (or `-agent` if `--agent` flag) - Add `--session [sessionId]` - Add `--cli-execute` if flag present -✅ Pass session ID to Phase 4 command -✅ Verify all Phase 4 outputs -✅ Update TodoWrite after each phase (dynamically adjust for Phase 3 presence) -✅ After each phase, automatically continue to next phase based on TodoList status +- Pass session ID to Phase 4 command +- Verify all Phase 4 outputs +- Update TodoWrite after each phase (dynamically adjust for Phase 3 presence) +- After each phase, automatically continue to next phase based on TodoList status ## Structure Template Reference @@ -368,3 +368,22 @@ CONSTRAINTS: [Limitations or boundaries] # Phase 2 /workflow:tools:context-gather --session WFS-123 "GOAL: Build authentication\nSCOPE: JWT, login, registration\nCONTEXT: REST API" ``` + +## Related Commands + +**Prerequisite Commands**: +- `/workflow:brainstorm:artifacts` - Optional: Generate role-based analyses before planning (if complex requirements need multiple perspectives) +- `/workflow:brainstorm:synthesis` - Optional: Refine brainstorm analyses with clarifications + +**Called by This Command** (5 phases): +- `/workflow:session:start` - Phase 1: Create or discover workflow session +- `/workflow:tools:context-gather` - Phase 2: Gather project context and analyze codebase +- `/workflow:tools:conflict-resolution` - Phase 3: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium) +- `/compact` - Phase 3: Memory optimization (if context approaching limits) +- `/workflow:tools:task-generate` - Phase 4: Generate task JSON files with manual approach +- `/workflow:tools:task-generate-agent` - Phase 4: Generate task JSON files with agent-driven approach (when `--agent` flag used) + +**Follow-up Commands**: +- `/workflow:action-plan-verify` - Recommended: Verify plan quality and catch issues before execution +- `/workflow:status` - Review task breakdown and current progress +- `/workflow:execute` - Begin implementation of generated tasks diff --git a/.claude/commands/workflow/resume.md b/.claude/commands/workflow/resume.md index fb4e3059..529d8258 100644 --- a/.claude/commands/workflow/resume.md +++ b/.claude/commands/workflow/resume.md @@ -89,5 +89,17 @@ The special `--resume-session` flag tells `/workflow:execute`: 3. **Agent coordination**: TodoWrite and agent execution initiated successfully 4. **Context preservation**: Session state and progress properly maintained +## Related Commands + +**Prerequisite Commands**: +- `/workflow:plan` or `/workflow:execute` - Workflow must be in progress or paused + +**Called by This Command** (2 phases): +- `/workflow:status` - Phase 1: Analyze current session status and identify resume point +- `/workflow:execute` - Phase 2: Resume execution with `--resume-session` flag + +**Follow-up Commands**: +- None - Workflow continues automatically via `/workflow:execute` + --- *Sequential command coordination for workflow session resumption* \ No newline at end of file diff --git a/.claude/commands/workflow/review.md b/.claude/commands/workflow/review.md index 82031872..339229ca 100644 --- a/.claude/commands/workflow/review.md +++ b/.claude/commands/workflow/review.md @@ -4,17 +4,17 @@ description: Optional specialized review (security, architecture, docs) for comp argument-hint: "[--type=security|architecture|action-items|quality] [optional: session-id]" --- -### 🚀 Command Overview: `/workflow:review` +## Command Overview: /workflow:review **Optional specialized review** for completed implementations. In the standard workflow, **passing tests = approved code**. Use this command only when specialized review is required (security, architecture, compliance, docs). ## Philosophy: "Tests Are the Review" -- ✅ **Default**: All tests pass → Code approved -- 🔍 **Optional**: Specialized reviews for: - - 🔒 Security audits (vulnerabilities, auth/authz) - - 🏗️ Architecture compliance (patterns, technical debt) - - 📋 Action items verification (requirements met, acceptance criteria) +- **Default**: All tests pass -> Code approved +- **Optional**: Specialized reviews for: + - Security audits (vulnerabilities, auth/authz) + - Architecture compliance (patterns, technical debt) + - Action items verification (requirements met, acceptance criteria) ## Review Types @@ -44,13 +44,13 @@ fi # Step 2: Validation if [ ! -d ".workflow/${sessionId}" ]; then - echo "❌ Session ${sessionId} not found" + echo "Session ${sessionId} not found" exit 1 fi # Check for completed tasks if [ ! -d ".workflow/${sessionId}/.summaries" ] || [ -z "$(find .workflow/${sessionId}/.summaries/ -name "IMPL-*.md" -type f 2>/dev/null)" ]; then - echo "❌ No completed implementation found. Complete implementation first" + echo "No completed implementation found. Complete implementation first" exit 1 fi @@ -59,7 +59,7 @@ review_type="${TYPE_ARG:-quality}" # Redirect docs review to specialized command if [ "$review_type" = "docs" ]; then - echo "💡 For documentation generation, please use:" + echo "For documentation generation, please use:" echo " /workflow:tools:docs" echo "" echo "The docs command provides:" @@ -73,7 +73,7 @@ fi # BASH_EXECUTION_STOPS → MODEL_ANALYSIS_BEGINS ``` -### 🧠 Model Analysis Phase +### Model Analysis Phase After bash validation, the model takes control to: @@ -205,7 +205,7 @@ After bash validation, the model takes control to: ```bash # If architecture or quality issues found, suggest memory update if [ "$review_type" = "architecture" ] || [ "$review_type" = "quality" ]; then - echo "💡 Consider updating project documentation:" + echo "Consider updating project documentation:" echo " /update-memory-related" fi ``` @@ -226,7 +226,7 @@ After bash validation, the model takes control to: /workflow:review --type=docs ``` -## ✨ Features +## Features - **Simple Validation**: Check session exists and has completed tasks - **No Complex Orchestration**: Direct analysis, no multi-phase pipeline @@ -240,10 +240,10 @@ After bash validation, the model takes control to: ``` Standard Workflow: - plan → execute → test-gen → execute ✅ + plan -> execute -> test-gen -> execute (complete) Optional Review (when needed): - plan → execute → test-gen → execute → review (security/architecture/docs) + plan -> execute -> test-gen -> execute -> review (security/architecture/docs) ``` **When to Use**: @@ -256,11 +256,3 @@ Optional Review (when needed): - Regular development (tests are sufficient) - Simple bug fixes (test-fix-agent handles it) - Minor changes (update-memory-related is enough) - -## Related Commands - -- `/workflow:execute` - Must complete implementation first -- `/workflow:test-gen` - Primary quality gate (tests) -- `/workflow:tools:docs` - Generate hierarchical documentation (use instead of `--type=docs`) -- `/update-memory-related` - Update CLAUDE.md docs after architecture findings -- `/workflow:status` - Check session status diff --git a/.claude/commands/workflow/status.md b/.claude/commands/workflow/status.md index 8e5d17be..472f0b2a 100644 --- a/.claude/commands/workflow/status.md +++ b/.claude/commands/workflow/status.md @@ -51,11 +51,11 @@ find .workflow/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l **Progress**: 3/8 tasks completed ## Active Tasks -- [⚠️] impl-1: Current task in progress +- [IN PROGRESS] impl-1: Current task in progress - [ ] impl-2: Next pending task ## Completed Tasks -- [✅] impl-0: Setup completed +- [COMPLETED] impl-0: Setup completed ``` ## Simple Bash Commands @@ -112,13 +112,8 @@ Summary: .summaries/impl-1-summary.md ### Validation Results ``` -✅ Session file valid -✅ 8 task files found -✅ 3 summaries found -⚠️ 5 tasks pending completion -``` - -## Related Commands -- `/workflow:execute` - Uses this for task discovery -- `/workflow:resume` - Uses this for progress analysis -- `/workflow:session:status` - Shows session metadata \ No newline at end of file +Session file valid +8 task files found +3 summaries found +5 tasks pending completion +``` \ No newline at end of file diff --git a/.claude/commands/workflow/tdd-plan.md b/.claude/commands/workflow/tdd-plan.md index 6f58d5da..a2786c09 100644 --- a/.claude/commands/workflow/tdd-plan.md +++ b/.claude/commands/workflow/tdd-plan.md @@ -171,14 +171,14 @@ Total tasks: [M] (1 task per simple feature + subtasks for complex features) Task breakdown: - Simple features: [K] tasks (IMPL-1 to IMPL-K) - Complex features: [L] features with [P] subtasks -- Total task count: [M] (within 10-task limit ✅) +- Total task count: [M] (within 10-task limit) Structure: -- IMPL-1: {Feature 1 Name} (Internal: 🔴 Red → 🟢 Green → 🔵 Refactor) -- IMPL-2: {Feature 2 Name} (Internal: 🔴 Red → 🟢 Green → 🔵 Refactor) +- IMPL-1: {Feature 1 Name} (Internal: Red → Green → Refactor) +- IMPL-2: {Feature 2 Name} (Internal: Red → Green → Refactor) - IMPL-3: {Complex Feature} (Container) - - IMPL-3.1: {Sub-feature A} (Internal: 🔴 Red → 🟢 Green → 🔵 Refactor) - - IMPL-3.2: {Sub-feature B} (Internal: 🔴 Red → 🟢 Green → 🔵 Refactor) + - IMPL-3.1: {Sub-feature A} (Internal: Red → Green → Refactor) + - IMPL-3.2: {Sub-feature B} (Internal: Red → Green → Refactor) [...] Plans generated: @@ -192,12 +192,12 @@ TDD Configuration: - Green phase includes test-fix cycle (max 3 iterations) - Auto-revert on max iterations reached -✅ Recommended Next Steps: +Recommended Next Steps: 1. /workflow:action-plan-verify --session [sessionId] # Verify TDD plan quality and dependencies 2. /workflow:execute --session [sessionId] # Start TDD execution 3. /workflow:tdd-verify [sessionId] # Post-execution TDD compliance check -⚠️ Quality Gate: Consider running /workflow:action-plan-verify to validate TDD task structure and dependencies +Quality Gate: Consider running /workflow:action-plan-verify to validate TDD task structure and dependencies ``` ## TodoWrite Pattern @@ -258,11 +258,6 @@ Convert user input to TDD-structured format: - **Command failure**: Keep phase in_progress, report error - **TDD validation failure**: Report incomplete chains or wrong dependencies -## Related Commands -- `/workflow:plan` - Standard (non-TDD) planning -- `/workflow:execute` - Execute TDD tasks -- `/workflow:tdd-verify` - Verify TDD compliance -- `/workflow:status` - View progress ## TDD Workflow Enhancements ### Overview @@ -294,7 +289,7 @@ IMPL (Green phase) tasks now include automatic test-fix cycle for resilient impl ``` 1. Write minimal implementation code 2. Execute test suite -3. IF tests pass → Complete task ✅ +3. IF tests pass → Complete task 4. IF tests fail → Enter fix cycle: a. Gemini diagnoses with bug-fix template b. Apply fix (manual or Codex) @@ -304,10 +299,10 @@ IMPL (Green phase) tasks now include automatic test-fix cycle for resilient impl ``` **Benefits**: -- ✅ Faster feedback within Green phase -- ✅ Autonomous recovery from implementation errors -- ✅ Systematic debugging with Gemini -- ✅ Safe rollback prevents broken state +- Faster feedback within Green phase +- Autonomous recovery from implementation errors +- Systematic debugging with Gemini +- Safe rollback prevents broken state #### 3. Agent-Driven Planning **From plan --agent workflow** @@ -335,7 +330,7 @@ Supports action-planning-agent for more autonomous TDD planning with: ### Migration Notes -**Backward Compatibility**: ✅ Fully compatible +**Backward Compatibility**: Fully compatible - Existing TDD workflows continue to work - New features are additive, not breaking - Phase 3 can be skipped if test-context-gather not available @@ -367,3 +362,23 @@ Supports action-planning-agent for more autonomous TDD planning with: - `meta.max_iterations`: Fix attempts (default: 3) - `meta.use_codex`: Auto-fix mode (default: false) +## Related Commands + +**Prerequisite Commands**: +- None - TDD planning is self-contained (can optionally run brainstorm commands before) + +**Called by This Command** (6 phases): +- `/workflow:session:start` - Phase 1: Create or discover TDD workflow session +- `/workflow:tools:context-gather` - Phase 2: Gather project context and analyze codebase +- `/workflow:tools:test-context-gather` - Phase 3: Analyze existing test patterns and coverage +- `/workflow:tools:conflict-resolution` - Phase 4: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium) +- `/compact` - Phase 4: Memory optimization (if context approaching limits) +- `/workflow:tools:task-generate-tdd` - Phase 5: Generate TDD task chains with Red-Green-Refactor cycles +- `/workflow:tools:task-generate-tdd --agent` - Phase 5: Generate TDD tasks with agent-driven approach (when `--agent` flag used) + +**Follow-up Commands**: +- `/workflow:action-plan-verify` - Recommended: Verify TDD plan quality and structure before execution +- `/workflow:status` - Review TDD task breakdown +- `/workflow:execute` - Begin TDD implementation +- `/workflow:tdd-verify` - Post-execution: Verify TDD compliance and generate quality report + diff --git a/.claude/commands/workflow/tdd-verify.md b/.claude/commands/workflow/tdd-verify.md index 2ab06231..73906c56 100644 --- a/.claude/commands/workflow/tdd-verify.md +++ b/.claude/commands/workflow/tdd-verify.md @@ -118,14 +118,14 @@ RULES: Focus on TDD best practices and workflow adherence. Be specific about vio TDD Verification Report - Session: {sessionId} ## Chain Validation -✅ Feature 1: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1 (Complete) -✅ Feature 2: TEST-2.1 → IMPL-2.1 → REFACTOR-2.1 (Complete) -⚠️ Feature 3: TEST-3.1 → IMPL-3.1 (Missing REFACTOR phase) +[COMPLETE] Feature 1: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1 (Complete) +[COMPLETE] Feature 2: TEST-2.1 → IMPL-2.1 → REFACTOR-2.1 (Complete) +[INCOMPLETE] Feature 3: TEST-3.1 → IMPL-3.1 (Missing REFACTOR phase) ## Test Execution -✅ All TEST tasks produced failing tests -✅ All IMPL tasks made tests pass -✅ All REFACTOR tasks maintained green tests +All TEST tasks produced failing tests +All IMPL tasks made tests pass +All REFACTOR tasks maintained green tests ## Coverage Metrics Line Coverage: {percentage}% @@ -271,20 +271,20 @@ Status: {EXCELLENT | GOOD | NEEDS IMPROVEMENT | FAILED} ## Chain Analysis ### Feature 1: {Feature Name} -**Status**: ✅ Complete +**Status**: Complete **Chain**: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1 -- ✅ **Red Phase**: Test created and failed with clear message -- ✅ **Green Phase**: Minimal implementation made test pass -- ✅ **Refactor Phase**: Code improved, tests remained green +- **Red Phase**: Test created and failed with clear message +- **Green Phase**: Minimal implementation made test pass +- **Refactor Phase**: Code improved, tests remained green ### Feature 2: {Feature Name} -**Status**: ⚠️ Incomplete +**Status**: Incomplete **Chain**: TEST-2.1 → IMPL-2.1 (Missing REFACTOR-2.1) -- ✅ **Red Phase**: Test created and failed -- ⚠️ **Green Phase**: Implementation seems over-engineered -- ❌ **Refactor Phase**: Missing +- **Red Phase**: Test created and failed +- **Green Phase**: Implementation seems over-engineered +- **Refactor Phase**: Missing **Issues**: - REFACTOR-2.1 task not completed @@ -306,16 +306,16 @@ Status: {EXCELLENT | GOOD | NEEDS IMPROVEMENT | FAILED} ## TDD Cycle Validation ### Red Phase (Write Failing Test) -- ✅ {N}/{total} features had failing tests initially -- ⚠️ Feature 3: No evidence of initial test failure +- {N}/{total} features had failing tests initially +- Feature 3: No evidence of initial test failure ### Green Phase (Make Test Pass) -- ✅ {N}/{total} implementations made tests pass -- ✅ All implementations minimal and focused +- {N}/{total} implementations made tests pass +- All implementations minimal and focused ### Refactor Phase (Improve Quality) -- ⚠️ {N}/{total} features completed refactoring -- ❌ Feature 2, 4: Refactoring step skipped +- {N}/{total} features completed refactoring +- Feature 2, 4: Refactoring step skipped ## Best Practices Assessment @@ -351,8 +351,3 @@ Status: {EXCELLENT | GOOD | NEEDS IMPROVEMENT | FAILED} {Summary of compliance status and next steps} ``` -## Related Commands -- `/workflow:tdd-plan` - Creates TDD workflow -- `/workflow:execute` - Executes TDD tasks -- `/workflow:tools:tdd-coverage-analysis` - Analyzes test coverage -- `/workflow:status` - Views workflow progress diff --git a/.claude/commands/workflow/test-cycle-execute.md b/.claude/commands/workflow/test-cycle-execute.md index 29925025..5444a00f 100644 --- a/.claude/commands/workflow/test-cycle-execute.md +++ b/.claude/commands/workflow/test-cycle-execute.md @@ -10,7 +10,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Task(*) ## Overview Orchestrates dynamic test-fix workflow execution through iterative cycles of testing, analysis, and fixing. **Unlike standard execute, this command dynamically generates intermediate tasks** during execution based on test results and CLI analysis, enabling adaptive problem-solving. -**⚠️ CRITICAL - Orchestrator Boundary**: +**CRITICAL - Orchestrator Boundary**: - This command is the **ONLY place** where test failures are handled - All CLI analysis (Gemini/Qwen), fix task generation (IMPL-fix-N.json), and iteration management happen HERE - Agents (@test-fix-agent) only execute single tasks and return results @@ -59,22 +59,22 @@ Orchestrates dynamic test-fix workflow execution through iterative cycles of tes ## Responsibility Matrix -**⚠️ CRITICAL - Clear division of labor between orchestrator and agents:** +**CRITICAL - Clear division of labor between orchestrator and agents:** | Responsibility | test-cycle-execute (Orchestrator) | @test-fix-agent (Executor) | |----------------|----------------------------|---------------------------| -| Manage iteration loop | ✅ Controls loop flow | ❌ Executes single task | -| Run CLI analysis (Gemini/Qwen) | ✅ Runs between agent tasks | ❌ Not involved | -| Generate IMPL-fix-N.json | ✅ Creates task files | ❌ Not involved | -| Run tests | ❌ Delegates to agent | ✅ Executes test command | -| Apply fixes | ❌ Delegates to agent | ✅ Modifies code | -| Detect test failures | ✅ Analyzes results and decides next action | ✅ Executes tests and reports outcomes | -| Add tasks to queue | ✅ Manages queue | ❌ Not involved | -| Update iteration state | ✅ Maintains overall iteration state | ✅ Updates individual task status only | +| Manage iteration loop | Yes - Controls loop flow | No - Executes single task | +| Run CLI analysis (Gemini/Qwen) | Yes - Runs between agent tasks | No - Not involved | +| Generate IMPL-fix-N.json | Yes - Creates task files | No - Not involved | +| Run tests | No - Delegates to agent | Yes - Executes test command | +| Apply fixes | No - Delegates to agent | Yes - Modifies code | +| Detect test failures | Yes - Analyzes results and decides next action | Yes - Executes tests and reports outcomes | +| Add tasks to queue | Yes - Manages queue | No - Not involved | +| Update iteration state | Yes - Maintains overall iteration state | Yes - Updates individual task status only | **Key Principle**: Orchestrator manages the "what" and "when"; agents execute the "how". -**⚠️ ENFORCEMENT**: If test failures occur outside this orchestrator, do NOT handle them inline - always call `/workflow:test-cycle-execute` instead. +**ENFORCEMENT**: If test failures occur outside this orchestrator, do NOT handle them inline - always call `/workflow:test-cycle-execute` instead. ## Execution Lifecycle @@ -653,10 +653,3 @@ mv temp.json iteration-state.json 5. **Verify No Regressions**: Check all tests pass, not just previously failing ones 6. **Preserve Context**: All iteration artifacts saved for debugging -## Related Commands - -- `/workflow:test-fix-gen` - Planning phase (creates initial tasks) -- `/workflow:execute` - Standard workflow execution (no dynamic iteration) -- `/workflow:status` - Check progress and iteration state -- `/workflow:session:complete` - Mark session complete (auto-called on success) -- `/task:create` - Manually create additional tasks if needed diff --git a/.claude/commands/workflow/test-fix-gen.md b/.claude/commands/workflow/test-fix-gen.md index a8179de2..cea5d905 100644 --- a/.claude/commands/workflow/test-fix-gen.md +++ b/.claude/commands/workflow/test-fix-gen.md @@ -13,7 +13,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) This command creates an independent test-fix workflow session for existing code. It orchestrates a 5-phase process to analyze implementation, generate test requirements, and create executable test generation and fix tasks. -**⚠️ CRITICAL - Command Scope**: +**CRITICAL - Command Scope**: - **This command ONLY generates task JSON files** (IMPL-001.json, IMPL-002.json) - **Does NOT execute tests or apply fixes** - all execution happens in separate orchestrator - **Must call `/workflow:test-cycle-execute`** after this command to actually run tests and fixes @@ -274,7 +274,7 @@ Review artifacts: - Test plan: .workflow/[testSessionId]/IMPL_PLAN.md - Task list: .workflow/[testSessionId]/TODO_LIST.md -⚠️ CRITICAL - Next Steps: +CRITICAL - Next Steps: 1. Review IMPL_PLAN.md 2. **MUST execute: /workflow:test-cycle-execute** - This command only generated task JSON files @@ -284,7 +284,7 @@ Review artifacts: **TodoWrite**: Mark phase 5 completed -**⚠️ BOUNDARY NOTE**: +**BOUNDARY NOTE**: - Command completes here - only task JSON files generated - All test execution, failure detection, CLI analysis, fix generation happens in `/workflow:test-cycle-execute` - This command does NOT handle test failures or apply fixes @@ -462,25 +462,23 @@ WFS-test-[session]/ - Use `--use-codex` for autonomous fix application - Use `--cli-execute` for enhanced generation capabilities -### Related Commands +## Related Commands -**Planning Phase**: -- `/workflow:plan` - Create implementation workflow -- `/workflow:session:start` - Initialize workflow session +**Prerequisite Commands**: +- `/workflow:plan` or `/workflow:execute` - Complete implementation session (for Session Mode) +- None for Prompt Mode (ad-hoc test generation) -**Context Gathering**: -- `/workflow:tools:test-context-gather` - Session-based context (Phase 2 for session mode) -- `/workflow:tools:context-gather` - Prompt-based context (Phase 2 for prompt mode) +**Called by This Command** (5 phases): +- `/workflow:session:start` - Phase 1: Create independent test workflow session +- `/workflow:tools:test-context-gather` - Phase 2 (Session Mode): Gather source session context +- `/workflow:tools:context-gather` - Phase 2 (Prompt Mode): Analyze codebase directly +- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements using Gemini +- `/workflow:tools:test-task-generate` - Phase 4: Generate test task JSONs with fix cycle specification +- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes (when `--use-codex` flag used) +- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode (when `--cli-execute` flag used) -**Analysis & Task Generation**: -- `/workflow:tools:test-concept-enhanced` - Gemini test analysis (Phase 3) -- `/workflow:tools:test-task-generate` - Generate test tasks (Phase 4) +**Follow-up Commands**: +- `/workflow:status` - Review generated test tasks +- `/workflow:test-cycle-execute` - Execute test generation and iterative fix cycles +- `/workflow:execute` - Standard execution of generated test tasks -**Execution**: -- `/workflow:test-cycle-execute` - Execute test-fix workflow (recommended for IMPL-002) -- `/workflow:execute` - Execute standard workflow tasks -- `/workflow:status` - Check task progress - -**Review & Management**: -- `/workflow:review` - Review workflow results -- `/workflow:session:complete` - Mark session complete diff --git a/.claude/commands/workflow/test-gen.md b/.claude/commands/workflow/test-gen.md index 39675a24..0fcbf55c 100644 --- a/.claude/commands/workflow/test-gen.md +++ b/.claude/commands/workflow/test-gen.md @@ -24,7 +24,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) 3. Analyze implementation with concept-enhanced → Parse ANALYSIS_RESULTS.md 4. Generate test task from analysis → Return summary -**⚠️ Command Scope**: This command ONLY prepares test workflow artifacts. It does NOT execute tests or implementation. Task execution requires separate user action. +**Command Scope**: This command ONLY prepares test workflow artifacts. It does NOT execute tests or implementation. Task execution requires separate user action. ## Core Rules @@ -36,7 +36,7 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) 6. **Track Progress**: Update TodoWrite after every phase completion 7. **Automatic Detection**: context-gather auto-detects test session and gathers source session context 8. **Parse --use-codex Flag**: Extract flag from arguments and pass to Phase 4 (test-task-generate) -9. **⚠️ Command Boundary**: This command ends at Phase 5 summary. Test execution is NOT part of this command. +9. **Command Boundary**: This command ends at Phase 5 summary. Test execution is NOT part of this command. ## 5-Phase Execution @@ -177,13 +177,13 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) --- -### Phase 5: Return Summary (⚠️ Command Ends Here) +### Phase 5: Return Summary (Command Ends Here) -**⚠️ Important**: This is the final phase of `/workflow:test-gen`. The command completes and returns control to the user. No automatic execution occurs. +**Important**: This is the final phase of `/workflow:test-gen`. The command completes and returns control to the user. No automatic execution occurs. **Return to User**: ``` -✅ Test workflow preparation complete! +Test workflow preparation complete! Source Session: [sourceSessionId] Test Session: [testSessionId] @@ -198,17 +198,17 @@ Test Framework: [detected framework] Test Files to Generate: [count] Fix Mode: [Manual|Codex Automated] (based on --use-codex flag) -📋 Review Generated Artifacts: +Review Generated Artifacts: - Test plan: .workflow/[testSessionId]/IMPL_PLAN.md - Task list: .workflow/[testSessionId]/TODO_LIST.md - Analysis: .workflow/[testSessionId]/.process/TEST_ANALYSIS_RESULTS.md -⚠️ Ready for execution. Use appropriate workflow commands to proceed. +Ready for execution. Use appropriate workflow commands to proceed. ``` **TodoWrite**: Mark phase 5 completed -**⚠️ Command Boundary**: After this phase, the command terminates and returns to user prompt. +**Command Boundary**: After this phase, the command terminates and returns to user prompt. --- @@ -244,7 +244,7 @@ Update status to `in_progress` when starting each phase, mark `completed` when d │ ↓ │ │ Phase 5: Return summary │ └─────────────────────────────────────────────────────────┘ - ⚠️ COMMAND ENDS - Control returns to user + COMMAND ENDS - Control returns to user Artifacts Created: ├── .workflow/WFS-test-[session]/ @@ -330,8 +330,18 @@ See `/workflow:tools:test-task-generate` for complete JSON schemas. ## Related Commands -- `/workflow:tools:test-context-gather` - Phase 2 (coverage analysis) -- `/workflow:tools:test-concept-enhanced` - Phase 3 (Gemini test analysis) -- `/workflow:tools:test-task-generate` - Phase 4 (task generation) -- `/workflow:execute` - Execute workflow -- `/workflow:status` - Check progress +**Prerequisite Commands**: +- `/workflow:plan` or `/workflow:execute` - Complete implementation session that needs test validation + +**Called by This Command** (5 phases): +- `/workflow:session:start` - Phase 1: Create independent test workflow session +- `/workflow:tools:test-context-gather` - Phase 2: Analyze test coverage and gather source session context +- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements and strategy using Gemini +- `/workflow:tools:test-task-generate` - Phase 4: Generate test generation and execution task JSONs +- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes (when `--use-codex` flag used) +- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode (when `--cli-execute` flag used) + +**Follow-up Commands**: +- `/workflow:status` - Review generated test tasks +- `/workflow:test-cycle-execute` - Execute test generation and fix cycles +- `/workflow:execute` - Execute generated test tasks \ No newline at end of file diff --git a/COMMAND_FLOW_STANDARD.md b/COMMAND_FLOW_STANDARD.md new file mode 100644 index 00000000..648343b6 --- /dev/null +++ b/COMMAND_FLOW_STANDARD.md @@ -0,0 +1,274 @@ +# Command Flow Expression Standard + +**用途**:规范命令文档中Task、SlashCommand、Skill和Bash调用的标准表达方式 + +**版本**:v2.1.0 + +--- + +## 核心原则 + +1. **统一格式** - 所有调用使用标准化格式 +2. **清晰参数** - 必需参数明确标注,可选参数加方括号 +3. **减少冗余** - 避免不必要的echo命令和管道操作 +4. **工具优先** - 优先使用专用工具(Write/Read/Edit)而非Bash变通 +5. **可读性** - 保持缩进和换行的一致性 + +--- + +## 1. Task调用标准(Agent启动) + +### 标准格式 + +```javascript +Task( + subagent_type="agent-type", + description="Brief description", + prompt=` +FULL TASK PROMPT HERE + ` +) +``` + +### 规范要求 + +- `subagent_type`: Agent类型(字符串) +- `description`: 简短描述(5-10词,动词开头) +- `prompt`: 完整任务提示(使用反引号包裹多行内容) +- 参数字段缩进2空格 + +### 正确示例 + +```javascript +// CLI执行agent +Task( + subagent_type="cli-execution-agent", + description="Analyze codebase patterns", + prompt=` +PURPOSE: Identify code patterns for refactoring +TASK: Scan project files and extract common patterns +MODE: analysis +CONTEXT: @src/**/* +EXPECTED: Pattern list with usage examples + ` +) + +// 代码开发agent +Task( + subagent_type="code-developer", + description="Implement authentication module", + prompt=` +GOAL: Build JWT-based authentication +SCOPE: User login, token validation, session management +CONTEXT: @src/auth/**/* @CLAUDE.md + ` +) +``` + +--- + +## 2. SlashCommand调用标准 + +### 标准格式 + +```javascript +SlashCommand(command="/category:command-name [flags] arguments") +``` + +### 规范要求 + +单行调用 | 双引号包裹 | 完整路径`/category:command-name` | 参数顺序: 标志→参数值 + +### 正确示例 + +```javascript +// 无参数 +SlashCommand(command="/workflow:status") + +// 带标志和参数 +SlashCommand(command="/workflow:session:start --auto \"task description\"") + +// 变量替换 +SlashCommand(command="/workflow:tools:context-gather --session [sessionId] \"description\"") + +// 多个标志 +SlashCommand(command="/workflow:plan --agent --cli-execute \"feature description\"") +``` + +--- + +## 3. Skill调用标准 + +### 标准格式 + +```javascript +Skill(command: "skill-name") +``` + +### 规范要求 + +单行调用 | 冒号语法`command:` | 双引号包裹skill-name + +### 正确示例 + +```javascript +// 项目SKILL +Skill(command: "claude_dms3") + +// 技术栈SKILL +Skill(command: "react-dev") + +// 工作流SKILL +Skill(command: "workflow-progress") + +// 变量替换 +Skill(command: "${skill_name}") +``` + +--- + +## 4. Bash命令标准 + +### 核心原则:优先使用专用工具 + +**工具优先级**: +1. **Write工具** → 创建/覆盖文件内容 +2. **Edit工具** → 修改现有文件内容 +3. **Read工具** → 读取文件内容 +4. **Bash命令** → 仅用于真正的系统操作(git, npm, test等) + +### 标准格式 + +```javascript +bash(command args) +``` + +### 合理使用Bash的场景 + +```javascript +// ✅ Git操作 +bash(git status --short) +bash(git commit -m "commit message") + +// ✅ 包管理器和测试 +bash(npm install) +bash(npm test) + +// ✅ 文件系统查询和文本处理 +bash(find .workflow -name "*.json" -type f) +bash(rg "pattern" --type js --files-with-matches) +``` + +### 避免Bash的场景 + +```javascript +// ❌ 文件创建/写入 → 使用Write工具 +bash(echo "content" > file.txt) // 错误 +Write({file_path: "file.txt", content: "content"}) // 正确 + +// ❌ 文件读取 → 使用Read工具 +bash(cat file.txt) // 错误 +Read({file_path: "file.txt"}) // 正确 + +// ❌ 简单字符串处理 → 在代码中处理 +bash(echo "text" | tr '[:upper:]' '[:lower:]') // 错误 +"text".toLowerCase() // 正确 +``` + +--- + +## 5. 组合调用模式(伪代码准则) + +### 核心准则 + +直接写执行逻辑(无FUNCTION/END包裹)| 用`#`注释分段 | 变量赋值`variable = value` | 条件`IF/ELSE` | 循环`FOR` | 验证`VALIDATE` | 错误`ERROR + EXIT 1` + +### 顺序调用(依赖关系) + +```pseudo +# Phase 1-2: Session and Context +sessionId = SlashCommand(command="/workflow:session:start --auto \"description\"") +PARSE sessionId from output +VALIDATE: bash(test -d .workflow/{sessionId}) + +contextPath = SlashCommand(command="/workflow:tools:context-gather --session {sessionId} \"desc\"") +context_json = READ(contextPath) + +# Phase 3-4: Conditional and Agent +IF context_json.conflict_risk IN ["medium", "high"]: + SlashCommand(command="/workflow:tools:conflict-resolution --session {sessionId}") + +Task(subagent_type="action-planning-agent", description="Generate tasks", prompt=`SESSION: {sessionId}`) + +VALIDATE: bash(test -f .workflow/{sessionId}/IMPL_PLAN.md) +RETURN summary +``` + +### 并行调用(无依赖) + +```pseudo +PARALLEL_START: + check_git = bash(git status) + check_count = bash(find .workflow -name "*.json" | wc -l) + check_skill = Skill(command: "project-name") +WAIT_ALL_COMPLETE +VALIDATE results +RETURN summary +``` + +### 条件分支调用 + +```pseudo +IF task_type CONTAINS "test": agent = "test-fix-agent" +ELSE IF task_type CONTAINS "implement": agent = "code-developer" +ELSE: agent = "universal-executor" + +Skill(command: "project-name") +Task(subagent_type=agent, description="Execute task", prompt=build_prompt(task_type)) +VALIDATE output +RETURN result +``` + +--- + +## 6. 变量和占位符规范 + +| 上下文 | 格式 | 示例 | +|--------|------|------| +| **Markdown说明** | `[variableName]` | `[sessionId]`, `[contextPath]` | +| **JavaScript代码** | `${variableName}` | `${sessionId}`, `${contextPath}` | +| **Bash命令** | `$variable` | `$session_id`, `$context_path` | + +--- + +## 7. 快速检查清单 + +**Task**: subagent_type已指定 | description≤10词 | prompt用反引号 | 缩进2空格 + +**SlashCommand**: 完整路径 `/category:command` | 标志在前 | 变量用`[var]` | 双引号包裹 + +**Skill**: 冒号语法 `command:` | 双引号包裹 | 单行格式 + +**Bash**: 能用Write/Edit/Read工具吗?| 避免不必要echo | 真正的系统操作 + +--- + +## 8. 常见错误及修复 + +```javascript +// ❌ 错误1: Bash中不必要的echo +bash(echo '{"status":"active"}' > status.json) +// ✅ 正确: 使用Write工具 +Write({file_path: "status.json", content: '{"status":"active"}'}) + +// ❌ 错误2: Task单行格式 +Task(subagent_type="agent", description="Do task", prompt=`...`) +// ✅ 正确: 多行格式 +Task(subagent_type="agent", description="Do task", prompt=`...`) + +// ❌ 错误3: Skill使用等号 +Skill(command="skill-name") +// ✅ 正确: 使用冒号 +Skill(command: "skill-name") +``` + diff --git a/COMMAND_TEMPLATE_EXECUTOR.md b/COMMAND_TEMPLATE_EXECUTOR.md new file mode 100644 index 00000000..676bd655 --- /dev/null +++ b/COMMAND_TEMPLATE_EXECUTOR.md @@ -0,0 +1,135 @@ +# Command Template: Executor + +**用途**:直接执行特定功能的执行器命令模板 + +**特征**:专注于自身功能实现,移除 Related Commands 段落 + +--- + +## 模板结构 + +```markdown +--- +name: command-name +description: Brief description of what this command does +argument-hint: "[flags] arguments" +allowed-tools: Read(*), Edit(*), Write(*), Bash(*), TodoWrite(*) +--- + +# Command Name (/category:command-name) + +## Overview +Clear description of what this command does and its purpose. + +**Key Characteristics**: +- Executes specific functionality directly +- Does NOT orchestrate other commands +- Focuses on single responsibility +- Returns concrete results + +## Core Functionality +- Function 1: Description +- Function 2: Description +- Function 3: Description + +## Usage + +### Command Syntax +```bash +/category:command-name [FLAGS] + +# Flags +--flag1 Description +--flag2 Description + +# Arguments + Description + Description (optional) +``` + +### Usage Examples +```bash +# Basic usage +/category:command-name arg1 + +# With flags +/category:command-name --flag1 --flag2 arg1 +``` + +## Execution Process + +### Step 1: Step Name +Description of what happens in this step + +**Operations**: +- Operation 1 +- Operation 2 + +**Validation**: +- Check 1 +- Check 2 + +--- + +### Step 2: Step Name +[Repeat for each step] + +--- + +## Input/Output + +### Input Requirements +- Input 1: Description and format +- Input 2: Description and format + +### Output Format +``` +Output description and structure +``` + +## Error Handling + +### Common Errors +| Error | Cause | Resolution | +|-------|-------|------------| +| Error message 1 | Root cause | How to fix | +| Error message 2 | Root cause | How to fix | + +## Best Practices + +1. **Practice 1**: Description and rationale +2. **Practice 2**: Description and rationale +3. **Practice 3**: Description and rationale +``` + +--- + +## 使用规则 + +### 核心原则 +1. **移除 Related Commands** - 执行器不协调其他命令 +2. **专注单一职责** - 每个执行器只做一件事 +3. **清晰的步骤划分** - 明确执行流程 +4. **完整的错误处理** - 列出常见错误和解决方案 + +### 可选段落 +根据命令特性,以下段落可选: +- **Configuration**: 有配置参数时使用 +- **Output Files**: 生成文件时使用 +- **Exit Codes**: 有明确退出码时使用 +- **Environment Variables**: 依赖环境变量时使用 + +### 格式要求 +- 无 emoji/图标装饰 +- 纯文本状态指示器 +- 使用表格组织错误信息 +- 提供实用的示例代码 + +## 示例参考 + +参考已重构的执行器命令: +- `.claude/commands/task/create.md` +- `.claude/commands/task/breakdown.md` +- `.claude/commands/task/execute.md` +- `.claude/commands/cli/execute.md` +- `.claude/commands/version.md` diff --git a/COMMAND_TEMPLATE_ORCHESTRATOR.md b/COMMAND_TEMPLATE_ORCHESTRATOR.md new file mode 100644 index 00000000..cc8beabe --- /dev/null +++ b/COMMAND_TEMPLATE_ORCHESTRATOR.md @@ -0,0 +1,140 @@ +# Command Template: Orchestrator + +**用途**:协调多个子命令的编排器命令模板 + +**特征**:保留 Related Commands 段落,明确说明调用的命令链 + +--- + +## 模板结构 + +```markdown +--- +name: command-name +description: Brief description of what this command orchestrates +argument-hint: "[flags] arguments" +allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) +--- + +# Command Name (/category:command-name) + +## Overview +Clear description of what this command orchestrates and its role. + +**Key Characteristics**: +- Orchestrates X phases/commands +- Coordinates between multiple slash commands +- Does NOT execute directly - delegates to specialized commands +- Manages workflow state and progress tracking + +## Core Responsibilities +- Responsibility 1: Description +- Responsibility 2: Description +- Responsibility 3: Description + +## Execution Flow + +### Phase 1: Phase Name +**Command**: `SlashCommand(command="/command:name args")` + +**Input**: Description of inputs + +**Expected Behavior**: +- Behavior 1 +- Behavior 2 + +**Parse Output**: +- Extract: variable name (pattern description) + +**Validation**: +- Validation rule 1 +- Validation rule 2 + +**TodoWrite**: Mark phase 1 completed, phase 2 in_progress + +--- + +### Phase 2: Phase Name +[Repeat structure for each phase] + +--- + +## TodoWrite Pattern + +Track progress through all phases: + +```javascript +TodoWrite({todos: [ + {"content": "Execute phase 1", "status": "in_progress|completed", "activeForm": "Executing phase 1"}, + {"content": "Execute phase 2", "status": "pending|in_progress|completed", "activeForm": "Executing phase 2"}, + {"content": "Execute phase 3", "status": "pending|in_progress|completed", "activeForm": "Executing phase 3"} +]}) +``` + +## Data Flow + +``` +Phase 1: command-1 → output-1 + ↓ +Phase 2: command-2 (input: output-1) → output-2 + ↓ +Phase 3: command-3 (input: output-2) → final-result +``` + +## Error Handling + +| Phase | Error | Action | +|-------|-------|--------| +| 1 | Error description | Recovery action | +| 2 | Error description | Recovery action | + +## Usage Examples + +### Basic Usage +```bash +/category:command-name +/category:command-name --flag "argument" +``` + +## Related Commands + +**Prerequisite Commands**: +- `/command:prerequisite` - Description of when to use before this + +**Called by This Command**: +- `/command:phase1` - Description (Phase 1) +- `/command:phase2` - Description (Phase 2) +- `/command:phase3` - Description (Phase 3) + +**Follow-up Commands**: +- `/command:next` - Description of what to do after this +``` + +--- + +## 使用规则 + +### 核心原则 +1. **保留 Related Commands** - 明确说明命令调用链 +2. **清晰的阶段划分** - 每个Phase独立可追踪 +3. **数据流可视化** - 展示Phase间的数据传递 +4. **TodoWrite追踪** - 实时更新执行进度 + +### Related Commands 分类 +- **Prerequisite Commands**: 执行本命令前需要先运行的命令 +- **Called by This Command**: 本命令会调用的子命令(按阶段分组) +- **Follow-up Commands**: 执行本命令后的推荐下一步 + +### 格式要求 +- 无 emoji/图标装饰 +- 纯文本状态指示器 +- 使用表格组织错误信息 +- 清晰的数据流图 + +## 示例参考 + +参考已重构的编排器命令: +- `.claude/commands/workflow/plan.md` +- `.claude/commands/workflow/execute.md` +- `.claude/commands/workflow/session/complete.md` +- `.claude/commands/workflow/session/start.md`