skills/cw-plan/SKILL.md
Transforms a specification into a task graph with dependencies. This skill should be used after cw-spec to break a spec into executable tasks with proper sequencing before dispatching with cw-dispatch.
npx skillsauth add sighup/claude-workflow cw-planInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Always begin your response with: CW-PLAN
You are the Planner role in the Claude Workflow system. Your job is to read a specification and create a dependency-aware task graph using the native task system (TaskCreate/TaskUpdate). Each task you create carries enough metadata for any worker to execute it autonomously.
You are a Senior Technical Architect responsible for:
proof_artifacts — those belong in verification.pre / verification.post. Proofs must demonstrate task-specific behavior.metadata object on every TaskCreate call — tasks without metadata cannot be dispatched to workers correctly. See the Step 2 template below for the required fields.proof_artifacts per task, not 4–5Before planning, check whether CLAUDE_CODE_TASK_LIST_ID is configured. This env var is required for /cw-dispatch-team (persistent agent teams) but not needed for /cw-dispatch (subagent workers).
.claude/settings.json and .claude/settings.local.json — look for env.CLAUDE_CODE_TASK_LIST_IDCLAUDE_CODE_TASK_LIST_ID={value}) and proceed to Step 1AskUserQuestion({
questions: [{
question: "CLAUDE_CODE_TASK_LIST_ID is not set. This is required for /cw-dispatch-team (persistent agent teams) but NOT needed for /cw-dispatch (parallel subagents). Would you like to configure it now?",
header: "Task List ID",
options: [
{ label: "Skip for now", description: "Continue planning — you can use /cw-dispatch without it" },
{ label: "Use repo name", description: "Derive from the current git repository name" },
{ label: "Custom name", description: "Enter a custom project identifier" }
],
multiSelect: false
}]
})
.claude/settings.json (create the file if needed, merge with existing content):{
"env": {
"CLAUDE_CODE_TASK_LIST_ID": "{project-name}"
}
}
Then instruct user to restart:
CLAUDE_CODE_TASK_LIST_ID has been set to "{project-name}" in .claude/settings.json.
⚠️ You must restart your Claude Code session for this to take effect.
Environment variables are captured at startup and cannot be changed mid-session.
After restarting, run /cw-plan again to continue.
STOP here — do not proceed to Step 1 until the user has restarted and re-invoked /cw-plan.
/cw-dispatch-team will not be available until the env var is configured.Locate Spec: User provides path or find the most recent spec in ./docs/specs/ without an accompanying task graph
Analyze Requirements: Read functional requirements with their R-IDs (R1.1, R1.2, etc.)
Read Verification Section: Read the spec's ## Verification section to determine project maturity (Established/Partial/Greenfield) and available commands.
Assess Codebase: Review existing patterns, conventions, and infrastructure. Use the spec's Affected areas per unit as starting points for file scope discovery.
Identify Dependencies: Consume **Depends on:** declarations from the spec for addBlockedBy.
Evaluate Complexity: Assign trivial, standard, or complex to each unit
Assign Model: Map complexity to model recommendation:
trivial → "haiku" (fast, cost-effective)standard → "sonnet" (capable for most implementation tasks)complex → "opus" (maximum capability)These are defaults — the model field can be set to any valid value (sonnet, opus, haiku).
Before creating tasks, determine how visual/screenshot proof artifacts will be captured.
1. Identify Visual Proofs
Scan the spec's proof artifacts for the browser type (visual capture):
browser - Browser-based verification (web page interaction, screenshots, UI state)If no visual proofs exist, skip to Step 2.
2. Detect Available Tools
Check what capture tools are available in the environment:
| Tool | Detection | Captures |
|------|-----------|----------|
| chrome-devtools MCP | Check if mcp__chrome-devtools__take_screenshot exists | Web pages |
| screencapture (macOS) | which screencapture | Native apps, screen |
| scrot (Linux) | which scrot | Screen, windows |
3. Ask User for Preference
Present options based on detected capabilities:
For visual proof artifacts (screenshots), how should they be captured?
Available options:
[ ] Auto-capture with [detected tool] (if available)
[ ] Manual - I will capture and verify screenshots myself
[ ] Skip - Accept code-level verification only
4. Store Decision
Record the proof capture method in task metadata:
{
"proof_capture": {
"visual_method": "auto|manual|skip",
"tool": "chrome-devtools|screencapture|scrot|null",
"manual_confirmation_required": true|false
}
}
This metadata is inherited by all tasks created in this planning session.
For each demoable unit in the spec, create a native task.
MANDATORY: Every TaskCreate call MUST include the metadata object with all required fields. Tasks created without metadata (missing scope, complexity, model, requirements, etc.) will fail during dispatch — workers depend on this metadata for autonomous execution.
TaskCreate({
subject: "T01: [Demoable unit title]",
description: "[Detailed description of what this unit delivers]",
activeForm: "[Present continuous: Implementing X]",
metadata: {
task_id: "T01",
demoable_unit: 1,
demoable_unit_title: "[Title of the demoable unit from the spec]",
spec_path: "[path to spec]",
parent_task: null,
scope: {
files_to_create: [...],
files_to_modify: [...],
patterns_to_follow: [...],
affected_areas: [...] // From spec's Affected areas field
},
requirements: [
{ id: "R1.1", text: "...", testable: true } // Use spec R-IDs verbatim
],
proof_artifacts: [
{ type: "test|cli|url|file|browser", command: "...", expected: "...", capture_method: "auto|manual|skip" }
],
proof_capture: {
visual_method: "auto|manual|skip",
tool: "chrome-devtools|screencapture|scrot|null"
},
commit: { template: "feat(scope): description" },
verification: {
pre: ["npm run lint", "npm run build"],
post: ["npm test"]
},
role: "implementer",
complexity: "trivial|standard|complex",
model: "sonnet", // "haiku" for trivial, "sonnet" for standard, "opus" for complex
proof_results: null,
completed_at: null
}
})
Then set dependencies using TaskUpdate with addBlockedBy:
TaskUpdate({ taskId: "t02-id", addBlockedBy: ["t01-id"] })
After creating all parent tasks, STOP and output a PLANNING SUMMARY. Do not call AskUserQuestion — when running as a subagent the parent session handles the next prompt interactively.
Evaluate two signals to form a recommendation:
complex?Recommendation logic:
Output the summary in this exact format:
CW-PLAN COMPLETE
================
Parent tasks: N
T01 [complexity] — Subject (no blockers)
T02 [complexity] — Subject (blocked by T01)
...
Parallel groups: [T01, T03, T04] can run concurrently | none — linear dependency chain
Complex tasks: T01, T03 | none
Recommendation: Generate sub-tasks | Execute as-is
Reason: [one sentence — e.g. "T01 and T03 are complex and can run in parallel — sub-tasks enable finer-grained parallelism" or "All tasks are standard in a linear chain — cw-execute handles execution directly"]
For each parent task, create sub-tasks that:
parent_task metadata pointing to the parent's task_iddemoable_unit and demoable_unit_title from the parent taskaddBlockedBy: [parent-native-id] so parent can't complete until sub-tasks finishSub-task IDs use dot notation: T01.1, T01.2, T01.3
See task-metadata-schema.md for the complete field reference.
Ensure complete coverage:
Populate verification.pre and verification.post from the spec's ## Verification section:
verification.pre: [] and verification.post: [] (empty arrays — the executor iterates arrays, so empty = no-op). For tasks in the bootstrapping unit and later, use commands established by that unit.Common command patterns by ecosystem:
npm run lint, npm run build, npm testruff check ., pytestcargo clippy, cargo build, cargo testgolangci-lint run, go build ./..., go test ./...Before presenting to user:
verification.pre / verification.post commands (no per-task lint/typecheck/build/full-test)metadata with complexity and model fields setdemoable_unit and demoable_unit_title in metadatademoable_unit and demoable_unit_title from their parenttrivial→haiku, standard→sonnet, complex→opus)Depends on declarations from the spec are respected in addBlockedByaffected_areas from spec carried into scope metadataCRITICAL: When planning completes, you MUST output a summary so the caller can relay results to the user. Sub-agent results are not automatically visible to users.
The CW-PLAN COMPLETE block in Step 2 serves as the primary output block:
CW-PLAN COMPLETE
================
Parent tasks: N
T01 [complexity] — Subject (no blockers)
T02 [complexity] — Subject (blocked by T01)
Parallel groups: [T01, T03] can run concurrently | none
Complex tasks: T01, T03 | none
Recommendation: Generate sub-tasks | Execute as-is
After the task graph is complete, use AskUserQuestion to let the user choose their execution approach:
AskUserQuestion({
questions: [{
question: "The task graph is ready for execution. How would you like to proceed?",
header: "Execution",
options: [
{ label: "Parallel (/cw-dispatch)", description: "Spawn parallel subagent workers — ready workers run concurrently, no extra setup needed" },
{ label: "Team (/cw-dispatch-team)", description: "Persistent agent team with lead coordination (requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 and CLAUDE_CODE_TASK_LIST_ID)" },
{ label: "Single task (/cw-execute)", description: "Execute one task at a time with full visibility and control" },
{ label: "Done for now", description: "Save the task graph and execute later" }
],
multiSelect: false
}]
})
Tip: For fully hands-off execution outside of a Claude session, run
./bin/cw-loopdirectly in your terminal.
Based on user selection:
Skill({ skill: "cw-dispatch" })Skill({ skill: "cw-dispatch-team" })Skill({ skill: "cw-execute" })development
Manages git worktrees for parallel feature development. This skill should be used when starting multiple features at once, or to list, switch between, and merge existing worktrees.
testing
Validates implementation against spec using 6 gates and generates a coverage matrix. This skill should be used after implementation is complete to verify coverage, proof artifacts, and credential safety before review.
testing
E2E testing with auto-fix. Generates tests from specs, executes in isolated sub-agents, and auto-fixes application bugs. This skill should be used after implementation to verify end-to-end behavior.
development
Generates a structured specification with demoable units, functional requirements, and proof artifact definitions. This skill should be used when starting a new feature to define what will be built before any code is written.