SDD Task Planner
This skill transforms specifications into actionable plans, but unlike a simple generator, it learns and enforces rules. It checks the Knowledge Base for similar past features, reads project_rules.md for architectural constraints, and applies clarification when needed.
Core Responsibilities
- Rule-Aware Planning: Read
project_rules.md first — especially Architecture and Coding Standards — before generating any task.
- Pattern Matching: Query
sdd-knowledge-base for tasks similar to the current feature (by tags).
- Smart Generation: If a pattern exists, hydrate it. If not, generate new tasks from spec artifacts.
- Path Validation: Every task must include a
target_path that conforms to the architecture conventions defined in project_rules.md.
- Optimization: Order tasks to minimize context switching.
Commands
/sdd-plan: Generate or update the implementation plan (tasks.json).
/sdd-plan-optimize: Re-sort tasks based on dependencies and developer availability.
Planning Logic
When /sdd-plan is called:
Step 1: Read Project Rules (MANDATORY FIRST STEP)
- Load
project_rules.md from .sdd/context/.
- Extract architecture conventions from the Architecture section of
project_rules.md (e.g., directory structure patterns, layer ordering).
- Extract coding standards and naming conventions.
- These rules constrain all subsequent task generation.
Step 2: Knowledge Lookup (MANDATORY — Index-Based)
- Read
.sdd/knowledge/index.json (the lightweight index).
- Filter
patterns entries whose tags match the current feature's domain keywords.
- Filter
lessons entries whose tags match OR whose trigger matches "planning-*" or the current feature's domain.
- Load ONLY the matched files (via the
file path in each index entry). Do NOT scan the full patterns/ or lessons/ directories.
- Summarize relevant findings — reuse proven strategies and avoid past mistakes.
- Output the knowledge match results before proceeding:
📚 **Knowledge Loaded** (stage: plan)
| Type | ID | Matched Tags | Summary |
|------|----|-------------|---------|
| <type> | <id> | `<tag1>`, `<tag2>` | <summary> |
> No knowledge matched. (if empty)
Step 3: Analyze Feature Context
- Read
context.json — get current_feature.
- Read all available spec artifacts from
.sdd/spec/<feature-id>/. The following may exist depending on the feature's design:
requirements.json — functional/non-functional requirements and constraints.
architecture.json — components, data flow, architectural decisions.
object_design.json — design units (classes, components, modules, hooks, handlers, etc.), relationships.
data_model.json — data entity schemas and storage definitions (if applicable).
openapi.yaml — API contract (if applicable).
interface_contract.json — non-HTTP interface definitions (if applicable).
Step 4: Pre-Plan Clarification
Before generating tasks, check for concerns:
- "This feature requires a new data migration / schema change. Which task should handle it?"
- "Found a similar pattern
form-validation (tags: form, validation, ui). Apply it or customize?"
- "Spec item REQ-003 still has open clarifications. Resolve via
/sdd-design first?"
Present BLOCKING concerns to user and STOP. Wait for user resolution. Skip if no concerns.
Step 5: Generate Tasks
- If Pattern Match Found:
- Load Pattern Task List.
- Replace placeholders (e.g.,
{{Entity}} → User).
- Cross-reference with spec artifacts to ensure all requirements, design units, interfaces, and entities are covered.
- Adjust
target_path to match project_rules.md conventions.
- Output
tasks.json.
- If No Match:
- Parse ALL available spec artifacts.
- Identify the key implementation units from spec artifacts (e.g., components, modules, services, pages, commands — depending on the project type).
- Map each design unit from
object_design.json to a task, ensuring names, signatures, kind, and layer placement are preserved in the task description.
- Map additional artifacts (
data_model.json, openapi.yaml, interface_contract.json) to relevant tasks if they exist.
- Verify every functional requirement in
requirements.json is addressed by at least one task.
- Generate
target_path for each task based on project rules.
- Generate fresh
tasks.json.
Step 6: Guardrail Validation
After generating tasks, invoke sdd-guardrails with context "plan":
- Path Convention Check: Verify each task's
target_path matches the architecture style.
- Validate each task's
target_path matches the conventions declared in project_rules.md.
- Rule Compliance: Ensure task descriptions don't contradict
project_rules.md.
- If violations found → fix tasks → re-validate.
JSON Writing Rule
When writing tasks.json, you MUST use the file writing tools. All string values MUST have special characters properly escaped (\", \\, \n, \t, control chars). Validate JSON is well-formed before writing to disk. If validation fails, fix escaping issues before saving.
Step 7: Finalize
- Write
tasks.json to .sdd/plan/<feature-id>/tasks.json.
- Update
context.json.current_stage to "plan-complete".
Output
Generates .sdd/plan/<feature-id>/tasks.json containing:
- Task Groups: Logical grouping of tasks.
- Dependencies: Explicit blocking relationships.
- Target Paths: Expected file paths for each task's output.
- Estimated Effort: Based on historical data from similar patterns.
Post-step: Feedback Capture (MANDATORY)
After presenting the plan to the user, if the user adjusts the generated plan (changes task granularity, reorders tasks, rejects a pattern match):
- Apply the requested changes to
tasks.json.
- Immediately write a lesson to
.sdd/knowledge/lessons/ capturing:
- What was originally planned vs what the user changed.
- Why the adjustment was needed.
- Tags for future retrieval (feature name,
planning-tasks, domain keywords).
This is NOT optional. Every user adjustment to the plan MUST be recorded as a lesson.
Integration
- Input:
context.json, project_rules.md, .sdd/spec/<feature-id>/* (requirements.json, architecture.json, object_design.json, data_model.json, openapi.yaml, interface_contract.json), sdd-knowledge-base.
- Output:
.sdd/plan/<feature-id>/tasks.json (consumed by sdd-implementer).
- Invokes:
sdd-guardrails (plan-level checks).
1---2name: sdd-task-planner3description: Intelligent planning engine that uses historical patterns and project rules to generate implementation tasks.4---56# SDD Task Planner78This skill transforms specifications into actionable plans, but unlike a simple generator, it **learns** and **enforces rules**. It checks the Knowledge Base for similar past features, reads `project_rules.md` for architectural constraints, and applies clarification when needed.910## Core Responsibilities11121. **Rule-Aware Planning**: Read `project_rules.md` **first** — especially Architecture and Coding Standards — before generating any task.132. **Pattern Matching**: Query `sdd-knowledge-base` for tasks similar to the current feature (by tags).143. **Smart Generation**: If a pattern exists, hydrate it. If not, generate new tasks from spec artifacts.154. **Path Validation**: Every task must include a `target_path` that conforms to the architecture conventions defined in `project_rules.md`.165. **Optimization**: Order tasks to minimize context switching.1718## Commands1920- `/sdd-plan`: Generate or update the implementation plan (`tasks.json`).21- `/sdd-plan-optimize`: Re-sort tasks based on dependencies and developer availability.2223## Planning Logic2425When `/sdd-plan` is called:2627### Step 1: Read Project Rules (MANDATORY FIRST STEP)281. Load `project_rules.md` from `.sdd/context/`.292. Extract architecture conventions from the Architecture section of `project_rules.md` (e.g., directory structure patterns, layer ordering).303. Extract coding standards and naming conventions.314. These rules constrain all subsequent task generation.3233### Step 2: Knowledge Lookup (MANDATORY — Index-Based)341. Read `.sdd/knowledge/index.json` (the lightweight index).352. Filter `patterns` entries whose `tags` match the current feature's domain keywords.363. Filter `lessons` entries whose `tags` match OR whose `trigger` matches `"planning-*"` or the current feature's domain.374. Load ONLY the matched files (via the `file` path in each index entry). Do NOT scan the full `patterns/` or `lessons/` directories.385. Summarize relevant findings — reuse proven strategies and avoid past mistakes.396. **Output the knowledge match results** before proceeding:4041```42📚 **Knowledge Loaded** (stage: plan)4344| Type | ID | Matched Tags | Summary |45|------|----|-------------|---------|46| <type> | <id> | `<tag1>`, `<tag2>` | <summary> |4748> No knowledge matched. (if empty)49```5051### Step 3: Analyze Feature Context521. Read `context.json` — get `current_feature`.532. Read **all available** spec artifacts from `.sdd/spec/<feature-id>/`. The following may exist depending on the feature's design:54 - `requirements.json` — functional/non-functional requirements and constraints.55 - `architecture.json` — components, data flow, architectural decisions.56 - `object_design.json` — design units (classes, components, modules, hooks, handlers, etc.), relationships.57 - `data_model.json` — data entity schemas and storage definitions (if applicable).58 - `openapi.yaml` — API contract (if applicable).59 - `interface_contract.json` — non-HTTP interface definitions (if applicable).6061### Step 4: Pre-Plan Clarification62Before generating tasks, check for concerns:63- "This feature requires a new data migration / schema change. Which task should handle it?"64- "Found a similar pattern `form-validation` (tags: form, validation, ui). Apply it or customize?"65- "Spec item REQ-003 still has open clarifications. Resolve via `/sdd-design` first?"6667Present BLOCKING concerns to user and **STOP**. Wait for user resolution. Skip if no concerns.6869### Step 5: Generate Tasks70- **If Pattern Match Found**:71 - Load Pattern Task List.72 - Replace placeholders (e.g., `{{Entity}}` → `User`).73 - Cross-reference with spec artifacts to ensure all requirements, design units, interfaces, and entities are covered.74 - Adjust `target_path` to match `project_rules.md` conventions.75 - Output `tasks.json`.76- **If No Match**:77 - Parse ALL available spec artifacts.78 - Identify the key implementation units from spec artifacts (e.g., components, modules, services, pages, commands — depending on the project type).79 - Map each design unit from `object_design.json` to a task, ensuring names, signatures, `kind`, and layer placement are preserved in the task description.80 - Map additional artifacts (`data_model.json`, `openapi.yaml`, `interface_contract.json`) to relevant tasks if they exist.81 - Verify every functional requirement in `requirements.json` is addressed by at least one task.82 - Generate `target_path` for each task based on project rules.83 - Generate fresh `tasks.json`.8485### Step 6: Guardrail Validation86After generating tasks, invoke `sdd-guardrails` with context `"plan"`:87- **Path Convention Check**: Verify each task's `target_path` matches the architecture style.88 - Validate each task's `target_path` matches the conventions declared in `project_rules.md`.89- **Rule Compliance**: Ensure task descriptions don't contradict `project_rules.md`.90- If violations found → fix tasks → re-validate.9192### JSON Writing Rule93When writing `tasks.json`, you **MUST use the file writing tools**. All string values MUST have special characters properly escaped (`\"`, `\\`, `\n`, `\t`, control chars). Validate JSON is well-formed before writing to disk. If validation fails, fix escaping issues before saving.9495### Step 7: Finalize961. Write `tasks.json` to `.sdd/plan/<feature-id>/tasks.json`.972. Update `context.json.current_stage` to `"plan-complete"`.9899## Output100101Generates `.sdd/plan/<feature-id>/tasks.json` containing:102- **Task Groups**: Logical grouping of tasks.103- **Dependencies**: Explicit blocking relationships.104- **Target Paths**: Expected file paths for each task's output.105- **Estimated Effort**: Based on historical data from similar patterns.106107## Post-step: Feedback Capture (MANDATORY)108109After presenting the plan to the user, if the user adjusts the generated plan (changes task granularity, reorders tasks, rejects a pattern match):1101. Apply the requested changes to `tasks.json`.1112. **Immediately** write a lesson to `.sdd/knowledge/lessons/` capturing:112 - What was originally planned vs what the user changed.113 - Why the adjustment was needed.114 - Tags for future retrieval (feature name, `planning-tasks`, domain keywords).115116This is NOT optional. Every user adjustment to the plan MUST be recorded as a lesson.117118## Integration119120- **Input**: `context.json`, `project_rules.md`, `.sdd/spec/<feature-id>/*` (`requirements.json`, `architecture.json`, `object_design.json`, `data_model.json`, `openapi.yaml`, `interface_contract.json`), `sdd-knowledge-base`.121- **Output**: `.sdd/plan/<feature-id>/tasks.json` (consumed by `sdd-implementer`).122- **Invokes**: `sdd-guardrails` (plan-level checks).