Implement tasks from an OpenSpec change.
Input: Optionally specify a change name (e.g., /spectra:apply add-auth). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Task tracking is file-based only. The tasks file's markdown checkboxes (- [ ] / - [x]) are the single source of truth for progress. Do NOT use any external task management system, built-in task tracker, or todo tool. When a task is done, edit the checkbox in the tasks file — that is the only way to record progress.
Prerequisites: This skill requires the spectra CLI. If any spectra command fails with "command not found" or similar, report the error and STOP.
Steps
Select the change
If a name is provided, use it. Otherwise:
- Infer from conversation context if the user mentioned a change
- Auto-select if only one active change exists
- If ambiguous, run
spectra list --json to get available changes and use the AskUserQuestion tool to let the user select
Always announce: "Using change: " and how to override (e.g., /spectra:apply <other>).
After selecting the change, mark it as in-progress:
spectra in-progress add "<name>"
This is a silent operation — do not show the output to the user.
Check status to understand the schema
spectra status --change "<name>" --json 2>/dev/null
If the command fails: show the error and STOP.
If the command succeeds, check whether the change is parked (status can succeed even for parked changes):
spectra list --parked --json
Look for the change name in the parked array of the JSON output.
If the change IS in the parked list (it's parked):
Inform the user that this change is currently shelved ("暫存" in the app).
Use the AskUserQuestion tool to ask whether to continue.
Use the app's own terminology — in Chinese locales, park = 暫存.
Two options:
- Continue: Un-shelve the change and proceed with apply
- Cancel: Stop the workflow
If the user chooses to continue:
spectra unpark "<name>"
Then re-run spectra status --change "<name>" --json and continue normally.
If there is no AskUserQuestion tool available (non-Claude-Code environment):
Inform the user that the change is shelved and they need to un-shelve it in Spectra first.
STOP.
If the change is NOT in the parked list: proceed normally.
Parse the JSON to understand:
schemaName: The workflow being used (e.g., "spec-driven")
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
Get apply instructions
spectra instructions apply --change "<name>" --json
This returns:
- Context file paths (varies by schema)
- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
Handle states:
- If
state: "blocked" (missing artifacts): show message, suggest using /spectra:propose to create the change artifacts first
- If
state: "all_done": congratulate, suggest archive
- Otherwise: proceed to implementation
Read context files
Read the files listed in contextFiles from the apply instructions output.
The files depend on the schema being used:
- spec-driven: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
Check project preferences
Read openspec/config.yaml in the project root.
If tdd: true is set, apply TDD discipline throughout implementation:
- For each task, write a failing test FIRST, then implement to make it pass
- Fetch TDD instructions by running
spectra instructions --skill tdd, then follow the Red-Green-Refactor cycle
- For bug fixes, reproduce the bug with a failing test before fixing
If audit: true is set, apply sharp-edges discipline throughout implementation:
- When designing APIs or interfaces, evaluate through 3 adversary lenses (Scoundrel, Lazy Developer, Confused Developer)
- When adding configuration options, verify defaults are secure and zero/empty values are safe
- When accepting parameters, check for type confusion and silent failures
- Fetch audit instructions by running
spectra instructions --skill audit, follow the discipline checklist (not the standalone 3-agent workflow)
If parallel_tasks: true is set, check whether consecutive pending tasks have [P] markers (format: - [ ] [P] Task description). You SHALL dispatch consecutive [P] tasks as parallel agents. Only fall back to sequential when tasks have a data dependency (one task's output is another's input) or when tasks modify overlapping regions of the same file. Targeting the same file alone is NOT a reason to skip parallel dispatch — if the modified regions are disjoint, dispatch in parallel. If the environment does not support parallel execution, ignore [P] markers and execute tasks sequentially.
Show current progress
Display:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
Implement tasks (loop until done or blocked)
Reminder: Track progress by editing checkboxes in the tasks file only. Do not use any built-in task tracker.
For each pending task:
- Show which task is being worked on
- Make the code changes required
- Keep changes minimal and focused
- Mark task complete in the tasks file:
- [ ] → - [x]
- Continue to next task
Parallel task dispatch: When consecutive [P]-marked tasks are found and parallel_tasks: true is configured (see Step 5), dispatch them as parallel agents in a single message. If any [P] task fails, pause and report.
Pause if:
- Task is unclear → ask for clarification
- Implementation reveals a design issue → suggest updating artifacts
- Error or blocker encountered → report and wait for guidance
- User interrupts
Final check
After completing all tasks, re-run:
spectra instructions apply --change "<name>" --json
Confirm state: "all_done". If not, review remaining tasks and complete them.
On completion or pause, show status
Display:
- Tasks completed this session
- Overall progress: "N/M tasks complete"
- If all done: suggest archive
- If paused: explain why and wait for guidance
Output During Implementation
## Implementing: <change-name> (schema: <schema-name>)
Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete
Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
Output On Completion
## Implementation Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓
### Completed This Session
- [x] Task 1
- [x] Task 2
...
All tasks complete! You can archive this change with `/spectra:archive`.
Output On Pause (Issue Encountered)
## Implementation Paused
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete
### Issue Encountered
<description of the issue>
**Options:**
1. <option 1>
2. <option 2>
3. Other approach
What would you like to do?
Guardrails
- Keep going through tasks until done or blocked
- Always read context files before starting (from the apply instructions output)
- If task is ambiguous, pause and ask before implementing
- If implementation reveals issues, pause and suggest artifact updates
- Keep code changes minimal and scoped to each task
- Update task checkbox immediately after completing each task
- Pause on errors, blockers, or unclear requirements - don't guess
- Use contextFiles from CLI output, don't assume specific file names
- No external task tracking — do not use any built-in task management, todo list, or progress tracking tool; the tasks file is the only system
- If AskUserQuestion tool is not available, ask the same questions as plain text and wait for the user's response
Fluid Workflow Integration
This skill supports the "actions on a change" model:
- Can be invoked anytime: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
- Allows artifact updates: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
1---2name: spectra-apply-23description: Implement or resume tasks from an OpenSpec change4license: MIT5---67Implement tasks from an OpenSpec change.89**Input**: Optionally specify a change name (e.g., `/spectra:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.1011**Task tracking is file-based only.** The tasks file's markdown checkboxes (`- [ ]` / `- [x]`) are the single source of truth for progress. Do NOT use any external task management system, built-in task tracker, or todo tool. When a task is done, edit the checkbox in the tasks file — that is the only way to record progress.1213**Prerequisites**: This skill requires the `spectra` CLI. If any `spectra` command fails with "command not found" or similar, report the error and STOP.1415**Steps**16171. **Select the change**1819 If a name is provided, use it. Otherwise:20 - Infer from conversation context if the user mentioned a change21 - Auto-select if only one active change exists22 - If ambiguous, run `spectra list --json` to get available changes and use the **AskUserQuestion tool** to let the user select2324 Always announce: "Using change: <name>" and how to override (e.g., `/spectra:apply <other>`).2526 After selecting the change, mark it as in-progress:2728 ```bash29 spectra in-progress add "<name>"30 ```3132 This is a silent operation — do not show the output to the user.33342. **Check status to understand the schema**3536 ```bash37 spectra status --change "<name>" --json 2>/dev/null38 ```3940 **If the command fails**: show the error and STOP.4142 **If the command succeeds**, check whether the change is parked (status can succeed even for parked changes):4344 ```bash45 spectra list --parked --json46 ```4748 Look for the change name in the `parked` array of the JSON output.49 - **If the change IS in the parked list** (it's parked):50 Inform the user that this change is currently shelved ("暫存" in the app).51 Use the **AskUserQuestion tool** to ask whether to continue.52 Use the app's own terminology — in Chinese locales, park = 暫存.53 Two options:54 - **Continue**: Un-shelve the change and proceed with apply55 - **Cancel**: Stop the workflow5657 If the user chooses to continue:5859 ```bash60 spectra unpark "<name>"61 ```6263 Then re-run `spectra status --change "<name>" --json` and continue normally.6465 If there is no AskUserQuestion tool available (non-Claude-Code environment):66 Inform the user that the change is shelved and they need to un-shelve it in Spectra first.67 STOP.6869 - **If the change is NOT in the parked list**: proceed normally.7071 Parse the JSON to understand:72 - `schemaName`: The workflow being used (e.g., "spec-driven")73 - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)74753. **Get apply instructions**7677 ```bash78 spectra instructions apply --change "<name>" --json79 ```8081 This returns:82 - Context file paths (varies by schema)83 - Progress (total, complete, remaining)84 - Task list with status85 - Dynamic instruction based on current state8687 **Handle states:**88 - If `state: "blocked"` (missing artifacts): show message, suggest using `/spectra:propose` to create the change artifacts first89 - If `state: "all_done"`: congratulate, suggest archive90 - Otherwise: proceed to implementation91924. **Read context files**9394 Read the files listed in `contextFiles` from the apply instructions output.95 The files depend on the schema being used:96 - **spec-driven**: proposal, specs, design, tasks97 - Other schemas: follow the contextFiles from CLI output98995. **Check project preferences**100101 Read `openspec/config.yaml` in the project root.102 If `tdd: true` is set, apply TDD discipline throughout implementation:103 - For each task, write a failing test FIRST, then implement to make it pass104 - Fetch TDD instructions by running `spectra instructions --skill tdd`, then follow the Red-Green-Refactor cycle105 - For bug fixes, reproduce the bug with a failing test before fixing106107 If `audit: true` is set, apply sharp-edges discipline throughout implementation:108 - When designing APIs or interfaces, evaluate through 3 adversary lenses (Scoundrel, Lazy Developer, Confused Developer)109 - When adding configuration options, verify defaults are secure and zero/empty values are safe110 - When accepting parameters, check for type confusion and silent failures111 - Fetch audit instructions by running `spectra instructions --skill audit`, follow the discipline checklist (not the standalone 3-agent workflow)112113 If `parallel_tasks: true` is set, check whether consecutive pending tasks have `[P]` markers (format: `- [ ] [P] Task description`). You SHALL dispatch consecutive `[P]` tasks as parallel agents. Only fall back to sequential when tasks have a data dependency (one task's output is another's input) or when tasks modify overlapping regions of the same file. Targeting the same file alone is NOT a reason to skip parallel dispatch — if the modified regions are disjoint, dispatch in parallel. If the environment does not support parallel execution, ignore `[P]` markers and execute tasks sequentially.1141156. **Show current progress**116117 Display:118 - Schema being used119 - Progress: "N/M tasks complete"120 - Remaining tasks overview121 - Dynamic instruction from CLI1221237. **Implement tasks (loop until done or blocked)**124125 **Reminder: Track progress by editing checkboxes in the tasks file only. Do not use any built-in task tracker.**126127 For each pending task:128 - Show which task is being worked on129 - Make the code changes required130 - Keep changes minimal and focused131 - Mark task complete in the tasks file: `- [ ]` → `- [x]`132 - Continue to next task133134 **Parallel task dispatch**: When consecutive `[P]`-marked tasks are found and `parallel_tasks: true` is configured (see Step 5), dispatch them as parallel agents in a single message. If any `[P]` task fails, pause and report.135136 **Pause if:**137 - Task is unclear → ask for clarification138 - Implementation reveals a design issue → suggest updating artifacts139 - Error or blocker encountered → report and wait for guidance140 - User interrupts1411428. **Final check**143144 After completing all tasks, re-run:145146 ```bash147 spectra instructions apply --change "<name>" --json148 ```149150 Confirm `state: "all_done"`. If not, review remaining tasks and complete them.1511529. **On completion or pause, show status**153154 Display:155 - Tasks completed this session156 - Overall progress: "N/M tasks complete"157 - If all done: suggest archive158 - If paused: explain why and wait for guidance159160**Output During Implementation**161162```163## Implementing: <change-name> (schema: <schema-name>)164165Working on task 3/7: <task description>166[...implementation happening...]167✓ Task complete168169Working on task 4/7: <task description>170[...implementation happening...]171✓ Task complete172```173174**Output On Completion**175176```177## Implementation Complete178179**Change:** <change-name>180**Schema:** <schema-name>181**Progress:** 7/7 tasks complete ✓182183### Completed This Session184- [x] Task 1185- [x] Task 2186...187188All tasks complete! You can archive this change with `/spectra:archive`.189```190191**Output On Pause (Issue Encountered)**192193```194## Implementation Paused195196**Change:** <change-name>197**Schema:** <schema-name>198**Progress:** 4/7 tasks complete199200### Issue Encountered201<description of the issue>202203**Options:**2041. <option 1>2052. <option 2>2063. Other approach207208What would you like to do?209```210211**Guardrails**212213- Keep going through tasks until done or blocked214- Always read context files before starting (from the apply instructions output)215- If task is ambiguous, pause and ask before implementing216- If implementation reveals issues, pause and suggest artifact updates217- Keep code changes minimal and scoped to each task218- Update task checkbox immediately after completing each task219- Pause on errors, blockers, or unclear requirements - don't guess220- Use contextFiles from CLI output, don't assume specific file names221- **No external task tracking** — do not use any built-in task management, todo list, or progress tracking tool; the tasks file is the only system222- If **AskUserQuestion tool** is not available, ask the same questions as plain text and wait for the user's response223224**Fluid Workflow Integration**225226This skill supports the "actions on a change" model:227228- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions229- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly