@jspg-ai/coding-bb 0.0.3-beta.6 → 0.0.3-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/cbb/lib/install/init.js +60 -23
  2. package/cbb/lib/openspec/index.js +337 -554
  3. package/cbb/lib/superpowers/index.js +246 -265
  4. package/cbb/lib/utils/tar.js +92 -0
  5. package/cbb/lib/utils/upstream.js +90 -0
  6. package/config/upstream-mirrors.json +12 -0
  7. package/openspec/.version +2 -3
  8. package/openspec/commands/apply.md +189 -175
  9. package/openspec/commands/archive.md +237 -216
  10. package/openspec/commands/bulk-archive.md +355 -327
  11. package/openspec/commands/continue.md +116 -105
  12. package/openspec/commands/explore.md +230 -199
  13. package/openspec/commands/ff.md +115 -104
  14. package/openspec/commands/new.md +74 -63
  15. package/openspec/commands/onboard.md +557 -548
  16. package/openspec/commands/propose.md +161 -150
  17. package/openspec/commands/sync.md +277 -249
  18. package/openspec/commands/update.md +92 -80
  19. package/openspec/commands/verify.md +175 -162
  20. package/openspec/skills/openspec-apply-change/SKILL.md +20 -5
  21. package/openspec/skills/openspec-archive-change/SKILL.md +30 -8
  22. package/openspec/skills/openspec-bulk-archive-change/SKILL.md +36 -6
  23. package/openspec/skills/openspec-continue-change/SKILL.md +14 -2
  24. package/openspec/skills/openspec-explore/SKILL.md +21 -9
  25. package/openspec/skills/openspec-ff-change/SKILL.md +14 -2
  26. package/openspec/skills/openspec-new-change/SKILL.md +13 -1
  27. package/openspec/skills/openspec-onboard/SKILL.md +49 -39
  28. package/openspec/skills/openspec-propose/SKILL.md +15 -3
  29. package/openspec/skills/openspec-sync-specs/SKILL.md +31 -2
  30. package/openspec/skills/openspec-update-change/SKILL.md +27 -14
  31. package/openspec/skills/openspec-verify-change/SKILL.md +17 -3
  32. package/package.json +1 -1
  33. package/superpowers/.version +4 -4
  34. package/superpowers/skills/brainstorming/SKILL.md +47 -12
  35. package/superpowers/skills/brainstorming/scripts/frame-template.html +213 -213
  36. package/superpowers/skills/brainstorming/scripts/server.cjs +723 -723
  37. package/superpowers/skills/brainstorming/visual-companion.md +6 -6
  38. package/superpowers/skills/diagnosing-superpowers/SKILL.md +120 -0
  39. package/superpowers/skills/diagnosing-superpowers/prompts/analyst-common.md +38 -0
  40. package/superpowers/skills/diagnosing-superpowers/prompts/cost-and-time.md +28 -0
  41. package/superpowers/skills/diagnosing-superpowers/prompts/plan-adherence.md +29 -0
  42. package/superpowers/skills/diagnosing-superpowers/prompts/quality-evidence.md +26 -0
  43. package/superpowers/skills/diagnosing-superpowers/prompts/repeated-work.md +30 -0
  44. package/superpowers/skills/diagnosing-superpowers/prompts/request-conflicts.md +20 -0
  45. package/superpowers/skills/diagnosing-superpowers/prompts/scrub-audit.md +33 -0
  46. package/superpowers/skills/diagnosing-superpowers/prompts/scrub.md +29 -0
  47. package/superpowers/skills/diagnosing-superpowers/prompts/similar-session.md +38 -0
  48. package/superpowers/skills/diagnosing-superpowers/prompts/skill-timeline.md +30 -0
  49. package/superpowers/skills/diagnosing-superpowers/prompts/stumbles.md +28 -0
  50. package/superpowers/skills/diagnosing-superpowers/references/context-safety.md +22 -0
  51. package/superpowers/skills/diagnosing-superpowers/references/github-issues.md +47 -0
  52. package/superpowers/skills/diagnosing-superpowers/references/redaction-policy.md +34 -0
  53. package/superpowers/skills/diagnosing-superpowers/references/session-discovery.md +31 -0
  54. package/superpowers/skills/diagnosing-superpowers/templates/bundle-README.md +77 -0
  55. package/superpowers/skills/diagnosing-superpowers/templates/case.md +64 -0
  56. package/superpowers/skills/diagnosing-superpowers/templates/issue.md +51 -0
  57. package/superpowers/skills/diagnosing-superpowers/templates/report.md +82 -0
  58. package/superpowers/skills/executing-plans/SKILL.md +350 -41
  59. package/superpowers/skills/executing-plans/scripts/task-done +52 -0
  60. package/superpowers/skills/executing-plans/scripts/task-start +28 -0
  61. package/superpowers/skills/requesting-code-review/SKILL.md +1 -1
  62. package/superpowers/skills/requesting-code-review/code-reviewer.md +17 -0
  63. package/superpowers/skills/subagent-driven-development/SKILL.md +18 -18
  64. package/superpowers/skills/subagent-driven-development/re-review-prompt.md +1 -1
  65. package/superpowers/skills/subagent-driven-development/scripts/review-package +53 -46
  66. package/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +82 -40
  67. package/superpowers/skills/subagent-driven-development/scripts/task-brief +43 -41
  68. package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +2 -2
  69. package/superpowers/skills/systematic-debugging/root-cause-tracing.md +1 -1
  70. package/superpowers/skills/test-driven-development/SKILL.md +10 -0
  71. package/superpowers/skills/using-superpowers/SKILL.md +2 -0
  72. package/superpowers/skills/using-superpowers/references/claude-code-tools.md +29 -0
  73. package/superpowers/skills/using-superpowers/references/muse-tools.md +35 -0
  74. package/superpowers/skills/writing-plans/SKILL.md +30 -9
  75. package/superpowers/skills/writing-skills/SKILL.md +4 -2
  76. package/superpowers/skills/writing-skills/graphviz-conventions.dot +171 -171
