Task preparation skill for spec-driven workflows. Reads specifications, identifies next actionable tasks, and creates detailed execution plans. Use when ready to implement a task from an existing spec - bridges the gap between planning and coding.
Start
|
v
Read Work Mode Config (Step 0)
|
+-- single mode --> Discover Specs -> Gather Context -> Select Task
| | |
| | Alternatives?
| | / \
| | yes -> Browse no -> Prepare Recommended Task
| | \ /
| v v v
| Draft Plan -> Seek Approval -> Implementation Handoff
| |
| v
| Post-Implementation Checklist -> Surface Next -> Finish
|
+-- autonomous mode --> Phase Loop (auto-complete all tasks) -> Finish
CRITICAL: This must be the FIRST step when sdd-next is invoked.
Before doing anything else, read the work mode from the user's configuration:
sdd get-work-mode --json
Expected output:
{"work_mode": "single"}
or
{"work_mode": "autonomous"}
Routing based on work_mode:
"single": Follow Single Task Workflow (Sections 3.1-3.6)
"autonomous": Follow Autonomous Mode Workflow (Section starting at line 438)
&& chaining)specs/pending, specs/active, specs/completed)ALWAYS use sdd commands to read spec JSON files:
✅ sdd prepare-task {spec-id}
✅ sdd task-info {spec-id} {task-id}
✅ sdd progress {spec-id}
NEVER use these tools/commands on spec JSON:
❌ Read(/path/to/spec.json) # Wastes 10,000+ tokens (specs are 50KB+)
❌ cat specs/active/spec.json # Bypasses validation and hooks
❌ head specs/active/spec.json # Wastes context
❌ jq '.tasks' spec.json # Bypasses error handling
❌ grep "task-1" spec.json # Inefficient, error-prone
Why: Spec files are large JSON (machine-readable, not human-readable). Direct reading wastes valuable context tokens and bypasses built-in validation, error handling, and hooks.
Default workflow (stick to this unless spec says otherwise)
sdd prepare-task with no flags. The returned context block already includes the previous sibling, parent metadata, phase progress, sibling files, the latest journal summary, and file-focused documentation context (when available via context.file_docs).sdd task-info, sdd get-task, or sdd progress if the spec explicitly asks for extra metadata or you need files that are not exposed in context.sdd prepare-task to surface the next recommendation and refreshed context.When to use enhancement flags (extended_context)
--include-full-journal: You need the full journal history for the previous sibling (long-running refactors, nuanced design notes).--include-phase-history: You are preparing phase summaries or retrospectives and need every entry tied to the current phase.--include-spec-overview: You must report spec-wide progress without running sdd progress.Decision guide
context?
sdd task-info {spec_id} {task_id} (or sdd get-task if the spec mentions nested metadata).--include-full-journal (previous sibling) or sdd get-journal for arbitrary tasks.sdd query-tasks --parent {phase_id} when presenting options to the user.Anti-patterns to avoid
task-info, check-deps, and get-task back-to-back "just in case." The default prepare-task response now includes all dependency details in context.dependencies, eliminating the need for check-deps in 95% of cases. Call these commands only when context is insufficient for special requirements.sdd progress or sdd list-phases after every plan change. Use context.phase for quick updates and run sdd progress only before reporting global status.| Command | Returns | Use when | Redundant / Notes |
| --- | --- | --- | --- |
| sdd prepare-task | Recommended task plus context (previous sibling, parent, phase, sibling files, journal summary, dependencies, file_docs) | Always – first call for every task | file_docs automatically included when doc-query documentation is available |
| sdd task-info | Raw task metadata straight from the spec | Spec explicitly references metadata not surfaced in context (acceptance criteria, detailed instructions) | Usually covered by prepare-task; only call when spec requires |
| sdd get-task | Full JSON node, including deep metadata blobs | Rare audits where you must inspect the spec data exactly as stored | Redundant with task-info for normal flows |
| sdd progress | Spec-wide counts, percentages, current phase | Preparing a status report or verifying completion prompts | context.phase already shows local progress; only run when reporting overall stats |
| sdd list-phases | Every phase with completion % | Re-prioritizing phases or presenting alternate scopes to the user | Typically unnecessary after progress; use only on request |
| sdd get-journal | Journal entries for any task | Need history beyond summaries (retro write-ups, deep audits) | --include-full-journal adds previous sibling history; get-journal is for arbitrary tasks |
Gate key decisions with AskUserQuestion (MANDATORY):
Anti-Pattern: Never use text-based numbered lists like "1. Option A, 2. Option B". Always use AskUserQuestion tool for structured choices.
Before checking context, you MUST generate a session marker first.
This is a two-step process that must run sequentially:
sdd session-marker
sdd context --session-marker "SESSION_MARKER_<hash>"
Output Format:
{"context_percentage_used": 78}
✅ Run as TWO SEPARATE Bash tool calls (never combine) ✅ Run SEQUENTIALLY, not in parallel (step 2 depends on step 1 being logged) ❌ NEVER combine with && or $() - The marker must be logged to transcript first ❌ NEVER run in parallel - Step 2 will fail if step 1 hasn't been logged
/clear and then /sdd-begin for the next task⚠️ ONLY check actual context percentage – NEVER speculate about future consumption:
❌ DO NOT stop early because:
✅ DO ONLY stop when:
Rationale: Predicting context usage is unreliable and defeats the purpose of checking. The threshold (85%) is designed to give adequate headroom; stopping earlier wastes that safety margin.
When sdd-next is invoked, it automatically reads the work_mode setting from .claude/sdd_config.json (see Step 0) and routes to the appropriate workflow:
Single Task Mode ("work_mode": "single") - Default
Autonomous Mode ("work_mode": "autonomous")
Use this workflow when the configured work mode is Single Task Mode ("work_mode": "single" in config). Execute one task at a time with explicit user approval for each step.
sdd progress {spec-id}sdd find-specsstatus: active with non-zero progress (started but incomplete)in_progress tasks(Recommended) in AskUserQuestionAskUserQuestion (include "Other / provide id")sdd progress {spec-id} and sdd list-phases {spec-id} for status summarysdd list-blockers, sdd render) only on requestAskUserQuestion: accept recommended task or browse alternatives?sdd prepare-task {spec-id} → surface task id, file, estimates, blockerssdd query-tasks {spec-id} (filter --parent, --status) + sdd list-blockers {spec-id} → present shortlist via AskUserQuestionGather every detail with a single call (omit {task-id} to accept the recommended task):
sdd prepare-task {spec-id} {task-id}
That response already contains everything you need:
task_data → title, metadata, instructions pulled from the specdependencies → top-level blocking status (can_start, blocked_by list)context → stitched data from the previous sibling, parent task, current phase, sibling files, task journal, AND detailed dependency information (context.dependencies) with full task titles, statuses, and file pathsTreat context as the authoritative source rather than chaining sdd task-info, sdd check-deps, and sdd get-task. Typical fields:
"context": {
"previous_sibling": {
"task_id": "task-3-1-2",
"title": "Tighten plan creation language",
"summary": "Updated scope guardrails for Section 3.3"
},
"parent_task": {
"task_id": "task-3-1",
"title": "Polish the planning workflow",
"position_label": "Phase 3 · Task 1"
},
"phase": {
"name": "Implementation",
"percentage": 58,
"blockers": []
},
"sibling_files": [
{"path": "skills/sdd-next/SKILL.md", "reason": "Touched by previous sibling"}
],
"task_journal": {
"entry_count": 0,
"entries": []
},
"dependencies": {
"blocking": [],
"blocked_by_details": [
{
"id": "task-2-3",
"title": "Update context gathering",
"status": "in_progress",
"file_path": "src/context.py"
}
],
"soft_depends": []
}
}
context.previous_sibling: reference recent work for continuity or reuse its journal summary when explaining why the new task matters (context.previous_sibling.title).context.parent_task: verify how this subtask fits into the backlog; use context.parent_task.position_label to show progress.context.phase: surface phase health (context.phase.percentage, context.phase.blockers) without calling sdd progress.context.sibling_files: prime file navigation by reviewing whatever the spec already touched before opening new files.context.task_journal: access journal entries for this task showing decision history and status changes without separate calls.context.dependencies: detailed dependency information with task titles, statuses, and file paths for blocking (tasks this blocks), blocked_by_details (tasks blocking this), and soft_depends (soft dependencies)—eliminates need for separate sdd check-deps call in 95% of cases.Only fall back to sdd task-info or sdd check-deps when the spec explicitly calls for metadata that is not surfaced through the standard payload.
Draft the execution plan around the spec intent, dependency gates, and the insights above. Example:
context.sibling_files to maintain consistent tone.context.parent_task.title/position_label.context.phase.context.previous_sibling.summary if you need to explain how the work continues an earlier change.Present plan and get approval via AskUserQuestion:
If recommended task is blocked, pause for guidance or loop back to task selection.
Before coding:
sdd update-status {spec-id} {task-id} in_progress --note "context"
During implementation:
Using sdd doc scope --implement During Implementation:
When documentation is available and you need detailed implementation context for a file, use:
sdd doc scope <file-path> --implement
This provides implementation-focused context including:
When to use scope --implement:
When NOT to use scope --implement:
scope --plan instead (lighter context)Example workflow:
# 1. Task started, need implementation context
sdd doc scope src/services/auth.ts --implement
# 2. Review detailed implementation patterns and signatures
# (command returns comprehensive implementation context)
# 3. Implement changes following discovered patterns
# 4. Mark task complete with journal entry
Optimization tips:
scope --implement at task start, not repeatedly during codingRead calls for specific line ranges if context is tightAfter implementation:
Mark task complete using sdd-update subagent (atomically marks complete + creates journal):
Task(
subagent_type: "sdd-toolkit:sdd-update-subagent",
prompt: "Complete task {task-id} in spec {spec-id}. Completion note: [Summary of what was accomplished, tests run, verification performed].",
description: "Mark task complete"
)
Journal content must include:
Immediately after completion:
sdd prepare-task {spec-id}
ONLY mark a task as completed when you have FULLY accomplished it.
❌ Tests are failing ❌ Implementation is partial ❌ You encountered unresolved errors ❌ You couldn't find necessary files or dependencies ❌ Blockers exist that prevent verification
✅ Keep task as in_progress
✅ Create new task describing what needs resolution
✅ Document blocker using sdd-update subagent
✅ Present alternatives to user via AskUserQuestion
When a task has been marked as blocked and the blocker is later resolved:
sdd unblock-task {spec-id} {task-id} --resolution "Brief description of how blocker was resolved"
Example:
sdd unblock-task feature-auth-001 task-3-2 --resolution "API endpoint now available in staging environment"
This marks the task as unblocked and ready to proceed. The task will then appear in sdd prepare-task recommendations.
MUST provide journal content describing:
Example:
Task(
subagent_type: "sdd-toolkit:sdd-update-subagent",
prompt: "Complete task task-2-3 in spec my-spec-001. Completion note: Implemented JWT auth middleware with PKCE flow. All 12 unit tests passing. Manual verification: login flow works in dev environment. Created src/middleware/auth.ts (180 lines) and tests/middleware/auth.spec.ts (45 tests).",
description: "Mark task-2-3 complete"
)
| Use the Spec Journal When… | Use Git History When… |
|----------------------------|------------------------|
| Closing any SDD task (journaling is mandatory and captures intent, verification, and follow-ups). | Investigating merge conflicts, bisects, or broader repo archaeology unrelated to a single spec task. |
| You need implementation details, test results, deviations, or next-task hints (journal.entries[] already hold this context in structured JSON). | You must inspect low-level commit metadata, e.g., to see who touched a file outside the spec workflow. |
| Preparing status updates: previous sibling journal summaries come bundled in sdd prepare-task. | You’re debugging historical code paths predating the current spec. |
Anti-pattern: Running git log / git show to understand a recently completed SDD task when the journal already documents the work. That wastes time and risks contradicting the canonical record. Start with the spec journal; escalate to git history only if a fact is missing or you are diagnosing repo-level issues (rebases, conflicts, regressions).
Journal advantages
task_id.sdd prepare-task to surface the latest context without extra commands.Check task metadata for type: verify or verification_type field:
sdd task-info {spec-id} {task-id}
| verification_type | Action |
|-------------------|--------|
| "auto" | Invoke sdd-toolkit:run-tests-subagent |
| "fidelity" | Invoke sdd-toolkit:sdd-fidelity-review-subagent |
| "manual" | Present checklist to user for manual confirmation |
verification_type: "auto")Task(
subagent_type: "sdd-toolkit:run-tests-subagent",
prompt: "Run tests for {task-id} in spec {spec-id}. Execute tests and handle failures.",
description: "Run tests"
)
After tests complete:
AskUserQuestion to get approval before marking completeverification_type: "fidelity")Task(
subagent_type: "sdd-toolkit:sdd-fidelity-review-subagent",
prompt: "Review {scope} '{target}' in spec {spec-id}. Compare completed tasks against requirements.",
description: "Fidelity review for {scope}"
)
After review completes:
AskUserQuestion for decision:
verification_type: "manual")Present checklist from task metadata to user for confirmation via AskUserQuestion.
After completing a task:
in_progress → completed) with journal entrysdd prepare-task {spec-id} and shared with usersdd progress {spec-id} for reportingUse this workflow when the configured work mode is Autonomous Mode ("work_mode": "autonomous" in config). If the user changes the config to Single Task Mode mid-session, switch to Section 3 (Single Task Workflow).
"work_mode": "autonomous" setSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer