Skip to main content

workflow-plan

Unified planning skill - 4-phase planning workflow, plan verification, and interactive replanning. Triggers on "workflow-plan", "workflow-plan-verify", "workflow:replan".

Source facts

Repository
catlog22/Claude-Code-Workflow
Last source activity
April 1, 2026 at 15:20
Detected SKILL.md language
English
Stars
2,125
Forks
166

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
7 files

Showing SKILL.md

SKILL.md
Source instructions ยท Read-only preview
name
workflow-plan
description
Unified planning skill - 4-phase planning workflow, plan verification, and interactive replanning. Triggers on "workflow-plan", "workflow-plan-verify", "workflow:replan".
allowed-tools
Skill, Agent, AskUserQuestion, TodoWrite, Read, Write, Edit, Bash, Glob, Grep
<purpose> Unified planning skill combining 4-phase planning workflow, plan quality verification, and interactive replanning. Produces IMPL_PLAN.md, task JSONs, verification reports, and manages plan lifecycle through session-level artifact updates. Routes by mode (plan | verify | replan) and acts as a pure orchestrator: executes phases, parses outputs, and passes context. </purpose> <process> ## 1. Architecture Overview ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Workflow Plan Orchestrator (SKILL.md) โ”‚ โ”‚ โ†’ Route by mode: plan | verify | replan โ”‚ โ”‚ โ†’ Pure coordinator: Execute phases, parse outputs, pass context โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ†“ โ†“ โ†“ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Plan Mode โ”‚ โ”‚ Verify โ”‚ โ”‚ Replan โ”‚ โ”‚ (default) โ”‚ โ”‚ Mode โ”‚ โ”‚ Mode โ”‚ โ”‚ Phase 1-4 โ”‚ โ”‚ Phase 5 โ”‚ โ”‚ Phase 6 โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”Œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ” โ†“ โ†“ โ†“ โ†“ โ”Œโ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ” โ”‚ 1 โ”‚โ”‚ 2 โ”‚โ”‚ 3 โ”‚โ”‚ 4 โ”‚ โ”‚Sesโ”‚โ”‚Ctxโ”‚โ”‚Conโ”‚โ”‚Genโ”‚ โ””โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”˜โ””โ”€โ”ฌโ”€โ”˜ โ†“ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Confirm โ”‚โ”€โ”€โ”€ Verify โ”€โ”€โ†’ Phase 5 โ”‚ (choice) โ”‚โ”€โ”€โ”€ Execute โ”€โ†’ Skill("workflow-execute") โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”€โ”€โ”€ Review โ”€โ”€โ†’ Display session status inline ``` ## 2. Key Design Principles 1. **Pure Orchestrator**: SKILL.md routes and coordinates only; execution detail lives in phase files 2. **Progressive Phase Loading**: Read phase docs ONLY when that phase is about to execute 3. **Multi-Mode Routing**: Single skill handles plan/verify/replan via mode detection 4. **Task Attachment Model**: Sub-command tasks are ATTACHED, executed sequentially, then COLLAPSED 5. **Auto-Continue**: After each phase completes, automatically execute next pending phase 6. **Accumulated State**: planning-notes.md carries context across phases for N+1 decisions ## 3. Interactive Preference Collection Before dispatching to phase execution, collect workflow preferences via AskUserQuestion: ```javascript // โ˜… ็ปŸไธ€ auto mode ๆฃ€ๆต‹๏ผš-y/--yes ไปŽ $ARGUMENTS ๆˆ– ccw ไผ ๆ’ญ const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) if (autoYes) { // ่‡ชๅŠจๆจกๅผ๏ผš่ทณ่ฟ‡ๆ‰€ๆœ‰่ฏข้—ฎ๏ผŒไฝฟ็”จ้ป˜่ฎคๅ€ผ workflowPreferences = { autoYes: true, interactive: false } } else { const prefResponse = AskUserQuestion({ questions: [ { question: "ๆ˜ฏๅฆ่ทณ่ฟ‡ๆ‰€ๆœ‰็กฎ่ฎคๆญฅ้ชค๏ผˆ่‡ชๅŠจๆจกๅผ๏ผ‰๏ผŸ", header: "Auto Mode", multiSelect: false, options: [ { label: "Interactive (Recommended)", description: "ไบคไบ’ๆจกๅผ๏ผŒๅŒ…ๅซ็กฎ่ฎคๆญฅ้ชค" }, { label: "Auto", description: "่ทณ่ฟ‡ๆ‰€ๆœ‰็กฎ่ฎค๏ผŒ่‡ชๅŠจๆ‰ง่กŒ" } ] } ] }) workflowPreferences = { autoYes: prefResponse.autoMode === 'Auto' } // For replan mode, also collect interactive preference if (mode === 'replan') { const replanPref = AskUserQuestion({ questions: [ { question: "ๆ˜ฏๅฆไฝฟ็”จไบคไบ’ๅผๆพ„ๆธ…ๆจกๅผ๏ผŸ", header: "Replan Mode", multiSelect: false, options: [ { label: "Standard (Recommended)", description: "ไฝฟ็”จๅฎ‰ๅ…จ้ป˜่ฎคๅ€ผ" }, { label: "Interactive", description: "้€š่ฟ‡ๆ้—ฎไบคไบ’ๅผๆพ„ๆธ…ไฟฎๆ”น่Œƒๅ›ด" } ] } ] }) workflowPreferences.interactive = replanPref.replanMode === 'Interactive' } } ``` **workflowPreferences** is passed to phase execution as context variable, referenced as `workflowPreferences.autoYes`, `workflowPreferences.interactive` within phases. ## 4. Mode Detection ```javascript const args = $ARGUMENTS const mode = detectMode(args) function detectMode(args) { // Skill trigger determines mode if (skillName === 'workflow-plan-verify') return 'verify' if (skillName === 'workflow:replan') return 'replan' return 'plan' // default: workflow-plan } ``` ## 5. Compact Recovery (Phase Persistence) Multi-phase planning (Phase 1-4/5/6) spans long conversations. Uses **ๅŒ้‡ไฟ้™ฉ**: TodoWrite ่ทŸ่ธช active phase ไฟๆŠคๅ…ถไธ่ขซๅŽ‹็ผฉ๏ผŒsentinel ไฝœไธบๅ…œๅบ•ใ€‚ > **โš ๏ธ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status. > The phase currently marked `in_progress` is the active execution phase โ€” preserve its FULL content. > Only compress phases marked `completed` or `pending`. ## 6. Execution Flow ### Plan Mode (default) ``` Input Parsing: โ””โ”€ Convert user input to structured format (GOAL/SCOPE/CONTEXT) Phase 1: Session Discovery โ””โ”€ Ref: Read("phases/01-session-discovery.md") โ””โ”€ Output: sessionId (WFS-xxx), planning-notes.md Phase 2: Context Gathering โ””โ”€ Ref: Read("phases/02-context-gathering.md") โ”œโ”€ Tasks attached: Analyze structure โ†’ Identify integration โ†’ Generate package โ””โ”€ Output: contextPath + conflictRisk Phase 3: Conflict Resolution (conditional: conflictRisk โ‰ฅ medium) โ””โ”€ Decision (conflictRisk check): โ”œโ”€ conflictRisk โ‰ฅ medium โ†’ Ref: Read("phases/03-conflict-resolution.md") โ”‚ โ”œโ”€ Tasks attached: Detect conflicts โ†’ Present to user โ†’ Apply strategies โ”‚ โ””โ”€ Output: Modified brainstorm artifacts โ””โ”€ conflictRisk < medium โ†’ Skip to Phase 4 Phase 4: Task Generation โ””โ”€ Ref: Read("phases/04-task-generation.md") โ””โ”€ Output: IMPL_PLAN.md, task JSONs, TODO_LIST.md Plan Confirmation (User Decision Gate): โ””โ”€ Decision (user choice): โ”œโ”€ "Verify Plan Quality" (Recommended) โ†’ Route to Phase 5 (plan-verify) โ”œโ”€ "Start Execution" โ†’ Skill(skill="workflow-execute") โ””โ”€ "Review Status Only" โ†’ Display session status inline ``` ### Verify Mode ``` Phase 5: Plan Verification โ””โ”€ Ref: Read("phases/05-plan-verify.md") โ””โ”€ Output: PLAN_VERIFICATION.md with quality gate recommendation ``` ### Replan Mode ``` Phase 6: Interactive Replan โ””โ”€ Ref: Read("phases/06-replan.md") โ””โ”€ Output: Updated IMPL_PLAN.md, task JSONs, TODO_LIST.md ``` **Phase Reference Documents** (read on-demand when phase executes): | Phase | Document | Purpose | Mode | Compact | |-------|----------|---------|------|---------| | 1 | phases/01-session-discovery.md | Create or discover workflow session | plan | TodoWrite ้ฉฑๅŠจ | | 2 | phases/02-context-gathering.md | Gather project context and analyze codebase | plan | TodoWrite ้ฉฑๅŠจ | | 3 | phases/03-conflict-resolution.md | Detect and resolve conflicts (conditional) | plan | TodoWrite ้ฉฑๅŠจ | | 4 | phases/04-task-generation.md | Generate implementation plan and task JSONs | plan | TodoWrite ้ฉฑๅŠจ + ๐Ÿ”„ sentinel | | 5 | phases/05-plan-verify.md | Read-only verification with quality gate | verify | TodoWrite ้ฉฑๅŠจ | | 6 | phases/06-replan.md | Interactive replanning with boundary clarification | replan | TodoWrite ้ฉฑๅŠจ | **Compact Rules**: 1. **TodoWrite `in_progress`** โ†’ ไฟ็•™ๅฎŒๆ•ดๅ†…ๅฎน๏ผŒ็ฆๆญขๅŽ‹็ผฉ 2. **TodoWrite `completed`** โ†’ ๅฏๅŽ‹็ผฉไธบๆ‘˜่ฆ 3. **๐Ÿ”„ sentinel fallback** โ†’ Phase 4 ๅŒ…ๅซ compact sentinel๏ผ›่‹ฅ compact ๅŽไป…ๅญ˜ sentinel ่€Œๆ— ๅฎŒๆ•ด Step ๅ่ฎฎ๏ผŒๅฟ…้กป็ซ‹ๅณ `Read("phases/04-task-generation.md")` ๆขๅค ## 7. Core Rules 1. **Start Immediately**: First action is mode detection + TodoWrite initialization, second action is phase execution 2. **No Preliminary Analysis**: Do not read files, analyze structure, or gather context before Phase 1 3. **Parse Every Output**: Extract required data from each phase output for next phase 4. **Auto-Continue via TodoList**: Check TodoList status to execute next pending phase automatically 5. **Track Progress**: Update TodoWrite dynamically with task attachment/collapse pattern 6. **Task Attachment Model**: Skill execute **attaches** sub-tasks to current workflow. Orchestrator **executes** these attached tasks itself, then **collapses** them after completion 7. **Progressive Phase Loading**: Read phase docs ONLY when that phase is about to execute 8. **DO NOT STOP**: Continuous multi-phase workflow. After executing all attached tasks, immediately collapse them and execute next phase ## 8. Input Processing **Convert User Input to Structured Format**: 1. **Simple Text** โ†’ Structure it: ``` User: "Build authentication system" Structured: GOAL: Build authentication system SCOPE: Core authentication features CONTEXT: New implementation ``` 2. **Detailed Text** โ†’ Extract components: ``` User: "Add JWT authentication with email/password login and token refresh" Structured: GOAL: Implement JWT-based authentication SCOPE: Email/password login, token generation, token refresh endpoints CONTEXT: JWT token-based security, refresh token rotation ``` 3. **File Reference** (e.g., `requirements.md`) โ†’ Read and structure: - Read file content - Extract goal, scope, requirements - Format into structured description ## 9. Data Flow ### Plan Mode ``` User Input (task description) โ†“ [Convert to Structured Format] โ†“ Structured Description: โ†“ GOAL: [objective] โ†“ SCOPE: [boundaries] โ†“ CONTEXT: [background] โ†“ Phase 1: session:start --auto "structured-description" โ†“ Output: sessionId โ†“ Write: planning-notes.md (User Intent section) โ†“ Phase 2: context-gather --session sessionId "structured-description" โ†“ Input: sessionId + structured description โ†“ Output: contextPath (context-package.json) + conflictRisk โ†“ Update: planning-notes.md (Context Findings + Consolidated Constraints) โ†“ Phase 3: conflict-resolution [conditional: conflictRisk โ‰ฅ medium] โ†“ Input: sessionId + contextPath + conflictRisk โ†“ Output: Modified brainstorm artifacts โ†“ Update: planning-notes.md (Conflict Decisions + Consolidated Constraints) โ†“ Skip if conflictRisk is none/low โ†’ proceed directly to Phase 4 โ†“ Phase 4: task-generate-agent --session sessionId โ†“ Input: sessionId + planning-notes.md + context-package.json + brainstorm artifacts โ†“ Output: IMPL_PLAN.md, task JSONs, TODO_LIST.md โ†“ Plan Confirmation (User Decision Gate): โ”œโ”€ "Verify Plan Quality" (Recommended) โ†’ Route to Phase 5 โ”œโ”€ "Start Execution" โ†’ Skill(skill="workflow-execute") โ””โ”€ "Review Status Only" โ†’ Display session status inline ``` **Session Memory Flow**: Each phase receives session ID, which provides access to: - Previous task summaries - Existing context and analysis - Brainstorming artifacts (potentially modified by Phase 3) - Session-specific configuration ### Verify Mode ``` Input: --session sessionId (or auto-detect) โ†“ Phase 5: Load artifacts โ†’ Agent-driven verification โ†’ Generate report โ†“ Output: PLAN_VERIFICATION.md with quality gate ``` ### Replan Mode ``` Input: [--session sessionId] [task-id] "requirements" โ†“ Phase 6: Mode detection โ†’ Clarification โ†’ Impact analysis โ†’ Backup โ†’ Apply โ†’ Verify โ†“ Output: Updated artifacts + change summary ``` ## 10. TodoWrite Pattern **Core Concept**: Dynamic task attachment and collapse for real-time visibility into workflow execution. ### Key Principles 1. **Task Attachment** (when phase executed): - Sub-tasks are **attached** to orchestrator's TodoWrite - **Phase 2, 3**: Multiple sub-tasks attached - **Phase 1, 4**: Single task (atomic) - First attached task marked as `in_progress`, others as `pending` - Orchestrator **executes** these attached tasks sequentially 2. **Task Collapse** (after sub-tasks complete): - **Applies to Phase 2, 3**: Remove detailed sub-tasks from TodoWrite - **Collapse** to high-level phase summary - **Phase 1, 4**: No collapse needed (single task, just mark completed) - Maintains clean orchestrator-level view 3. **Continuous Execution**: After completion, automatically proceed to next pending phase **Lifecycle**: Initial pending โ†’ Phase executed (tasks ATTACHED) โ†’ Sub-tasks executed โ†’ Phase completed (tasks COLLAPSED for 2/3, marked completed for 1/4) โ†’ Next phase โ†’ Repeat ### Phase 2 (Tasks Attached): ```json [ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "in_progress"}, {"content": " โ†’ Analyze codebase structure", "status": "in_progress"}, {"content": " โ†’ Identify integration points", "status": "pending"}, {"content": " โ†’ Generate context package", "status": "pending"}, {"content": "Phase 4: Task Generation", "status": "pending"} ] ``` ### Phase 2 (Collapsed): ```json [ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "completed"}, {"content": "Phase 4: Task Generation", "status": "pending"} ] ``` ### Phase 3 (Tasks Attached, conditional): ```json [ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "completed"}, {"content": "Phase 3: Conflict Resolution", "status": "in_progress"}, {"content": " โ†’ Detect conflicts with CLI analysis", "status": "in_progress"}, {"content": " โ†’ Present conflicts to user", "status": "pending"}, {"content": " โ†’ Apply resolution strategies", "status": "pending"}, {"content": "Phase 4: Task Generation", "status": "pending"} ] ``` **Note**: See individual Phase descriptions for detailed TodoWrite Update examples. ## 11. Post-Phase Updates After each phase completes, update planning-notes.md: - **After Phase 1**: Initialize with user intent (GOAL, KEY_CONSTRAINTS) - **After Phase 2**: Add context findings (CRITICAL_FILES, ARCHITECTURE, CONFLICT_RISK, CONSTRAINTS) - **After Phase 3**: Add conflict decisions (RESOLVED, MODIFIED_ARTIFACTS, CONSTRAINTS) if executed - **Memory State Check**: After heavy phases (Phase 2-3), evaluate context window usage; if high (>120K tokens), trigger `compact` See phase files for detailed update code. ## 12. Error Handling - **Parsing Failure**: If output parsing fails, retry command once, then report error - **Validation Failure**: If validation fails, report which file/data is missing - **Command Failure**: Keep phase `in_progress`, report error to user, do not proceed to next phase - **Session Not Found** (verify/replan): Report error with available sessions list - **Task Not Found** (replan): Report error with available tasks list ## 13. Coordinator Checklist ### Plan Mode - **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 - **Session Integrity**: If reusing existing session, verify `sessionIntegrity` from Step 1.2.5; log warnings for incomplete brainstorm artifacts - Pass session ID and structured description to Phase 2 command - Parse context path from Phase 2 output, store in memory - **Extract conflictRisk from context-package.json**: Determine Phase 3 execution - **If conflictRisk โ‰ฅ medium**: Launch Phase 3 conflict-resolution with sessionId and contextPath - Wait for Phase 3 to finish executing (if executed), verify conflict-resolution.json created - **If conflictRisk is none/low**: Skip Phase 3, proceed directly to Phase 4 - Pass session ID to Phase 4 command - Verify all Phase 4 outputs - **Plan Confirmation Gate**: Present user with choice (Verify โ†’ Phase 5 / Execute / Review Status) - **If user selects Verify**: Read phases/05-plan-verify.md, execute Phase 5 in-process - **If user selects Execute**: Skill(skill="workflow-execute") - **If user selects Review**: Display session status inline
View on GitHub
This SKILL.md is very large, so SkillsMP previews the first section here. View on GitHub