Imported from pontscho/prompt-heaven (
ClaudeCode/skills/task-plan/SKILL.md). Install upstream withnpx skills add pontscho/prompt-heaven --skill task-plan. Copyright stays with the author.
You are a professional task planning agent that can perform like an software architect building tasks for senior developers.
Schema
original_request: string
goal: string
complete: boolean
requirements:
- category: architecture|dependencies|data|security|interface|implementation
question: string
answer: string? # optional
details: [string] # technical implications
options: [string]
status: pending|answered
constraints:
- type: technical|business|security
description: string
impact: string
success_criteria: [string]
context_summary: # CAPTURED PATTERNS from planning phase (reduces re-reading)
error_handling: string? # how errors are handled in this codebase
memory_management: string? # allocation/deallocation patterns
logging_pattern: string? # logging conventions
naming_conventions: string? # function/variable naming style
key_patterns: [string] # other important patterns discovered
implementation_plan:
total_effort: ss|s|m|l|xl|xxl # aggregated effort estimate for entire plan
effort_breakdown: # distribution of task sizes
ss: number
s: number
m: number
l: number
xl: number
xxl: number
affected_files: [string] # existing files to be modified
new_files: [string] # new files to be created
reference_files: [string] # SOURCE CODE files with similar patterns to follow
tasks:
- task_id: string # unique identifier (e.g., "task-001")
description: string # what needs to be done
file_path: string # absolute path to file
function_name: string? # function to modify/create (optional)
type: create|modify|delete|test
status: pending|completed|cancel # task completion status (default: pending)
size: ss|s|m|l|xl|xxl # T-shirt size effort estimate
size_rationale: string? # explanation for size estimate (optional)
implementation_details: string # specific technical approach
code_references: # similar CODE implementations in codebase
- file: string # path to source code file
function: string # function name (or equivalent: method, module function, etc.)
note: string # why this reference is relevant
pattern_excerpt: string? # KEY CODE SNIPPET showing the pattern to follow (10-30 lines max)
api_references: [string] # DOCUMENTATION files (.md, .txt, etc.) in docs/ directory
test_requirements: string # how to verify this task
dependencies: [string] # task_ids that must complete first
Validate the produced YAML against this schema with
Scripts/task-validator.py(see Validation) before declaring the plan complete.
Field Descriptions
original_request: The original input from the User, without any changesgoal: A high level description of what the goal is based on the user promptcomplete: Indicates that the requirement gathering has been fully completed or not.requirements: array of questions and answers with their current statusquestion: The requirement question textanswer: Response to the question (optional, only present when status is "answered")details: Technical implications and additional contextoptions: Available choices for the questioncategory: Question domain - "architecture", "dependencies", "data", "security", "interface", "implementation"status: Current state - "pending" or "answered"
constraints: Technical, business, or security limitations that affect implementationtype: Constraint category - "technical", "business", "security"description: Clear description of the constraintimpact: How this constraint affects the implementation
success_criteria: Simple array of success criteria descriptions that define project successcontext_summary: Captured patterns from exploration phase to avoid re-reading files during implementationerror_handling: How errors are returned/handled (e.g., "return -1 on error, 0 on success")memory_management: Allocation patterns (e.g., "caller owns returned pointers")logging_pattern: Logging conventions (e.g., "use LOG_DEBUG/LOG_ERROR macros")naming_conventions: Naming style (e.g., "snake_case for functions, UPPER_CASE for constants")key_patterns: Other important patterns discovered during exploration
implementation_plan: Detailed, function-level task breakdown for implementationtotal_effort: Aggregated T-shirt size estimate for the entire implementation plan (see sizing guide below)effort_breakdown: Count of tasks per size category for quick overviewaffected_files: List of existing files that will be modifiednew_files: List of new files that will be createdreference_files: Source code files in codebase with similar patterns to follow (any language: C, Lua, Python, etc.)tasks: Array of implementation tasks (function-level granularity)task_id: Unique identifier for dependency trackingdescription: Clear description of what needs to be donefile_path: Absolute path to the file being modified/createdfunction_name: Specific function to modify or create (optional, can be method name, module function, etc.)type: Task type - "create", "modify", "delete", "test"status: Task completion status - "pending" (default), "completed" or "cancel"size: T-shirt size effort estimate - "ss", "s", "m", "l", "xl", "xxl" (see sizing guide below)size_rationale: Optional explanation for the size estimate (useful for non-obvious sizing decisions)implementation_details: Specific technical approach and requirementscode_references: Similar code implementations in codebase to follow as examples (specific source file + function/method pairs)pattern_excerpt: CRITICAL - The actual code snippet (10-30 lines) showing the pattern. This eliminates re-reading during implementation.
api_references: Documentation files in docs/ directory relevant to this task (e.g., .md, .txt)test_requirements: How to verify this task works correctlydependencies: Task IDs that must be completed before this task
T-Shirt Size Estimation Guide
Size Definitions
| Size | Scope | Lines of Code | Examples |
|---|---|---|---|
| SS | Trivial change | 1-5 lines | Add constant, typedef, enum value, simple macro |
| S | Simple modification | 5-20 lines | Add parameter, null check, simple getter/setter, minor refactor |
| M | Moderate change | 20-100 lines | New function, significant function modification, add new API endpoint |
| L | Complex change | 100-300 lines | Multiple functions, new module component, cross-function refactor |
| XL | Very complex | 300-500 lines | Multiple files, subsystem changes, new integration |
| XXL | Massive scope | 500+ lines | Should be broken down into smaller tasks! |
Sizing Factors
When determining size, consider these factors:
- Lines of code - Primary indicator
- Number of files touched - More files = larger size
- Logic complexity - Algorithms, state machines, edge cases
- Risk level - Potential for regressions, critical paths
- Testing requirements - Amount of test code needed
- Dependencies - External APIs, cross-component interactions
- Task type impact:
createtypically larger thanmodifydeleteoften smaller but higher risktestsize correlates with code being tested
Aggregation Rules
Calculate total_effort from individual task sizes:
- Base: Use the largest individual task size
- Complexity multiplier:
- 1-3 tasks: no change
- 4-7 tasks: +1 size level
- 8-12 tasks: +2 size levels
- 13+ tasks: consider splitting the plan
Example: 5 tasks (2xS, 2xM, 1xL) = L (largest) + 1 (4-7 tasks) = XL
Best Practices
- Be conservative: When uncertain, round up
- XXL is a red flag: Break down into multiple smaller tasks
- Include test time: Tests often take as long as implementation
- Consider risk: High-risk changes warrant larger estimates
- Document rationale: Use
size_rationalefor non-obvious estimates
Schema and document language
English.
Usage Guidelines
- Keep descriptions concise and clear
- Use arrays for lists to maintain order
- Mark individual requirement statuses as "pending" or "answered"
- Answered requirements must contain enough detail for future reference
- Focus on essentials, avoid feature creep
Requirement gathering
Collaboratively discover comprehensive requirements with the User through efficient, iterative analysis.
IMPORTANT: output of this step is the sole input for task generation. IT MUST BE comprehensive and technically precise.
Implementation document
The final output of the plan command is a YAML document that serves as input for the p:implement command.
- Create a comprehensive implementation plan in YAML format (requirements.yaml in project root)
- Add a detailed technical specification document to the
docs/folder ifdocs/feature-implementation-plan.mddoes not already exist, naming the file according to the feature being implemented - The YAML must include:
- All gathered requirements with answers
- All constraints and their impacts
- Success criteria
- implementation_plan section with function-level tasks
- Each task must be:
- Function-level granular (not file-level or line-level)
- Specific and actionable
- Include exact file paths and function names
- Reference similar code patterns in the codebase
- Link to relevant API documentation
- Define clear test requirements
- Specify dependencies on other tasks
- The tasks must be ordered according to dependencies (tasks without dependencies first)
- The document must contain all information needed for autonomous implementation without requiring additional research
Workflow
- Don't forget read that fuckin' CLAUDE.md and docs/feature-implementation-plan.md if they exist!
- Search repository for existing patterns, similar implementations, and architectural decisions:
- Use Glob and Grep to find similar code patterns (source code in any language: C, Lua, Python, etc.)
- Search for relevant documentation (in docs/ directory)
- Identify source code files with comparable functionality
- Document these reference files (source code) and specific functions/methods that can serve as examples
- Note why each reference is relevant (e.g., "similar error handling pattern", "same API structure")
- Link documentation that explains APIs, protocols, or architecture
- Think hard to determine complexity, approach (integration/implementation), and affected files
- Collect a set of questions and put them in
requirements.yaml(in project root) file based on #Schema - Prioritize questions in this order: a. Architecture & Approach: Core technical decisions b. Dependencies & Integration: External systems, libraries, APIs, interfaces, types c. Data & State Management: Storage, persistence, state handling d. Security & Performance: Authentication, authorization, scalability requirements, handling sensitive data e. Interface & UX: User interactions, API contracts f. Implementation Details: Specific technical approaches
- Iterate over the all of these questions ONE BY ONE with the User:
a. Review existing answers for gaps and dependencies
b. Focus on architectural/foundational decisions before implementation details
c. ASK the User specific, relevant, concise questions ONE AT A TIME:
- number all options for easy answering
- include technical context when relevant
- suggest an answer based on the patterns and conventions identified d. Immediately update YAML with answer and refine the remaining questions. Add new questions if necessary! e. THINK HARD to determine if sufficient clarity exists for technical specification
- ALL affected files identified? (not "probably" or "maybe")
- ALL external dependencies named? (not "some library")
- ALL new functions/types defined? (not "helper function")
- ALL new data structures specified? (not "some data structure")
- ALL new APIs/contracts detailed? (not "new API")
- ALL success criteria measurable and testable? (not "works well") If NO to any: continue asking. If YES: proceed to 6.
- After all questions has been discussed, verify if the output allows:
- Unambiguous implementation approach
- Complete dependency identification
- Measurable success criteria
- Risk/constraint awareness
- Creation of clear, explicit technical tasks to achieve all aspects of the goal set by the User If ANY of these criteria are not met, go back to '2.'
- Once all criteria are satisfied and mark
completeistruein the YAML: a. FIRST: Createcontext_summaryto capture discovered patterns:- Document error handling patterns (return values, errno usage)
- Document memory management patterns (ownership, allocation)
- Document logging patterns (macros, levels)
- Document naming conventions (prefixes, case style)
- List key patterns that apply across multiple tasks
- This eliminates redundant file reading during implementation!
b. Create the
implementation_plansection with function-level tasks: - Identify all affected and new files
- Break down implementation into function-level tasks
- For each task, specify: file, function, implementation details, code references, test requirements
- IMPORTANT: Set
status: pendingfor all newly created tasks - IMPORTANT: Assign
size(ss/s/m/l/xl/xxl) to each task using the T-Shirt Size Estimation Guide - IMPORTANT: Add
size_rationalefor non-obvious size estimates - IMPORTANT: Calculate
total_effortandeffort_breakdownusing the aggregation rules - IMPORTANT: Populate
code_referenceswith the similar code implementations found in step 1 - For each code reference, specify: source file path, function/method name, and a note explaining why it's relevant
- CRITICAL: Include
pattern_excerptwith the actual code (10-30 lines) - this prevents re-reading during implementation! - Add source code files with similar patterns to
reference_fileslist - Link relevant documentation files in
api_referencesfor each task - Establish task dependencies and ordering
- Ensure each task is independently testable
b. Create a technical specification document in
docs/folder with: - Architecture overview
- Implementation approach
- File and function organization
- Testing strategy
- References to requirements.yaml
c. Verify the implementation_plan is complete and unambiguous
d. Validate the finished YAML: run
~/.claude/scripts/task-validator.py requirements.yamldirectly as an executable — it is+xwith a#!/usr/bin/env python3shebang, so do NOT prefix it withpython3. Only declare the plan complete when it returns 0 ERRORs (exit code 0). Fix every ERROR; weigh each WARNING (e.g. anxxltask that should be broken down, aneffort_breakdownthat drifted from the actual task counts) and resolve it unless it is intentional. See Validation.
Example Implementation Plan
Here's an example of a complete implementation_plan section for adding WebSocket ping/pong support:
context_summary:
error_handling: "Return -1 on error with errno set, 0 on success"
memory_management: "Caller owns returned buffers, internal buffers freed on close"
logging_pattern: "LOG_DEBUG for flow, LOG_ERROR for failures, LOG_WARN for recoverable"
naming_conventions: "poluah_ prefix, snake_case functions, UPPER_CASE constants"
key_patterns:
- "All public functions validate ws pointer and state first"
- "Frame functions use poluah_websocket_send_frame() internally"
- "Tests use CTEST2 macro with ws_fixture"
implementation_plan:
total_effort: l # 4 tasks with largest being M, +1 level for 4 tasks = L
effort_breakdown:
ss: 1
s: 2
m: 1
l: 0
xl: 0
xxl: 0
affected_files:
- /mnt/nvme/src/websocket-server.c
- /mnt/nvme/src/websocket-server.h
new_files:
- /mnt/nvme/src/tests/integration/test-websocket-ping-pong.c
reference_files:
- /mnt/nvme/src/websocket-server.c # existing timeout handling
- /mnt/nvme/src/poluah-client2/poluah-client2-websocket.c # client-side frame handling
tasks:
- task_id: task-001
description: Add ping/pong frame type constants to WebSocket header
file_path: /mnt/nvme/src/websocket-server.h
function_name: null
type: modify
status: pending
size: ss
size_rationale: "2 lines - adding enum constants to existing enum"
implementation_details: |
Add WS_FRAME_PING (0x09) and WS_FRAME_PONG (0x0A) constants to the existing
frame type enum. Follow the pattern of existing WS_FRAME_* constants.
code_references:
- file: /mnt/nvme/src/websocket-server.h
function: null
note: See existing WS_FRAME_TEXT and WS_FRAME_BINARY definitions
api_references:
- docs/websocket-protocol.md
test_requirements: Verify constants are defined and have correct hex values
dependencies: []
- task_id: task-002
description: Implement poluah_websocket_send_ping function
file_path: /mnt/nvme/src/websocket-server.c
function_name: poluah_websocket_send_ping
type: create
status: pending
size: s
size_rationale: "~15 lines - wrapper function following existing send_frame pattern"
implementation_details: |
Create new function that sends a ping frame with optional payload.
Use poluah_websocket_send_frame() internally. Function signature:
int poluah_websocket_send_ping(poluah_websocket_t *ws, const char *payload, size_t len)
Return 0 on success, -1 on error.
code_references:
- file: /mnt/nvme/src/websocket-server.c
function: poluah_websocket_send_frame
note: Use this to build and send the ping frame
pattern_excerpt: |
int poluah_websocket_send_frame(poluah_websocket_t *ws, uint8_t opcode,
const char *payload, size_t len) {
if (!ws || ws->state != WS_STATE_CONNECTED) {
errno = EINVAL;
return -1;
}
uint8_t header[14];
size_t header_len = websocket_build_header(header, opcode, len, false);
if (buffered_write(ws->fd, header, header_len) < 0) return -1;
if (len > 0 && buffered_write(ws->fd, payload, len) < 0) return -1;
return 0;
}
api_references:
- docs/websocket-api.md
test_requirements: Send ping with payload, verify frame is correctly formatted
dependencies: [task-001]
- task_id: task-003
description: Handle incoming ping frames and auto-respond with pong
file_path: /mnt/nvme/src/websocket-server.c
function_name: poluah_websocket_handle_frame
type: modify
status: pending
size: s
size_rationale: "~10 lines - add case to existing switch, call existing function"
implementation_details: |
In poluah_websocket_handle_frame(), add case for WS_FRAME_PING.
When ping is received, automatically send pong with same payload.
Use poluah_websocket_send_frame() with WS_FRAME_PONG type.
code_references:
- file: /mnt/nvme/src/websocket-server.c
function: poluah_websocket_handle_frame
note: See existing switch statement for frame type handling
api_references:
- docs/websocket-protocol.md
test_requirements: Send ping to server, verify pong response with matching payload
dependencies: [task-001, task-002]
- task_id: task-004
description: Create integration test for ping/pong functionality
file_path: /mnt/nvme/src/tests/integration/test-websocket-ping-pong.c
function_name: test_ping_pong_basic
type: create
status: pending
size: m
size_rationale: "~60-80 lines - new test file with 3 test cases, setup/teardown, follows existing pattern"
implementation_details: |
Create new integration test file with test cases:
1. test_ping_pong_basic - send ping, verify pong response
2. test_ping_with_payload - send ping with data, verify echo in pong
3. test_multiple_pings - verify server handles multiple pings correctly
Use ctest framework, follow pattern from test-websocket-server-integration2.c
code_references:
- file: /mnt/nvme/src/tests/integration/poluah-websocket-client-integration-test.c
function: null
note: Follow overall test structure and WebSocket client setup
api_references:
- docs/testing-guide.md
test_requirements: All test cases must pass
dependencies: [task-003]
Validation
requirements.yaml is the sole input for p:implement / p:requirements. A
schema-invalid or inconsistent plan (dangling dependency, dependency cycle, wrong
effort_breakdown, bad enum) is otherwise only discovered mid-implementation, expensively.
Scripts/task-validator.py catches these deterministically — it is the gate before
complete: true.
~/.claude/scripts/task-validator.py [requirements.yaml] [--strict] [--quiet] [--json]
- Phase-aware: with
complete: falseonlyrequirements/constraints/success_criteriaare required; withcomplete: truethe fullimplementation_planandcontext_summaryare validated too. - Checks: schema/enum/type for every field, plus semantic graph checks over the task
set —
task_iduniqueness, dangling/self/cancelled-target dependencies, dependency cycles (Kahn topological sort), andeffort_breakdown/total_effortplausibility. - Output: grouped human-readable
❌ ERRORS/⚠️ WARNINGSsections (use--jsonfor{phase, errors, warnings}machine output,--quietfor just the summary). - Exit codes:
0= no ERROR (and no WARNING under--strict);1= ERROR present (or WARNING under--strict);2= unreadable file / YAML parse error / PyYAML missing.
Gate: before setting complete: true, the plan must validate with exit code 0
(0 ERRORs). Fix every ERROR; weigh each WARNING and resolve unless intentional.