aboutsummaryrefslogtreecommitdiffstats
path: root/.claude/skills/openspec-apply-change
diff options
context:
space:
mode:
Diffstat (limited to '.claude/skills/openspec-apply-change')
-rw-r--r--.claude/skills/openspec-apply-change/SKILL.md188
1 files changed, 188 insertions, 0 deletions
diff --git a/.claude/skills/openspec-apply-change/SKILL.md b/.claude/skills/openspec-apply-change/SKILL.md
new file mode 100644
index 0000000..ca20232
--- /dev/null
+++ b/.claude/skills/openspec-apply-change/SKILL.md
@@ -0,0 +1,188 @@
1---
2name: openspec-apply-change
3description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
4allowed-tools: Bash(openspec:*)
5license: MIT
6compatibility: Requires openspec CLI.
7metadata:
8 author: openspec
9 version: "1.0"
10 generatedBy: "1.13.0"
11---
12
13Implement tasks from an OpenSpec change.
14
15**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
16
17**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
18
19**Steps**
20
211. **Select the change**
22
23 If a name is provided, use it. Otherwise:
24 - Infer from conversation context if the user mentioned a change
25 - Auto-select if only one active change exists
26 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
27
28 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
29
302. **Check status to understand the schema**
31 ```bash
32 openspec status --change "<name>" --json
33 ```
34 Parse the JSON to understand:
35 - `schemaName`: The workflow being used (e.g., "spec-driven")
36 - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
37 - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
38
393. **Get apply instructions**
40
41 ```bash
42 openspec instructions apply --change "<name>" --json
43 ```
44
45 This returns:
46 - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
47 - Progress (total, complete, remaining)
48 - Task list with status
49 - Dynamic instruction based on current state
50 - Optional `context`: current required project instruction input from the selected root
51 - Optional `operationGuidance`: current advisory guidance for apply
52
53 **Handle states:**
54 - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
55 - If `state: "all_done"`: congratulate, suggest archive
56 - Otherwise: proceed to implementation
57
58 Treat `context` as a required prompt-level input. Read and consider it, and
59 apply relevant project facts, conventions, and constraints while implementing.
60 Treat `operationGuidance` as optional additive advice. Read and consider every
61 entry, and follow entries that are applicable and compatible with the built-in
62 workflow.
63
64 Keep both fields separate from CLI-returned state, missing artifacts, tasks,
65 progress, `contextFiles`, and the built-in `instruction`. They are not
66 evidence of task completion, do not replace the built-in instruction, and do
67 not permit bypassing a blocked state. If context conflicts with the built-in
68 instruction, an explicit user choice, or a CLI-controlled value, report the
69 conflict and preserve the controlling value. If guidance is inapplicable or
70 conflicts with those controlling inputs, do not follow it and explain why.
71 These are prompt-level behavior contracts, not enforceable checks.
72
734. **Read context files**
74
75 Read every file path listed under `contextFiles` from the apply instructions output.
76 The files depend on the schema being used:
77 - **spec-driven**: proposal, specs, design, tasks
78 - Other schemas: follow the contextFiles from CLI output
79
80 Do not copy `context` or `operationGuidance` verbatim into implementation
81 files or planning artifacts unless the user separately asks for that content.
82
835. **Show current progress**
84
85 Display:
86 - Schema being used
87 - Progress: "N/M tasks complete"
88 - Remaining tasks overview
89 - Dynamic instruction from CLI
90
916. **Implement tasks (loop until done or blocked)**
92
93 For each pending task:
94 - Show which task is being worked on
95 - Make the code changes required
96 - Keep changes minimal and focused
97 - Mark task complete in the tasks file: `- [ ]` → `- [x]`
98 - Continue to next task
99
100 **Pause if:**
101 - Task is unclear → ask for clarification
102 - Implementation reveals a design issue → suggest updating artifacts
103 - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
104 - Error or blocker encountered → report and wait for guidance
105 - User interrupts
106
1077. **On completion or pause, show status**
108
109 Display:
110 - Tasks completed this session
111 - Overall progress: "N/M tasks complete"
112 - If all done: suggest archive
113 - If paused: explain why and wait for guidance
114
115**Output During Implementation**
116
117```
118## Implementing: <change-name> (schema: <schema-name>)
119
120Working on task 3/7: <task description>
121[...implementation happening...]
122✓ Task complete
123
124Working on task 4/7: <task description>
125[...implementation happening...]
126✓ Task complete
127```
128
129**Output On Completion**
130
131```
132## Implementation Complete
133
134**Change:** <change-name>
135**Schema:** <schema-name>
136**Progress:** 7/7 tasks complete ✓
137
138### Completed This Session
139- [x] Task 1
140- [x] Task 2
141...
142
143All tasks complete! You can archive this change with `/opsx:archive`.
144```
145
146**Output On Pause (Issue Encountered)**
147
148```
149## Implementation Paused
150
151**Change:** <change-name>
152**Schema:** <schema-name>
153**Progress:** 4/7 tasks complete
154
155### Issue Encountered
156<description of the issue>
157
158**Options:**
1591. <option 1>
1602. <option 2>
1613. Other approach
162
163What would you like to do?
164```
165
166**Guardrails**
167- Keep going through tasks until done or blocked
168- Always read context files before starting (from the apply instructions output)
169- If task is ambiguous, pause and ask before implementing
170- If implementation reveals issues, pause and suggest artifact updates
171- Keep code changes minimal and scoped to each task
172- Update task checkbox immediately after completing each task
173- Pause on errors, blockers, or unclear requirements - don't guess
174- When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
175- Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
176- Use contextFiles from CLI output, don't assume specific file names
177- Do not use context or operation guidance as proof that a task is complete
178- Apply relevant project context; report conflicts with controlling workflow inputs
179- Consider every guidance entry; explain any inapplicable or conflicting advice
180- Do not copy runtime context or operation guidance into implementation files or planning artifacts
181- Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
182
183**Fluid Workflow Integration**
184
185This skill supports the "actions on a change" model:
186
187- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
188- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly