aboutsummaryrefslogtreecommitdiffstats
path: root/.claude/skills
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <tom@vanderlee.io>2026-09-17 11:05:45 +0200
committerGravatar Tom van der Lee <tom@vanderlee.io>2026-09-17 11:05:45 +0200
commitae3fa667bda75f11881c9209dc67226f98bcfd95 (patch)
tree1c2b16d8a97342fa608a15583ecc85ff0ec968eb /.claude/skills
downloaddesktop-flake-ae3fa667bda75f11881c9209dc67226f98bcfd95.tar.gz
desktop-flake-ae3fa667bda75f11881c9209dc67226f98bcfd95.tar.bz2
desktop-flake-ae3fa667bda75f11881c9209dc67226f98bcfd95.zip
Add cross-platform Nix flake bootstrap
Adds a flake providing shared modules for NixOS and standalone home-manager, a copyable NixOS host template, and the OpenSpec tooling/change scaffolding used to plan this work.
Diffstat (limited to '.claude/skills')
-rw-r--r--.claude/skills/openspec-apply-change/SKILL.md188
-rw-r--r--.claude/skills/openspec-archive-change/SKILL.md182
-rw-r--r--.claude/skills/openspec-explore/SKILL.md343
-rw-r--r--.claude/skills/openspec-propose/SKILL.md163
-rw-r--r--.claude/skills/openspec-sync-specs/SKILL.md262
-rw-r--r--.claude/skills/openspec-update-change/SKILL.md91
6 files changed, 1229 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
diff --git a/.claude/skills/openspec-archive-change/SKILL.md b/.claude/skills/openspec-archive-change/SKILL.md
new file mode 100644
index 0000000..7bd1363
--- /dev/null
+++ b/.claude/skills/openspec-archive-change/SKILL.md
@@ -0,0 +1,182 @@
1---
2name: openspec-archive-change
3description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
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
13Archive a completed change in the experimental workflow.
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`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
18
19**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
20
21**Steps**
22
231. **Select the change**
24
25 If a name is provided, use it. Otherwise:
26 - Infer from conversation context if the user mentioned a change
27 - Auto-select if only one active change exists
28 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
29
30 When prompting, show only active changes (not already archived).
31 Include the schema used for each change if available.
32
33 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
34
35 **Load current archive inputs before the existing archive checks:**
36
37 After resolving the selected change and planning root, run:
38 ```bash
39 openspec instructions archive --change "<name>" --json
40 ```
41 Keep the same selected-root flags on this command. This lookup is advisory and
42 optional: it only supplies extra prompt inputs, so it must never block archiving.
43 If it exits non-zero or returns invalid JSON — for example on an older CLI that
44 does not support this command yet — continue the archive workflow with no
45 context and no operation guidance. Do not report an error and do not stop.
46
47 A successful response may omit both optional fields. Treat `context` as a
48 required prompt-level input: read and consider it, and apply relevant project
49 facts, conventions, and constraints. Treat `operationGuidance` as optional
50 additive advice: read and consider every entry, and follow entries that are
51 applicable and compatible with the built-in archive workflow.
52
53 Keep both fields separate from built-in steps, explicit user choices, resolved
54 paths, CLI checks, and command contracts. If context conflicts with one of those
55 controlling inputs, report the conflict and preserve the controlling value. If
56 guidance is inapplicable or conflicts with a controlling input, do not follow it
57 and explain why. Do not infer replacement paths, skipped prompts, or flags from
58 either field, and do not copy their text verbatim into specs, change artifacts,
59 or archive summaries unless the user separately asks for it. These are
60 prompt-level behavior contracts, not enforceable checks.
61
622. **Check artifact completion status**
63
64 Run `openspec status --change "<name>" --json` to check artifact completion.
65
66 Parse the JSON to understand:
67 - `schemaName`: The workflow being used
68 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
69 - `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
70
71 **If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
72 - Display warning listing incomplete artifacts
73 - Ask the user to confirm they want to proceed
74 - Proceed if user confirms
75
763. **Check task completion status**
77
78 Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
79
80 Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
81
82 **If incomplete tasks found:**
83 - Display warning showing count of incomplete tasks
84 - Ask the user to confirm they want to proceed
85 - Proceed if user confirms
86
87 **If no tasks file exists:** Proceed without task-related warning.
88
894. **Assess delta spec sync state**
90
91 Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
92 delta-spec source. If the `specs` entry is missing or
93 `existingOutputPaths` is empty, proceed without a sync prompt and do not infer
94 delta specs from other artifacts.
95
96 **If delta specs exist:**
97 - Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
98 - Determine what changes would be applied (adds, modifications, removals, renames)
99 - Show a combined summary before prompting
100
101 **Prompt options:**
102 - If changes needed: "Sync now (recommended)", "Archive without syncing"
103 - If already synced: "Archive now", "Sync anyway", "Cancel"
104
105 Route on the answer:
106 - "Cancel" — stop, do not archive
107 - "Archive without syncing" or "Archive now" — proceed to archive
108 - "Sync now" or "Sync anyway" — sync, then verify (below)
109 - Anything else — ask again rather than archiving
110
111 Before a selected sync writes any main spec, run
112 `openspec instructions specs --change "<name>" --json` once with the same
113 selected-root flags. Require a zero exit status and valid artifact-instruction
114 JSON. If the lookup fails or returns invalid JSON, report the error and stop
115 before writing any main spec or moving the change. A valid response with omitted
116 `rules` is the no-rules case. Apply returned `rules` only to the content and
117 form of main specs produced by this merge; do not use them as archive guidance,
118 change CLI behavior, or copy the rule text into any output file.
119
120 Then run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
121
122 Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
123 - ADDED requirements present
124 - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
125 - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
126 - RENAMED requirements present under the new name and absent under the old one
127
128 If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
129
1305. **Perform the archive**
131
132 Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
133 ```bash
134 mkdir -p "<planningHome.changesDir>/archive"
135 ```
136
137 Generate the target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<change-name>`. Never stack a second date (same rule as `openspec archive`).
138
139 **Check if target already exists:**
140 - If yes: Fail with error, suggest renaming existing archive or using different date
141 - If no: Move `changeRoot` to the archive directory
142
143 ```bash
144 mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
145 ```
146
1476. **Display summary**
148
149 Show archive completion summary including:
150 - Change name
151 - Schema that was used
152 - Archive location
153 - Whether specs were synced (if applicable)
154 - Note about any warnings (incomplete artifacts/tasks)
155
156**Output On Success**
157
158```markdown
159## Archive Complete
160
161**Change:** <change-name>
162**Schema:** <schema-name>
163**Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
164**Specs:** <"✓ Synced to main specs" only if the step 4 verification passed; otherwise "No delta specs" or "Sync skipped">
165
166<"All artifacts complete. All tasks complete." — or, if archived with warnings, list them instead (e.g. "Archived with 2 incomplete tasks")>
167```
168
169**Guardrails**
170- Announce the selected change; prompt for selection when it is ambiguous
171- Use artifact graph (openspec status --json) for completion checking
172- Don't block archive on warnings - just inform and confirm
173- Preserve .openspec.yaml when moving to archive (it moves with the directory)
174- Show clear summary of what happened
175- If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven)
176- Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
177- If delta specs exist, always run the sync assessment and show the combined summary before prompting
178- Apply relevant runtime context and report conflicts; operation guidance remains advisory
179- Consider every guidance entry and explain any inapplicable or conflicting advice
180- Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
181- Artifact rules constrain only the specs being written and are never operation guidance
182- Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files
diff --git a/.claude/skills/openspec-explore/SKILL.md b/.claude/skills/openspec-explore/SKILL.md
new file mode 100644
index 0000000..a8fc549
--- /dev/null
+++ b/.claude/skills/openspec-explore/SKILL.md
@@ -0,0 +1,343 @@
1---
2name: openspec-explore
3description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
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
13Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
14
15**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, investigate the codebase, and run read-only commands or tools without confirmation, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create or update OpenSpec change artifacts (proposals, designs, specs) within a confirmed scope—that's capturing thinking, not implementing. Answering design or clarifying questions is never consent to write. Before the first write-capable action, name the artifacts or files you would change and what you would do, ask a direct yes/no question, and wait for the user's confirmation in a separate message. Confirmation covers only the scope you described; ask again before expanding it. For a new change, scaffold it first as described below.
16
17**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
18
19**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.
20
21---
22
23## The Stance
24
25- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
26- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
27- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
28- **Adaptive** - Follow interesting threads, pivot when new information emerges
29- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
30- **Grounded** - Explore the actual codebase when relevant, don't just theorize
31
32---
33
34## Planning a Change
35
36When the user is planning a change, guide them toward shared understanding with focused discovery questions. For open-ended discussion, follow the conversation without imposing an interview or a required output.
37
38Before asking a factual question, follow the context discovery below and inspect relevant OpenSpec artifacts, source, tests, docs, and configuration. Do not ask the user to repeat facts you can verify. Summarize relevant findings without reproducing private context or rules. If evidence is missing, conflicting, or inaccessible, state that limitation and ask only for the clarification needed to proceed.
39
40- **Follow dependencies** - Resolve the next blocking decision before its dependent details. For example, clarify the user's outcome and scope before choosing an API or data model. Revisit downstream assumptions when an earlier answer changes. Skip branches that do not matter to this goal.
41- **Keep questions focused** - Ask one focused question at a time, and briefly explain why it matters and which decision it unlocks. Batch questions only if the user asks for a batch; keep them small and group related decisions.
42- **Offer grounded recommendations** - When evidence supports a recommendation, state your preferred option and why it fits the user's goals, with alternatives and their tradeoffs when useful. Do not invent intent, priorities, or external constraints: ask the user when only they can answer. Avoid a fixed question format.
43- **Keep a conversational record** - Track decisions in the conversation, not in files. Separate confirmed decisions from proposed defaults and unresolved questions. Silence is not acceptance. Accepting an answer or a batch of recommendations is not permission to write. Keep file-write confirmation separate from discovery questions and follow the guardrails below.
44
45Stop asking when the user has enough clarity. Let them pause, pivot, or defer a decision; do not exhaust every branch or force a proposal.
46
47For example, after inspecting the relevant code:
48
49```text
50The CLI already uses SQLite and has no remote service. Is sharing state
51across devices in scope? That determines whether local storage is enough.
52If this stays a single-device tool, I recommend keeping SQLite to avoid
53adding a service to operate; shared state would need a separate sync design.
54```
55
56---
57
58## What You Might Do
59
60Depending on what the user brings, you might:
61
62**Explore the problem space**
63- Ask clarifying questions that emerge from what they said
64- Challenge assumptions
65- Reframe the problem
66- Find analogies
67
68**Investigate the codebase**
69- Map existing architecture relevant to the discussion
70- Find integration points
71- Identify patterns already in use
72- Surface hidden complexity
73
74**Compare options**
75- Brainstorm multiple approaches
76- Build comparison tables
77- Sketch tradeoffs
78- Recommend a path (if asked)
79
80**Visualize**
81```
82+------------------------------------------+
83| Use ASCII diagrams liberally |
84+------------------------------------------+
85| |
86| [State A] -------> [State B] |
87| | |
88| v |
89| [State C] |
90| |
91| System diagrams, state machines, |
92| data flows, architecture sketches, |
93| dependency graphs, comparison tables |
94| |
95+------------------------------------------+
96```
97
98**Draw with plain ASCII only** — borders `+` `-` `|`, arrows `-->` `<--` `^` `v`, markers `*` `x`.
99Unicode diagram glyphs can render at different widths across terminals, fonts, and locales, so padded boxes and aligned tables can drift. Keep every diagram character ASCII.
100
101**Surface risks and unknowns**
102- Identify what could go wrong
103- Find gaps in understanding
104- Suggest spikes or investigations
105
106---
107
108## OpenSpec Awareness
109
110You have full context of the OpenSpec system. Use it naturally, don't force it.
111
112### Check for context
113
114At the start, quickly check what exists:
115```bash
116openspec list --json
117```
118
119This tells you:
120- If there are active changes
121- Their names, schemas, and status
122- What the user might be working on
123
124That is the *change* list - work in flight. It does not include the project's durable capabilities, so list those too:
125```bash
126openspec list --specs
127```
128Add `--json` for ids and requirement counts, and append `--store "<id>"` only for a registered standalone store. This is the inventory of what the project already claims to do, and `openspec list` on its own never shows it. To look at one, run `openspec show "<spec-id>" --type spec --json --no-scenarios` (same `--store` rule) - it returns that capability's purpose and requirement texts without pulling the whole spec file into context, and `--type spec` stops a change of the same name from making it ambiguous.
129
130The filtered read is only an overview. Before deciding what is already covered or what should change, read each relevant spec in full, including scenarios, with `openspec show "<spec-id>" --type spec` (same `--store` rule).
131
132Then read the project's own context from the resolved root - `<root.path>/openspec/config.yaml` (or `config.yml`). Use the `root.path` returned above, and skip this if neither file exists:
133- `context`: project background - tech stack, conventions, constraints
134- `rules`: keyed by artifact id - the entries for an artifact apply only when you write that artifact
135
136Ground your thinking in these. They are constraints for you to follow, not content to reproduce: do NOT copy them into the conversation or into any artifact you create.
137
138### When no change exists
139
140Think freely. When insights crystallize, you might offer:
141
142- "This feels solid enough to start a change. Want me to create a proposal?"
143- Or keep exploring - no pressure to formalize
144
145If the user asks you to capture the exploration as a new change, transition seamlessly into the requested capture:
146
1471. Run `openspec new change "<name>"` (with `--store <id>` when applicable) before creating any artifacts. Never create a new change directory under `openspec/changes/` by hand; the CLI scaffold creates required metadata such as `.openspec.yaml`. Keep the selected `--store <id>` on every applicable follow-up `status` and `instructions` command.
1482. Run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store), then process the requested artifacts in dependency order. For each requested artifact that is `ready`, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store). Before creating a requested artifact, evaluate any condition in its own `instruction` against the explored change; record a deliberate skip instead when the condition does not apply. If a requested artifact is blocked by a direct prerequisite the user did not request, run `openspec instructions "<prerequisite-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) for that prerequisite whether it is `ready` or `blocked`. If its own `instruction` states a condition, evaluate that condition against the explored change and record a deliberate skip only when the condition does not apply. If the condition applies, or the prerequisite is not conditional, treat it as a normal prerequisite and ask before expanding the capture. Do not create an unrequested prerequisite unless the user approves.
1493. Follow the returned `template` and `instruction` fields. Read completed dependency files listed in `dependencies`, and apply `context` and `rules` as constraints without copying them into the artifact. If the instruction delegates creation to a specific skill or command, invoke it; otherwise write the artifact to `resolvedOutputPath`, using the instruction to choose a concrete path when it is a glob. Verify that the selected concrete output exists.
1504. After creating each artifact, re-run `openspec status --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) and continue until every requested artifact is `done`, `skipped`, or was deliberately skipped because its own `instruction` stated a condition that did not apply. Tell the user about a deliberate conditional skip, remember it, and do not reconsider it. Dependencies are enablers, not gates: if a requested artifact is still `blocked` only because you deliberately skipped a conditional prerequisite, run `openspec instructions "<artifact-id>" --change "<name>" --json` (append the confirmed `--store "<id>"` only for a registered standalone store) despite the blocked status, then create it using step 3 only when those recorded conditional skips are its sole missing dependencies. If a requested artifact is blocked by a prerequisite the user did not ask to capture and cannot be conditionally skipped, explain that dependency and ask before expanding the capture.
151
152Capture the artifact(s) the user requested without asking them to invoke another workflow command. If they asked only to start a change, stop after scaffolding and show its status.
153
154### When a change exists
155
156If the user mentions a change or you detect one is relevant:
157
1581. **Resolve and read existing artifacts for context**
159 - Run `openspec status --change "<name>" --json`.
160 - Use `changeRoot`, `artifactPaths`, and `actionContext` from the status JSON.
161 - Read existing files from `artifactPaths.<artifact>.existingOutputPaths`.
162
1632. **Reference them naturally in conversation**
164 - "Your design mentions using Redis, but we just realized SQLite fits better..."
165 - "The proposal scopes this to premium users, but we're now thinking everyone..."
166
1673. **Offer to capture when decisions are made**
168
169 `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
170
171 | Insight Type | Where to Capture |
172 |----------------------------|-------------------------------------|
173 | New requirement discovered | `specs/<capability-path>/spec.md` |
174 | Requirement changed | `specs/<capability-path>/spec.md` |
175 | Design decision made | `design.md` |
176 | Scope changed | `proposal.md` |
177 | New work identified | `tasks.md` |
178 | Assumption invalidated | Relevant artifact |
179
180 Example offers:
181 - "That's a design decision. Capture it in design.md?"
182 - "This is a new requirement. Add it to specs?"
183 - "This changes scope. Update the proposal?"
184
1854. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
186
187---
188
189## What You Don't Have To Do
190
191- Follow a script
192- Ask the same questions every time
193- Produce a specific artifact
194- Reach a conclusion
195- Stay on topic if a tangent is valuable
196- Be brief (this is thinking time)
197
198---
199
200## Handling Different Entry Points
201
202**User brings a vague idea:**
203```
204User: I'm thinking about adding real-time collaboration
205
206You: Real-time collab is a big space. Let me think about this...
207
208 COLLABORATION SPECTRUM
209 ============================================
210
211 Awareness Coordination Sync
212 | | |
213 v v v
214 +--------+ +--------+ +--------+
215 |Presence| |Cursors | | CRDT |
216 | "3 | | Multi | |Conflict|
217 |online" | | select | | free |
218 +--------+ +--------+ +--------+
219 | | |
220 trivial moderate complex
221
222 Where's your head at?
223```
224
225**User brings a specific problem:**
226```
227User: The auth system is a mess
228
229You: [reads codebase]
230
231 +---------------------------------------------+
232 | CURRENT AUTH FLOW |
233 +---------------------------------------------+
234 |
235 +-------------+-------------+
236 v v v
237 +---------+ +---------+ +---------+
238 | Google | | GitHub | | Email |
239 | OAuth | | OAuth | | Magic |
240 +----+----+ +----+----+ +----+----+
241 | | |
242 +-------------+-------------+
243 v
244 +-----------+
245 | Session |
246 +-----+-----+
247 |
248 v
249 +-----------+
250 | Perms |
251 +-----------+
252
253 I see three tangles. Which one's burning?
254```
255
256**User is stuck mid-implementation:**
257```
258User: /opsx:explore add-auth-system
259 The OAuth integration is more complex than expected
260
261You: [reads change artifacts]
262
263 You're on task 4: "Implement OAuth flow"
264
265 Let me trace what's involved...
266
267 [draws diagram, explores options, suggests paths]
268
269 Want to update the design to reflect this?
270 Or add a spike task to investigate?
271```
272
273**User wants to compare options:**
274```
275User: Should we use Postgres or SQLite?
276
277You: Generic answer is boring. What's the context?
278
279User: A CLI tool that tracks local dev environments
280
281You: That changes everything.
282
283 +-------------------------------------------------+
284 | CLI TOOL DATA STORAGE |
285 +-------------------------------------------------+
286
287 Key constraints:
288 - No daemon running
289 - Must work offline
290 - Single user
291
292 SQLite Postgres
293 Deployment embedded needs server
294 Offline yes no
295 Single file yes no
296
297 SQLite. Not even close.
298
299 Unless... is there a sync component?
300```
301
302---
303
304## Ending Discovery
305
306There's no required ending. Discovery might:
307
308- **Flow into a proposal**: "Ready to start? I can create a change proposal."
309- **Result in artifact updates**: "Updated design.md with these decisions"
310- **Just provide clarity**: User has what they need, moves on
311- **Continue later**: "We can pick this up anytime"
312
313When it feels like things are crystallizing, you might summarize:
314
315```
316## What We Figured Out
317
318**The problem**: [crystallized understanding]
319
320**The approach**: [if one emerged]
321
322**Open questions**: [if any remain]
323
324**Next steps** (if ready):
325- Create a change proposal
326- Keep exploring: just keep talking
327```
328
329But this summary is optional. Sometimes the thinking IS the value.
330
331---
332
333## Guardrails
334
335- **Don't implement** - Never write code or implement features. Workflow configuration counts too: creating or editing schemas, templates, or `openspec/config.yaml` is a change, not thinking. Creating or updating OpenSpec change artifacts within the confirmed scope is fine, writing anything else is not.
336- **Don't fake understanding** - If something is unclear, dig deeper
337- **Don't rush** - Discovery is thinking time, not task time
338- **Don't force structure** - Let patterns emerge naturally
339- **Don't auto-capture** - Offer to save insights, don't just do it. Read-only commands and tools need no confirmation. Before the first write-capable action—including `openspec new change` or another command that writes files—name the artifacts or files and proposed changes, ask a direct yes/no question, and wait for explicit confirmation in a separate user message. That confirmation covers only the described scope; ask again before expanding it. Answers to design or clarifying questions are never consent to write.
340- **Don't manually scaffold changes** - Never create a new change directory under `openspec/changes/` by hand. Always use `openspec new change "<name>"` (with `--store <id>` when applicable) so required metadata such as `.openspec.yaml` is created before writing artifacts.
341- **Do visualize** - A good diagram is worth many paragraphs
342- **Do explore the codebase** - Ground discussions in reality
343- **Do question assumptions** - Including the user's and your own
diff --git a/.claude/skills/openspec-propose/SKILL.md b/.claude/skills/openspec-propose/SKILL.md
new file mode 100644
index 0000000..20f2b5b
--- /dev/null
+++ b/.claude/skills/openspec-propose/SKILL.md
@@ -0,0 +1,163 @@
1---
2name: openspec-propose
3description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
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
13Propose a new change - create the change and generate all artifacts in one step.
14
15**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
16
17I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
18- proposal.md (what & why)
19- `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
20- design.md (how)
21- tasks.md (implementation steps)
22
23`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
24
25When the user is ready to implement, they must start the apply workflow explicitly.
26
27---
28
29**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.
30
31**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
32
33**Steps**
34
351. **Understand the request and clarify material ambiguity**
36
37 If no clear input is provided, ask the user (open-ended, no preset options):
38 > "What change do you want to work on? Describe what you want to build or fix."
39
40 From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
41
42 **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
43
44 If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
45
462. **Load project context**
47
48 Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files. Offer `openspec init` and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
49
50 Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
51
52 If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
53
54 Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
55
563. **Determine the workflow schema**
57
58 Use the configured default schema unless the user explicitly requests a different workflow.
59
60 **Use a different schema only if the user:**
61 - Explicitly requests a specific schema by name → use `--schema <schema-name>`
62 - Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
63
64 Otherwise, omit `--schema` to preserve the configured default.
65
664. **Create the change directory**
67
68 Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
69
70 Using the configured default:
71 ```bash
72 openspec new change "<name>"
73 ```
74
75 Using an explicitly requested schema:
76 ```bash
77 openspec new change "<name>" --schema "<schema-name>"
78 ```
79 This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
80
815. **Get the artifact build order**
82 ```bash
83 openspec status --change "<name>" --json
84 ```
85 Parse the JSON to get:
86 - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
87 - `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
88 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
89
906. **Create every artifact in the required set**
91
92 Use a todo list to track progress through the artifacts.
93
94 Loop through artifacts in dependency order (artifacts with no pending dependencies first):
95
96 a. **For each artifact that is `ready` (dependencies satisfied)**:
97 - Get instructions:
98 ```bash
99 openspec instructions <artifact-id> --change "<name>" --json
100 ```
101 - The instructions JSON includes:
102 - `context`: Project background (constraints for you - do NOT include in output)
103 - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
104 - `template`: The structure to use for your output file
105 - `instruction`: Schema-specific guidance for this artifact type
106 - `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
107 - `resolvedOutputPath`: Resolved path or pattern to write the artifact
108 - `dependencies`: Completed artifacts to read for context
109 - Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
110 - **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
111 - Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
112 - Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
113 - Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
114 - If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
115 - Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
116 - Apply `context` and `rules` as constraints - but do NOT copy them into the file
117 - Show brief progress: "Created <artifact-id>"
118
119 b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
120 - After creating each artifact, re-run `openspec status --change "<name>" --json`
121 - The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
122 - `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
123 - An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
124 - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
125 - Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
126 - Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
127 - Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
128
129 c. **If an artifact requires user input** (unclear context):
130 - Ask the user to clarify
131 - Then continue with creation
132
1337. **Show final status**
134 ```bash
135 openspec status --change "<name>"
136 ```
137
138**Output**
139
140After completing all artifacts, summarize:
141- Change name and location
142- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
143- What's ready: "All artifacts needed for implementation are ready."
144- Prompt: "The artifacts are ready for review. When you are ready, run `/opsx:apply` or ask me to apply this change."
145
146**Artifact Creation Guidelines**
147
148- Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
149- If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
150- The schema defines what each artifact should contain - follow it
151- Read dependency artifacts for context before creating new ones
152- Use `template` as the structure for your output file - fill in its sections
153- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
154 - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
155 - These guide what you write, but should never appear in the output
156
157**Guardrails**
158- The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
159- Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
160- Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
161- Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
162- If a change with that name already exists, ask if user wants to continue it or create a new one
163- Verify each artifact file exists after writing before proceeding to next
diff --git a/.claude/skills/openspec-sync-specs/SKILL.md b/.claude/skills/openspec-sync-specs/SKILL.md
new file mode 100644
index 0000000..730ea90
--- /dev/null
+++ b/.claude/skills/openspec-sync-specs/SKILL.md
@@ -0,0 +1,262 @@
1---
2name: openspec-sync-specs
3description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
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
13Sync delta specs from a change to main specs.
14
15This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
16
17**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.
18
19`<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
20
21**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
22
23**Steps**
24
251. **Select the change**
26
27 If a name is provided, use it. Otherwise:
28 - Infer from conversation context if the user mentioned a change
29 - Auto-select if only one active change exists
30 - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
31
32 When prompting, show changes that have delta specs (under `specs/` directory).
33
34 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
35
362. **Resolve change context**
37
38 Run:
39 ```bash
40 openspec status --change "<name>" --json
41 ```
42
43 The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
44
453. **Find delta specs**
46
47 Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
48 only source of delta spec paths. If the `specs` entry is missing or
49 `existingOutputPaths` is empty, report that there are no delta specs to sync,
50 do not infer them from other artifacts, and stop without requesting artifact
51 instructions or writing a main spec.
52
53 Sync every path in `existingOutputPaths` unless the caller narrowed the set.
54 A caller narrows it by naming an explicit list of complete entries from
55 `existingOutputPaths` — copy those absolute values verbatim. Archive does
56 this inline, and a user can too (for example, by selecting the entry ending
57 in `/specs/billing/invoices/spec.md`).
58 Then sync only the named paths and leave the remaining delta specs untouched:
59 bulk archive excludes a delta whose implementation it could not find, and
60 syncing it anyway would write a main spec the caller deliberately withheld.
61 Carry that narrowed selection through step 4; never widen it back to the full
62 list. If a named path is not in `existingOutputPaths`, do not sync it —
63 report it and stop, rather than dropping it silently. If the named list is
64 empty, report that there is nothing to sync and stop without writing a main
65 spec.
66
67 Each delta spec file contains sections like:
68 - `## ADDED Requirements` - New requirements to add
69 - `## MODIFIED Requirements` - Changes to existing requirements
70 - `## REMOVED Requirements` - Requirements to remove
71 - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
72
73 If no delta specs found, inform user and stop.
74
754. **For each delta spec, apply changes to main specs**
76
77 Before the first main-spec write, obtain one current specs-rule snapshot:
78 - If archive invoked this workflow inline and supplied a valid snapshot from
79 `openspec instructions specs --change "<name>" --json`, reuse it and do not
80 fetch the same instructions again.
81 - Otherwise run that command once now with the same selected-root flags.
82 - If the direct lookup exits non-zero or returns invalid artifact-instruction
83 JSON, report the error and stop before writing any main spec. Do not treat the
84 failure as an absent rule set.
85 - A valid response with omitted `rules` means no artifact rules are configured
86 and the existing semantic merge continues.
87
88 Apply returned `rules` only to the content and form of the main specs produced
89 by this merge. Artifact rules are not operation guidance and cannot change
90 selected roots, delta paths, CLI checks, or workflow steps. Use their text as
91 constraints without copying it verbatim into a main spec or summary.
92
93 For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
94
95 a. **Read the delta spec** to understand the intended changes
96
97 b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
98
99 c. **Apply changes intelligently**:
100
101 **ADDED Requirements:**
102 - If requirement doesn't exist in main spec → add it
103 - If requirement already exists → update it to match (treat as implicit MODIFIED)
104
105 **MODIFIED Requirements:**
106 - Find the requirement in main spec
107 - Apply the changes - this can be:
108 - Adding new scenarios the main spec does not have yet
109 - Modifying existing scenarios
110 - Changing the requirement description
111 - Preserve scenarios/content not mentioned in the delta
112
113 **REMOVED Requirements:**
114 - Remove the entire requirement block from main spec
115 - Retiring the capability. Delete the whole `spec.md` - and the directory once
116 nothing else is left in it - only when ALL of these hold:
117 1. removing the requirements *this run* left no requirement blocks;
118 2. the rest of the spec is well-formed (it still has a `## Purpose`);
119 3. the main spec was not already empty before this sync - if you removed
120 nothing, change nothing;
121 4. every other nonblank line in the whole file is accounted for as the
122 title, Purpose, Requirements header, or a canonical requirement's
123 statement, scenarios, or fenced examples;
124 5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
125 6. the `spec.md` resolves inside the real specs root (do not follow a
126 capability-directory symlink to delete an external file).
127 If removing the selected requirements would leave no requirement blocks and
128 any retirement condition is not satisfied, do not modify the main spec. Stop
129 the sync for that capability, report the blocking condition, and tell the user
130 how to resolve it. Never write or leave an empty `## Requirements` section.
131 When only the marker is missing, say that too - it is the one thing the user
132 can add to make the retirement go through.
133 - Deleting the file also deletes its `## Purpose`; any other section blocks
134 retirement. Name Purpose when you report the retirement. Include a pasteable
135 `git checkout` only when the spec lived in the caller's checkout;
136 otherwise give checkout-scoped recovery guidance.
137
138 **RENAMED Requirements:**
139 - Find the FROM requirement, rename to TO
140
141 **`## Purpose` in the delta:**
142 - The main spec already has one and it is authoritative - leave it alone
143 (this is what `openspec archive` does; it warns and moves on)
144
145 d. **Create new main spec** if capability doesn't exist yet:
146 - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
147 - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
148 (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
149 - Add Requirements section with the ADDED requirements
150 - Follow the **Main Spec Format Reference** below
151
1525. **Validate updated main specs**
153
154 Run `openspec validate --specs` with the same selected-root flags used earlier.
155 If validation fails, report the problems and do not claim the sync succeeded.
156
1576. **Show summary**
158
159 After applying all changes, summarize:
160 - Which capabilities were updated
161 - What changes were made (requirements added/modified/removed/renamed)
162 - Any new main spec left with a TBD Purpose placeholder, so it gets written
163 now rather than lingering
164 - Any capability retired, naming the deleted `spec.md`, its Purpose, and
165 either a pasteable `git checkout` or checkout-scoped recovery guidance
166
167**Delta Spec Format Reference**
168
169```markdown
170## Purpose
171
172Only on a delta that introduces a brand-new capability. Seeds the new main spec.
173
174## ADDED Requirements
175
176### Requirement: New Feature
177The system SHALL do something new.
178
179#### Scenario: Basic case
180- **WHEN** user does X
181- **THEN** system does Y
182
183## MODIFIED Requirements
184
185### Requirement: Existing Feature
186The system SHALL keep doing the existing thing, now also handling A.
187
188#### Scenario: Scenario the main spec already has
189- **WHEN** user does X
190- **THEN** system does Y
191
192#### Scenario: New scenario to add
193- **WHEN** user does A
194- **THEN** system does B
195
196## REMOVED Requirements
197
198### Requirement: Deprecated Feature
199
200## RENAMED Requirements
201
202- FROM: `### Requirement: Old Name`
203- TO: `### Requirement: New Name`
204```
205
206**Main Spec Format Reference**
207
208Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
209
210```markdown
211# <capability> Specification
212
213## Purpose
214Short description of what this capability does and why it exists.
215
216## Requirements
217
218### Requirement: New Feature
219The system SHALL do something new.
220
221#### Scenario: Basic case
222- **WHEN** user does X
223- **THEN** system does Y
224```
225
226**Key Principle: Intelligent Merging**
227
228Unlike programmatic merging, you merge rather than overwrite:
229- A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
230- Keep anything the delta does not mention, in the main spec's existing order
231- Use your judgment to merge changes sensibly
232
233**Output On Success**
234
235```markdown
236## Specs Synced: <change-name>
237
238Updated main specs:
239
240**<capability-1>**:
241- Added requirement: "New Feature"
242- Modified requirement: "Existing Feature" (added 1 scenario)
243
244**<capability-2>**:
245- Created new spec file
246- Added requirement: "Another Feature"
247
248Main specs are now updated. The change remains active - archive when implementation is complete.
249```
250
251**Guardrails**
252- Read both delta and main specs before making changes
253- Preserve existing content not mentioned in delta
254- Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
255- If something is unclear, ask for clarification
256- Show what you're changing as you go
257- The operation should be idempotent - running twice should give same result
258- Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
259- Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
260- Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
261- Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
262- Artifact rules constrain only the specs being written and are never copied into output files
diff --git a/.claude/skills/openspec-update-change/SKILL.md b/.claude/skills/openspec-update-change/SKILL.md
new file mode 100644
index 0000000..64e764f
--- /dev/null
+++ b/.claude/skills/openspec-update-change/SKILL.md
@@ -0,0 +1,91 @@
1---
2name: openspec-update-change
3description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
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
13Revise a change's existing planning artifacts and keep them coherent. Never edit code.
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. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
18
19`/opsx:continue` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
20
21**Steps**
22
231. **Select the change**
24
25 If a name is provided, use it. Otherwise:
26 - Infer from conversation context if the user mentioned a change
27 - Auto-select if only one active change exists
28 - If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
29
30 When prompting, present the top 3-4 most recently modified changes as options, showing:
31 - Change name
32 - Schema (from `schema` field if present, otherwise "spec-driven")
33 - Status (e.g., "0/5 tasks", "complete", "no tasks")
34 - How recently it was modified (from `lastModified` field)
35
36 Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
37
38 Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
39
402. **Get the change's artifacts**
41 ```bash
42 openspec status --change "<name>" --json
43 ```
44 Parse the JSON to understand current state. The response includes:
45 - `schemaName`: The workflow schema being used (e.g., "spec-driven")
46 - `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
47 - `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
48 - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
49
50 The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
51
52 The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
53
543. **Understand the request**
55 - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
56 - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
57
584. **Read and reconcile**
59 - Read the artifact(s) the request touches and the change's other existing artifacts.
60 - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
61 - Note everything that is now inconsistent, missing, or contradictory.
62 - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/opsx:continue` to create them.
63 - If the change is already coherent, say so and make no edits.
64
655. **Confirm and apply, one artifact at a time**
66 - Show each proposed revision and why. Write only after the user confirms.
67 - If the user rejects a revision, do not write it - leave that artifact unchanged.
68 - When a substantial rewrite is needed, get that artifact's rules and template first:
69 ```bash
70 openspec instructions "<artifact-id>" --change "<name>" --json
71 ```
72
736. **Point to the next step (guidance only - NEVER act on it)**
74 - Artifacts still missing -> suggest `/opsx:continue` to create them.
75 - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
76 - Everything done and implemented -> suggest `/opsx:archive`.
77
78**Output**
79
80After each invocation, show:
81- Which artifacts were revised (and which proposed revisions were rejected)
82- Anything deferred to `/opsx:continue` (not-yet-created artifacts or files)
83- Where the change stands and the recommended next command
84
85**Guardrails**
86- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
87- Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
88- Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
89- Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/opsx:continue`'s job.
90- Confirm every edit with the user before writing.
91- If the request changes the change's *intent* rather than refining it, first verify whether the optional `/opsx:new` workflow is available. If it is, recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.