@@ -4,552 +4,561 @@ description: Guided onboarding - walk through a complete OpenSpec workflow cycle
4
4
  category: Workflow
5
5
  tags: [workflow, onboarding, tutorial, learning]
6
6
  ---
7
- Guide the user through their first complete OpenSpec workflow cycle. This is a teaching experience—you'll do real work in their codebase while explaining each step.
8
-
9
- **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`). 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.
10
-
11
- ---
12
-
13
- ## Preflight
14
-
15
- Before starting, check if the OpenSpec CLI is installed:
16
-
17
- ```bash
18
- # Unix/macOS
19
- openspec --version 2>&1 || echo "CLI_NOT_INSTALLED"
20
- # Windows (PowerShell)
21
- # if (Get-Command openspec -ErrorAction SilentlyContinue) { openspec --version } else { echo "CLI_NOT_INSTALLED" }
22
- ```
23
-
24
- **If CLI not installed:**
25
- > OpenSpec CLI is not installed. Install it first, then come back to `/opsx:onboard`.
26
-
27
- Stop here if not installed.
28
-
29
- ---
30
-
31
- ## Phase 1: Welcome
32
-
33
- Display:
34
-
35
- ```
36
- ## Welcome to OpenSpec!
37
-
38
- I'll walk you through a complete change cycle—from idea to implementation—using a real task in your codebase. Along the way, you'll learn the workflow by doing it.
39
-
40
- **What we'll do:**
41
- 1. Pick a small, real task in your codebase
42
- 2. Explore the problem briefly
43
- 3. Create a change (the container for our work)
44
- 4. Build the artifacts: proposal → specs → design → tasks
45
- 5. Implement the tasks
46
- 6. Archive the completed change
47
-
48
- **Time:** ~15-20 minutes
49
-
50
- Let's start by finding something to work on.
51
- ```
52
-
53
- ---
54
-
55
- ## Phase 2: Task Selection
56
-
57
- ### Codebase Analysis
58
-
59
- Scan the codebase for small improvement opportunities. Look for:
60
-
61
- 1. **TODO/FIXME comments** - Search for `TODO`, `FIXME`, `HACK`, `XXX` in code files
62
- 2. **Missing error handling** - `catch` blocks that swallow errors, risky operations without try-catch
63
- 3. **Functions without tests** - Cross-reference `src/` with test directories
64
- 4. **Type issues** - `any` types in TypeScript files (`: any`, `as any`)
65
- 5. **Debug artifacts** - `console.log`, `console.debug`, `debugger` statements in non-debug code
66
- 6. **Missing validation** - User input handlers without validation
67
-
68
- Also check recent git activity:
69
- ```bash
70
- # Unix/macOS
71
- git log --oneline -10 2>/dev/null || echo "No git history"
72
- # Windows (PowerShell)
73
- # git log --oneline -10 2>$null; if ($LASTEXITCODE -ne 0) { echo "No git history" }
74
- ```
75
-
76
- ### Present Suggestions
77
-
78
- From your analysis, present 3-4 specific suggestions:
79
-
80
- ```
81
- ## Task Suggestions
82
-
83
- Based on scanning your codebase, here are some good starter tasks:
84
-
85
- **1. [Most promising task]**
86
- Location: `src/path/to/file.ts:42`
87
- Scope: ~1-2 files, ~20-30 lines
88
- Why it's good: [brief reason]
89
-
90
- **2. [Second task]**
91
- Location: `src/another/file.ts`
92
- Scope: ~1 file, ~15 lines
93
- Why it's good: [brief reason]
94
-
95
- **3. [Third task]**
96
- Location: [location]
97
- Scope: [estimate]
98
- Why it's good: [brief reason]
99
-
100
- **4. Something else?**
101
- Tell me what you'd like to work on.
102
-
103
- Which task interests you? (Pick a number or describe your own)
104
- ```
105
-
106
- **If nothing found:** Fall back to asking what the user wants to build:
107
- > I didn't find obvious quick wins in your codebase. What's something small you've been meaning to add or fix?
108
-
109
- ### Scope Guardrail
110
-
111
- If the user picks or describes something too large (major feature, multi-day work):
112
-
113
- ```
114
- That's a valuable task, but it's probably larger than ideal for your first OpenSpec run-through.
115
-
116
- For learning the workflow, smaller is better—it lets you see the full cycle without getting stuck in implementation details.
117
-
118
- **Options:**
119
- 1. **Slice it smaller** - What's the smallest useful piece of [their task]? Maybe just [specific slice]?
120
- 2. **Pick something else** - One of the other suggestions, or a different small task?
121
- 3. **Do it anyway** - If you really want to tackle this, we can. Just know it'll take longer.
122
-
123
- What would you prefer?
124
- ```
125
-
126
- Let the user override if they insist—this is a soft guardrail.
127
-
128
- ---
129
-
130
- ## Phase 3: Explore Demo
131
-
132
- Once a task is selected, briefly demonstrate explore mode:
133
-
134
- ```
135
- Before we create a change, let me quickly show you **explore mode**—it's how you think through problems before committing to a direction.
136
- ```
137
-
138
- Spend 1-2 minutes investigating the relevant code:
139
- - Read the file(s) involved
140
- - Draw a quick ASCII diagram if it helps
141
- - Note any considerations
142
-
143
- ```
144
- ## Quick Exploration
145
-
146
- [Your brief analysis—what you found, any considerations]
147
-
148
- ┌─────────────────────────────────────────┐
149
- │ [Optional: ASCII diagram if helpful] │
150
- └─────────────────────────────────────────┘
151
-
152
- Explore mode (`/opsx:explore`) is for this kind of thinking—investigating before implementing. You can use it anytime you need to think through a problem.
153
-
154
- Now let's create a change to hold our work.
155
- ```
156
-
157
- **PAUSE** - Wait for user acknowledgment before proceeding.
158
-
159
- ---
160
-
161
- ## Phase 4: Create the Change
162
-
163
- **EXPLAIN:**
164
- ```
165
- ## Creating a Change
166
-
167
- A "change" in OpenSpec is a container for all the thinking and planning around a piece of work. It lives at the `changeRoot` reported by `openspec status --change "<name>" --json` and holds your artifacts—proposal, specs, design, tasks.
168
-
169
- Let me create one for our task.
170
- ```
171
-
172
- **DO:** Create the change with a derived kebab-case name:
173
- ```bash
174
- openspec new change "<derived-name>"
175
- ```
176
-
177
- **SHOW:**
178
- ```
179
- Created: <changeRoot from status JSON>
180
-
181
- The folder structure:
182
- ```
183
- <changeRoot>/
184
- ├── proposal.md ← Why we're doing this (empty, we'll fill it)
185
- ├── design.md ← How we'll build it (empty)
186
- ├── specs/ ← Detailed requirements (empty)
187
- └── tasks.md ← Implementation checklist (empty)
188
- ```
189
-
190
- Now let's fill in the first artifact—the proposal.
191
- ```
192
-
193
- ---
194
-
195
- ## Phase 5: Proposal
196
-
197
- **EXPLAIN:**
198
- ```
199
- ## The Proposal
200
-
201
- The proposal captures **why** we're making this change and **what** it involves at a high level. It's the "elevator pitch" for the work.
202
-
203
- I'll draft one based on our task.
204
- ```
205
-
206
- **DO:** Draft the proposal content (don't save yet):
207
-
208
- `<capability-path>` is the spec directory relative to `specs/` (for example,
209
- `user-auth` or `identity/user-auth`). Use the exact existing path for modified
210
- capabilities. For new capabilities, follow the project's established spec
211
- organization.
212
-
213
- ```
214
- Here's a draft proposal:
215
-
216
- ---
217
-
218
- ## Why
219
-
220
- [1-2 sentences explaining the problem/opportunity]
221
-
222
- ## What Changes
223
-
224
- [Bullet points of what will be different]
225
-
226
- ## Capabilities
227
-
228
- ### New Capabilities
229
- - `<capability-path>`: [brief description]
230
-
231
- ### Modified Capabilities
232
- <!-- If modifying existing behavior -->
233
- - `<existing-capability-path>`: [brief description]
234
-
235
- ## Impact
236
-
237
- - `src/path/to/file.ts`: [what changes]
238
- - [other files if applicable]
239
-
240
- ---
241
-
242
- Does this capture the intent? I can adjust before we save it.
243
- ```
244
-
245
- **PAUSE** - Wait for user approval/feedback.
246
-
247
- After approval, save the proposal:
248
- ```bash
249
- openspec instructions proposal --change "<name>" --json
250
- ```
251
- Then write the content to the `resolvedOutputPath` from `openspec instructions proposal --change "<name>" --json`.
252
-
253
- ```
254
- Proposal saved. This is your "why" document—you can always come back and refine it as understanding evolves.
255
-
256
- Next up: specs.
257
- ```
258
-
259
- ---
260
-
261
- ## Phase 6: Specs
262
-
263
- **EXPLAIN:**
264
- ```
265
- ## Specs
266
-
267
- Specs define **what** we're building in precise, testable terms. They use a requirement/scenario format that makes expected behavior crystal clear.
268
-
269
- For a small task like this, we might only need one spec file.
270
- ```
271
-
272
- **DO:** Resolve where the spec file should be created:
273
- ```bash
274
- openspec instructions specs --change "<name>" --json
275
- # Use resolvedOutputPath from the JSON. If it is a glob, choose the concrete file path using the schema instruction and the change's context.
276
- ```
277
-
278
- Draft the spec content:
279
-
280
- ```
281
- Here's the spec:
282
-
283
- ---
284
-
285
- ## ADDED Requirements
286
-
287
- ### Requirement: <Name>
288
-
289
- <Description of what the system should do>
290
-
291
- #### Scenario: <Scenario name>
292
-
293
- - **WHEN** <trigger condition>
294
- - **THEN** <expected outcome>
295
- - **AND** <additional outcome if needed>
296
-
297
- ---
298
-
299
- This format—WHEN/THEN/AND—makes requirements testable. You can literally read them as test cases.
300
- ```
301
-
302
- Save to the concrete file path chosen from `resolvedOutputPath`.
303
-
304
- ---
305
-
306
- ## Phase 7: Design
307
-
308
- **EXPLAIN:**
309
- ```
310
- ## Design
311
-
312
- The design captures **how** we'll build it—technical decisions, tradeoffs, approach.
313
-
314
- For small changes, this might be brief. That's fine—not every change needs deep design discussion.
315
- ```
316
-
317
- **DO:** Draft design.md:
318
-
319
- ```
320
- Here's the design:
321
-
322
- ---
323
-
324
- ## Context
325
-
326
- [Brief context about the current state]
327
-
328
- ## Goals / Non-Goals
329
-
330
- **Goals:**
331
- - [What we're trying to achieve]
332
-
333
- **Non-Goals:**
334
- - [What's explicitly out of scope]
335
-
336
- ## Decisions
337
-
338
- ### Decision 1: [Key decision]
339
-
340
- [Explanation of approach and rationale]
341
-
342
- ---
343
-
344
- For a small task, this captures the key decisions without over-engineering.
345
- ```
346
-
347
- Save to the `resolvedOutputPath` from `openspec instructions design --change "<name>" --json`.
348
-
349
- ---
350
-
351
- ## Phase 8: Tasks
352
-
353
- **EXPLAIN:**
354
- ```
355
- ## Tasks
356
-
357
- Finally, we break the work into implementation tasks—checkboxes that drive the apply phase.
358
-
359
- These should be small, clear, and in logical order.
360
- ```
361
-
362
- **DO:** Generate tasks based on specs and design:
363
-
364
- ```
365
- Here are the implementation tasks:
366
-
367
- ---
368
-
369
- ## 1. [Category or file]
370
-
371
- - [ ] 1.1 [Specific task] — verify: [test, command, observable behavior, or delivered artifact]
372
- - [ ] 1.2 [Specific task] — verify: [test, command, observable behavior, or delivered artifact]
373
-
374
- ## 2. Integration Verification
375
-
376
- - [ ] 2.1 Verify [broader integration or system behavior] with [end-to-end test or observable result]
377
-
378
- ---
379
-
380
- Each checkbox becomes a unit of work in the apply phase. Ready to implement?
381
- ```
382
-
383
- **PAUSE** - Wait for user to confirm they're ready to implement.
384
-
385
- Save to the `resolvedOutputPath` from `openspec instructions tasks --change "<name>" --json`.
386
-
387
- ---
388
-
389
- ## Phase 9: Apply (Implementation)
390
-
391
- **EXPLAIN:**
392
- ```
393
- ## Implementation
394
-
395
- Now we implement each task, checking them off as we go. I'll announce each one and occasionally note how the specs/design informed the approach.
396
- ```
397
-
398
- **DO:** For each task:
399
-
400
- 1. Announce: "Working on task N: [description]"
401
- 2. Implement the change in the codebase
402
- 3. Reference specs/design naturally: "The spec says X, so I'm doing Y"
403
- 4. Mark complete in tasks.md: `- [ ]` → `- [x]`
404
- 5. Brief status: "✓ Task N complete"
405
-
406
- Keep narration light—don't over-explain every line of code.
407
-
408
- After all tasks:
409
-
410
- ```
411
- ## Implementation Complete
412
-
413
- All tasks done:
414
- - [x] Task 1
415
- - [x] Task 2
416
- - [x] ...
417
-
418
- The change is implemented! One more step—let's archive it.
419
- ```
420
-
421
- ---
422
-
423
- ## Phase 10: Archive
424
-
425
- **EXPLAIN:**
426
- ```
427
- ## Archiving
428
-
429
- When a change is complete, we archive it. The archive path is derived from `planningHome.changesDir` and the date.
430
-
431
- Archived changes become your project's decision history—you can always find them later to understand why something was built a certain way.
432
- ```
433
-
434
- **DO:** Archive the change (`--yes` answers the confirmation prompts, which you cannot answer from a tool call):
435
- ```bash
436
- openspec archive "<name>" --yes
437
- ```
438
-
439
- **SHOW:**
440
- ```
441
- Archived to: `<planningHome.changesDir>/archive/<target-name>/` (the target name prepends today's date, unless the name already starts with a `YYYY-MM-DD-` prefix — then it is kept as-is, no second date)
442
-
443
- The change is now part of your project's history. The code is in your codebase, the decision record is preserved.
444
- ```
445
-
446
- ---
447
-
448
- ## Phase 11: Recap & Next Steps
449
-
450
- ```
451
- ## Congratulations!
452
-
453
- You just completed a full OpenSpec cycle:
454
-
455
- 1. **Explore** - Thought through the problem
456
- 2. **New** - Created a change container
457
- 3. **Proposal** - Captured WHY
458
- 4. **Specs** - Defined WHAT in detail
459
- 5. **Design** - Decided HOW
460
- 6. **Tasks** - Broke it into steps
461
- 7. **Apply** - Implemented the work
462
- 8. **Archive** - Preserved the record
463
-
464
- This same rhythm works for any size change—a small fix or a major feature.
465
-
466
- ---
467
-
468
- ## Command Reference
469
-
470
- **Core workflow:**
471
-
472
- | Command | What it does |
473
- |-------------------|--------------------------------------------|
474
- | `/opsx:propose` | Create a change and generate all artifacts |
475
- | `/opsx:explore` | Think through problems before/during work |
476
- | `/opsx:apply` | Implement tasks from a change |
477
- | `/opsx:archive` | Archive a completed change |
478
-
479
- **Additional commands** (only if installed - availability depends on your profile):
480
-
481
- | Command | What it does |
482
- |--------------------|----------------------------------------------------------|
483
- | `/opsx:new` | Start a new change, step through artifacts one at a time |
484
- | `/opsx:continue` | Continue working on an existing change |
485
- | `/opsx:ff` | Fast-forward: create all artifacts at once |
486
- | `/opsx:verify` | Verify implementation matches artifacts |
487
-
488
- ---
489
-
490
- ## What's Next?
491
-
492
- Try `/opsx:propose` on something you actually want to build. You've got the rhythm now!
493
- ```
494
-
495
- ---
496
-
497
- ## Graceful Exit Handling
498
-
499
- ### User wants to stop mid-way
500
-
501
- If the user says they need to stop, want to pause, or seem disengaged:
502
-
503
- ```
504
- No problem! Your change is saved at the `changeRoot` reported by `openspec status --change "<name>" --json`.
505
-
506
- To pick up where we left off later:
507
- - `/opsx:continue <name>` - Resume artifact creation (if installed; otherwise `openspec status --change "<name>" --json` shows the next artifact)
508
- - `/opsx:apply <name>` - Jump to implementation (if tasks exist)
509
-
510
- The work won't be lost. Come back whenever you're ready.
511
- ```
512
-
513
- Exit gracefully without pressure.
514
-
515
- ### User just wants command reference
516
-
517
- If the user says they just want to see the commands or skip the tutorial:
518
-
519
- ```
520
- ## OpenSpec Quick Reference
521
-
522
- **Core workflow:**
523
-
524
- | Command | What it does |
525
- |--------------------------|--------------------------------------------|
526
- | `/opsx:propose <name>` | Create a change and generate all artifacts |
527
- | `/opsx:explore` | Think through problems (no code changes) |
528
- | `/opsx:apply <name>` | Implement tasks |
529
- | `/opsx:archive <name>` | Archive when done |
530
-
531
- **Additional commands** (only if installed - availability depends on your profile):
532
-
533
- | Command | What it does |
534
- |---------------------------|-------------------------------------|
535
- | `/opsx:new <name>` | Start a new change, step by step |
536
- | `/opsx:continue <name>` | Continue an existing change |
537
- | `/opsx:ff <name>` | Fast-forward: all artifacts at once |
538
- | `/opsx:verify <name>` | Verify implementation |
539
-
540
- Try `/opsx:propose` to start your first change.
541
- ```
542
-
543
- Exit gracefully.
544
-
545
- ---
546
-
547
- ## Guardrails
548
-
549
- - **Follow the EXPLAIN DO → SHOW → PAUSE pattern** at key transitions (after explore, after proposal draft, after tasks, after archive)
550
- - **Keep narration light** during implementation—teach without lecturing
551
- - **Don't skip phases** even if the change is small—the goal is teaching the workflow
552
- - **Pause for acknowledgment** at marked points, but don't over-pause
553
- - **Handle exits gracefully**—never pressure the user to continue
554
- - **Use real codebase tasks**—don't simulate or use fake examples
7
+ Guide the user through their first complete OpenSpec workflow cycle. This is a teaching experience—you'll do real work in their codebase while explaining each step.
8
+
9
+ **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.
10
+
11
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
12
+
13
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
14
+
15
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
16
+
17
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
18
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
19
+
20
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
21
+
22
+ ---
23
+
24
+ ## Preflight
25
+
26
+ Before starting, check if the OpenSpec CLI is installed:
27
+
28
+ ```bash
29
+ # Unix/macOS
30
+ openspec --version 2>&1 || echo "CLI_NOT_INSTALLED"
31
+ # Windows (PowerShell)
32
+ # if (Get-Command openspec -ErrorAction SilentlyContinue) { openspec --version } else { echo "CLI_NOT_INSTALLED" }
33
+ ```
34
+
35
+ **If CLI not installed:**
36
+ > OpenSpec CLI is not installed. Install it first, then come back to `/opsx:onboard`.
37
+
38
+ Stop here if not installed.
39
+
40
+ ---
41
+
42
+ ## Phase 1: Welcome
43
+
44
+ Display:
45
+
46
+ ```
47
+ ## Welcome to OpenSpec!
48
+
49
+ I'll walk you through a complete change cycle—from idea to implementation—using a real task in your codebase. Along the way, you'll learn the workflow by doing it.
50
+
51
+ **What we'll do:**
52
+ 1. Pick a small, real task in your codebase
53
+ 2. Explore the problem briefly
54
+ 3. Create a change (the container for our work)
55
+ 4. Build the artifacts: proposal → specs → design → tasks
56
+ 5. Implement the tasks
57
+ 6. Archive the completed change
58
+
59
+ **Time:** ~15-20 minutes
60
+
61
+ Let's start by finding something to work on.
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Phase 2: Task Selection
67
+
68
+ ### Codebase Analysis
69
+
70
+ Scan the codebase for small improvement opportunities. Look for:
71
+
72
+ 1. **TODO/FIXME comments** - Search for `TODO`, `FIXME`, `HACK`, `XXX` in code files
73
+ 2. **Missing error handling** - `catch` blocks that swallow errors, risky operations without try-catch
74
+ 3. **Functions without tests** - Cross-reference `src/` with test directories
75
+ 4. **Type issues** - `any` types in TypeScript files (`: any`, `as any`)
76
+ 5. **Debug artifacts** - `console.log`, `console.debug`, `debugger` statements in non-debug code
77
+ 6. **Missing validation** - User input handlers without validation
78
+
79
+ Also check recent git activity:
80
+ ```bash
81
+ # Unix/macOS
82
+ git log --oneline -10 2>/dev/null || echo "No git history"
83
+ # Windows (PowerShell)
84
+ # git log --oneline -10 2>$null; if ($LASTEXITCODE -ne 0) { echo "No git history" }
85
+ ```
86
+
87
+ ### Present Suggestions
88
+
89
+ From your analysis, present 3-4 specific suggestions:
90
+
91
+ ```
92
+ ## Task Suggestions
93
+
94
+ Based on scanning your codebase, here are some good starter tasks:
95
+
96
+ **1. [Most promising task]**
97
+ Location: `src/path/to/file.ts:42`
98
+ Scope: ~1-2 files, ~20-30 lines
99
+ Why it's good: [brief reason]
100
+
101
+ **2. [Second task]**
102
+ Location: `src/another/file.ts`
103
+ Scope: ~1 file, ~15 lines
104
+ Why it's good: [brief reason]
105
+
106
+ **3. [Third task]**
107
+ Location: [location]
108
+ Scope: [estimate]
109
+ Why it's good: [brief reason]
110
+
111
+ **4. Something else?**
112
+ Tell me what you'd like to work on.
113
+
114
+ Which task interests you? (Pick a number or describe your own)
115
+ ```
116
+
117
+ **If nothing found:** Fall back to asking what the user wants to build:
118
+ > I didn't find obvious quick wins in your codebase. What's something small you've been meaning to add or fix?
119
+
120
+ ### Scope Guardrail
121
+
122
+ If the user picks or describes something too large (major feature, multi-day work):
123
+
124
+ ```
125
+ That's a valuable task, but it's probably larger than ideal for your first OpenSpec run-through.
126
+
127
+ For learning the workflow, smaller is better—it lets you see the full cycle without getting stuck in implementation details.
128
+
129
+ **Options:**
130
+ 1. **Slice it smaller** - What's the smallest useful piece of [their task]? Maybe just [specific slice]?
131
+ 2. **Pick something else** - One of the other suggestions, or a different small task?
132
+ 3. **Do it anyway** - If you really want to tackle this, we can. Just know it'll take longer.
133
+
134
+ What would you prefer?
135
+ ```
136
+
137
+ Let the user override if they insist—this is a soft guardrail.
138
+
139
+ ---
140
+
141
+ ## Phase 3: Explore Demo
142
+
143
+ Once a task is selected, briefly demonstrate explore mode:
144
+
145
+ ```
146
+ Before we create a change, let me quickly show you **explore mode**—it's how you think through problems before committing to a direction.
147
+ ```
148
+
149
+ Spend 1-2 minutes investigating the relevant code:
150
+ - Read the file(s) involved
151
+ - Draw a quick ASCII diagram if it helps
152
+ - Note any considerations
153
+
154
+ ```
155
+ ## Quick Exploration
156
+
157
+ [Your brief analysis—what you found, any considerations]
158
+
159
+ ┌─────────────────────────────────────────┐
160
+ │ [Optional: ASCII diagram if helpful] │
161
+ └─────────────────────────────────────────┘
162
+
163
+ Explore mode (`/opsx:explore`) is for this kind of thinking—investigating before implementing. You can use it anytime you need to think through a problem.
164
+
165
+ Now let's create a change to hold our work.
166
+ ```
167
+
168
+ **PAUSE** - Wait for user acknowledgment before proceeding.
169
+
170
+ ---
171
+
172
+ ## Phase 4: Create the Change
173
+
174
+ **EXPLAIN:**
175
+ ```
176
+ ## Creating a Change
177
+
178
+ A "change" in OpenSpec is a container for all the thinking and planning around a piece of work. It lives at the `changeRoot` reported by `openspec status --change "<name>" --json` and holds your artifacts—proposal, specs, design, tasks.
179
+
180
+ Let me create one for our task.
181
+ ```
182
+
183
+ **DO:** Create the change with a derived kebab-case name:
184
+ ```bash
185
+ openspec new change "<derived-name>"
186
+ ```
187
+
188
+ **SHOW:**
189
+ ```
190
+ Created: <changeRoot from status JSON>
191
+
192
+ The folder structure:
193
+ ```
194
+ <changeRoot>/
195
+ ├── proposal.md ← Why we're doing this (empty, we'll fill it)
196
+ ├── design.md ← How we'll build it (empty)
197
+ ├── specs/ ← Detailed requirements (empty)
198
+ └── tasks.md ← Implementation checklist (empty)
199
+ ```
200
+
201
+ Now let's fill in the first artifact—the proposal.
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Phase 5: Proposal
207
+
208
+ **EXPLAIN:**
209
+ ```
210
+ ## The Proposal
211
+
212
+ The proposal captures **why** we're making this change and **what** it involves at a high level. It's the "elevator pitch" for the work.
213
+
214
+ I'll draft one based on our task.
215
+ ```
216
+
217
+ **DO:** Draft the proposal content (don't save yet):
218
+
219
+ `<capability-path>` is the spec directory relative to `specs/` (for example,
220
+ `user-auth` or `identity/user-auth`). Use the exact existing path for modified
221
+ capabilities. For new capabilities, follow the project's established spec
222
+ organization.
223
+
224
+ ```
225
+ Here's a draft proposal:
226
+
227
+ ---
228
+
229
+ # Proposal
230
+
231
+ ## Why
232
+
233
+ [1-2 sentences explaining the problem/opportunity]
234
+
235
+ ## What Changes
236
+
237
+ [Bullet points of what will be different]
238
+
239
+ ## Capabilities
240
+
241
+ ### New Capabilities
242
+ - `<capability-path>`: [brief description]
243
+
244
+ ### Modified Capabilities
245
+ <!-- If modifying existing behavior -->
246
+ - `<existing-capability-path>`: [brief description]
247
+
248
+ ## Impact
249
+
250
+ - `src/path/to/file.ts`: [what changes]
251
+ - [other files if applicable]
252
+
253
+ ---
254
+
255
+ Does this capture the intent? I can adjust before we save it.
256
+ ```
257
+
258
+ **PAUSE** - Wait for user approval/feedback.
259
+
260
+ After approval, save the proposal:
261
+ ```bash
262
+ openspec instructions proposal --change "<name>" --json
263
+ ```
264
+ Then write the content to the `resolvedOutputPath` from `openspec instructions proposal --change "<name>" --json`.
265
+
266
+ ```
267
+ Proposal saved. This is your "why" document—you can always come back and refine it as understanding evolves.
268
+
269
+ Next up: specs.
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Phase 6: Specs
275
+
276
+ **EXPLAIN:**
277
+ ```
278
+ ## Specs
279
+
280
+ Specs define **what** we're building in precise, testable terms. They use a requirement/scenario format that makes expected behavior crystal clear.
281
+
282
+ For a small task like this, we might only need one spec file.
283
+ ```
284
+
285
+ **DO:** Resolve where the spec file should be created:
286
+ ```bash
287
+ openspec instructions specs --change "<name>" --json
288
+ # Use resolvedOutputPath from the JSON. If it is a glob, choose the concrete file path using the schema instruction and the change's context.
289
+ ```
290
+
291
+ Draft the spec content:
292
+
293
+ ```
294
+ Here's the spec:
295
+
296
+ ---
297
+
298
+ # Spec Delta
299
+
300
+ ## ADDED Requirements
301
+
302
+ ### Requirement: <Name>
303
+
304
+ <Description of what the system should do>
305
+
306
+ #### Scenario: <Scenario name>
307
+
308
+ - **WHEN** <trigger condition>
309
+ - **THEN** <expected outcome>
310
+ - **AND** <additional outcome if needed>
311
+
312
+ ---
313
+
314
+ This format—WHEN/THEN/AND—makes requirements testable. You can literally read them as test cases.
315
+ ```
316
+
317
+ Save to the concrete file path chosen from `resolvedOutputPath`.
318
+
319
+ ---
320
+
321
+ ## Phase 7: Design
322
+
323
+ **EXPLAIN:**
324
+ ```
325
+ ## Design
326
+
327
+ The design captures **how** we'll build it—technical decisions, tradeoffs, approach.
328
+
329
+ For small changes, this might be brief. That's fine—not every change needs deep design discussion.
330
+ ```
331
+
332
+ **DO:** Draft design.md:
333
+
334
+ ```
335
+ Here's the design:
336
+
337
+ ---
338
+
339
+ # Design
340
+
341
+ ## Context
342
+
343
+ [Brief context about the current state]
344
+
345
+ ## Goals / Non-Goals
346
+
347
+ **Goals:**
348
+ - [What we're trying to achieve]
349
+
350
+ **Non-Goals:**
351
+ - [What's explicitly out of scope]
352
+
353
+ ## Decisions
354
+
355
+ ### Decision 1: [Key decision]
356
+
357
+ [Explanation of approach and rationale]
358
+
359
+ ---
360
+
361
+ For a small task, this captures the key decisions without over-engineering.
362
+ ```
363
+
364
+ Save to the `resolvedOutputPath` from `openspec instructions design --change "<name>" --json`.
365
+
366
+ ---
367
+
368
+ ## Phase 8: Tasks
369
+
370
+ **EXPLAIN:**
371
+ ```
372
+ ## Tasks
373
+
374
+ Finally, we break the work into implementation tasks—checkboxes that drive the apply phase.
375
+
376
+ These should be small, clear, and in logical order.
377
+ ```
378
+
379
+ **DO:** Generate tasks based on specs and design:
380
+
381
+ ```
382
+ Here are the implementation tasks:
383
+
384
+ ---
385
+
386
+ # Tasks
387
+
388
+ ## 1. [Category or file]
389
+
390
+ - [ ] 1.1 [Specific task] — verify: [test, command, observable behavior, or delivered artifact]
391
+ - [ ] 1.2 [Specific task] — verify: [test, command, observable behavior, or delivered artifact]
392
+
393
+ ## 2. Integration Verification
394
+
395
+ - [ ] 2.1 Verify [broader integration or system behavior] with [end-to-end test or observable result]
396
+
397
+ ---
398
+
399
+ Each checkbox becomes a unit of work in the apply phase. Ready to implement?
400
+ ```
401
+
402
+ **PAUSE** - Wait for user to confirm they're ready to implement.
403
+
404
+ Save to the `resolvedOutputPath` from `openspec instructions tasks --change "<name>" --json`.
405
+
406
+ ---
407
+
408
+ ## Phase 9: Apply (Implementation)
409
+
410
+ **EXPLAIN:**
411
+ ```
412
+ ## Implementation
413
+
414
+ Now we implement each task, checking them off as we go. I'll announce each one and occasionally note how the specs/design informed the approach.
415
+ ```
416
+
417
+ **DO:** For each task:
418
+
419
+ 1. Announce: "Working on task N: [description]"
420
+ 2. Implement the change in the codebase
421
+ 3. Reference specs/design naturally: "The spec says X, so I'm doing Y"
422
+ 4. Mark complete in tasks.md: `- [ ]` → `- [x]`
423
+ 5. Brief status: "✓ Task N complete"
424
+
425
+ Keep narration light—don't over-explain every line of code.
426
+
427
+ After all tasks:
428
+
429
+ ```
430
+ ## Implementation Complete
431
+
432
+ All tasks done:
433
+ - [x] Task 1
434
+ - [x] Task 2
435
+ - [x] ...
436
+
437
+ The change is implemented! One more step—let's archive it.
438
+ ```
439
+
440
+ ---
441
+
442
+ ## Phase 10: Archive
443
+
444
+ **EXPLAIN:**
445
+ ```
446
+ ## Archiving
447
+
448
+ When a change is complete, we archive it. The archive path is derived from `planningHome.changesDir` and the date.
449
+
450
+ Archived changes become your project's decision history—you can always find them later to understand why something was built a certain way.
451
+ ```
452
+
453
+ **DO:** Archive the change (`--yes` answers the confirmation prompts, which you cannot answer from a tool call):
454
+ ```bash
455
+ openspec archive "<name>" --yes
456
+ ```
457
+
458
+ **SHOW:**
459
+ ```
460
+ Archived to: `<planningHome.changesDir>/archive/<target-name>/` (the target name prepends today's date, unless the name already starts with a `YYYY-MM-DD-` prefix — then it is kept as-is, no second date)
461
+
462
+ The change is now part of your project's history. The code is in your codebase, the decision record is preserved.
463
+ ```
464
+
465
+ ---
466
+
467
+ ## Phase 11: Recap & Next Steps
468
+
469
+ ```
470
+ ## Congratulations!
471
+
472
+ You just completed a full OpenSpec cycle:
473
+
474
+ 1. **Explore** - Thought through the problem
475
+ 2. **New** - Created a change container
476
+ 3. **Proposal** - Captured WHY
477
+ 4. **Specs** - Defined WHAT in detail
478
+ 5. **Design** - Decided HOW
479
+ 6. **Tasks** - Broke it into steps
480
+ 7. **Apply** - Implemented the work
481
+ 8. **Archive** - Preserved the record
482
+
483
+ This same rhythm works for any size change—a small fix or a major feature.
484
+
485
+ ---
486
+
487
+ ## Command Reference
488
+
489
+ **The commands you have installed:**
490
+
491
+ | Command | What it does |
492
+ |------------------|--------------------------------------------|
493
+ | `/opsx:propose` | Create a change and generate all artifacts |
494
+ | `/opsx:explore` | Think through problems before/during work |
495
+ | `/opsx:apply` | Implement tasks from a change |
496
+ | `/opsx:archive` | Archive a completed change |
497
+ | `/opsx:new` | Start a new change, one artifact at a time |
498
+ | `/opsx:continue` | Continue working on an existing change |
499
+ | `/opsx:ff` | Fast-forward: create all artifacts at once |
500
+ | `/opsx:verify` | Verify implementation matches artifacts |
501
+
502
+ ---
503
+
504
+ ## What's Next?
505
+
506
+ Try `/opsx:propose` on something you actually want to build. You've got the rhythm now!
507
+ ```
508
+
509
+ ---
510
+
511
+ ## Graceful Exit Handling
512
+
513
+ ### User wants to stop mid-way
514
+
515
+ If the user says they need to stop, want to pause, or seem disengaged:
516
+
517
+ ```
518
+ No problem! Your change is saved at the `changeRoot` reported by `openspec status --change "<name>" --json`.
519
+
520
+ To pick up where we left off later, `openspec status --change "<name>" --json` shows exactly where the change stands.
521
+ - `/opsx:continue <name>` - Resume artifact creation
522
+ - `/opsx:apply <name>` - Jump to implementation (if tasks exist)
523
+
524
+ The work won't be lost. Come back whenever you're ready.
525
+ ```
526
+
527
+ Exit gracefully without pressure.
528
+
529
+ ### User just wants command reference
530
+
531
+ If the user says they just want to see the commands or skip the tutorial:
532
+
533
+ ```
534
+ ## OpenSpec Quick Reference
535
+
536
+ **The commands you have installed:**
537
+
538
+ | Command | What it does |
539
+ |--------------------------|--------------------------------------------|
540
+ | `/opsx:propose <name>` | Create a change and generate all artifacts |
541
+ | `/opsx:explore` | Think through problems (no code changes) |
542
+ | `/opsx:apply <name>` | Implement tasks |
543
+ | `/opsx:archive <name>` | Archive when done |
544
+ | `/opsx:new <name>` | Start a new change, step by step |
545
+ | `/opsx:continue <name>` | Continue an existing change |
546
+ | `/opsx:ff <name>` | Fast-forward: all artifacts at once |
547
+ | `/opsx:verify <name>` | Verify implementation |
548
+
549
+ Try `/opsx:propose` to start your first change.
550
+ ```
551
+
552
+ Exit gracefully.
553
+
554
+ ---
555
+
556
+ ## Guardrails
557
+
558
+ - **Follow the EXPLAIN → DO → SHOW → PAUSE pattern** at key transitions (after explore, after proposal draft, after tasks, after archive)
559
+ - **Keep narration light** during implementation—teach without lecturing
560
+ - **Don't skip phases** even if the change is small—the goal is teaching the workflow
561
+ - **Pause for acknowledgment** at marked points, but don't over-pause
562
+ - **Handle exits gracefully**—never pressure the user to continue
563
+ - **Use real codebase tasks**—don't simulate or use fake examples
555
564
  - **Adjust scope gently**—guide toward smaller tasks but respect user choice