@skitterbyte/skitterspec-github 0.0.0-stage → 1.0.1

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 (112) hide show
  1. package/MIGRATION.md +1126 -0
  2. package/README.md +53 -2
  3. package/assets/claude-md-section.md +85 -0
  4. package/assets/commands/allow-main.md +33 -0
  5. package/assets/commands/spec-connect.md +13 -0
  6. package/assets/commands/spec-live.md +14 -0
  7. package/assets/commands/spec-remote-review.md +37 -0
  8. package/assets/commands/spec-skip.md +24 -0
  9. package/assets/core/SETUP.md +112 -0
  10. package/assets/core/env.config.json.example +56 -0
  11. package/assets/core/env.config.md +557 -0
  12. package/assets/core/gating.config.json.example +4 -0
  13. package/assets/core/gating.config.md +81 -0
  14. package/assets/core/github.config.json.example +18 -0
  15. package/assets/core/github.config.md +66 -0
  16. package/assets/hooks/main-guard.cjs +162 -0
  17. package/assets/hooks/review-gate.cjs +146 -0
  18. package/assets/review/page.html +3384 -0
  19. package/assets/rules/commit-trailers.md +103 -0
  20. package/assets/rules/negative-checks.md +69 -0
  21. package/assets/rules/offered-unblocks.md +100 -0
  22. package/assets/rules/spec-planning.md +692 -0
  23. package/assets/rules/spec-reports.md +557 -0
  24. package/assets/skills/no-spec/SKILL.md +246 -0
  25. package/assets/skills/spec/SKILL.md +718 -0
  26. package/assets/skills/spec-bug/SKILL.md +646 -0
  27. package/assets/skills/spec-cancel/SKILL.md +263 -0
  28. package/assets/skills/spec-claim/SKILL.md +122 -0
  29. package/assets/skills/spec-complete/SKILL.md +450 -0
  30. package/assets/skills/spec-diff/SKILL.md +870 -0
  31. package/assets/skills/spec-github-setup/SKILL.md +236 -0
  32. package/assets/skills/spec-hotfix/SKILL.md +668 -0
  33. package/assets/skills/spec-init/SKILL.md +178 -0
  34. package/assets/skills/spec-list/SKILL.md +172 -0
  35. package/assets/skills/spec-next/SKILL.md +685 -0
  36. package/assets/skills/spec-push/SKILL.md +307 -0
  37. package/assets/skills/spec-review/SKILL.md +258 -0
  38. package/assets/skills/spec-reviewed/SKILL.md +284 -0
  39. package/assets/skills/spec-start/SKILL.md +554 -0
  40. package/assets/skills/spec-status/SKILL.md +112 -0
  41. package/assets/skills/spec-sync/SKILL.md +226 -0
  42. package/assets/skills/spec-to-main/SKILL.md +139 -0
  43. package/bin/skitterspec-github.js +61 -0
  44. package/package.json +41 -4
  45. package/src/cli.js +5907 -0
  46. package/src/deprecate.js +138 -0
  47. package/src/env/bootstrap.js +188 -0
  48. package/src/env/building.js +143 -0
  49. package/src/env/classify.js +176 -0
  50. package/src/env/commitcmd.js +108 -0
  51. package/src/env/config.js +753 -0
  52. package/src/env/dev.js +63 -0
  53. package/src/env/hooks.js +226 -0
  54. package/src/env/hotfix.js +411 -0
  55. package/src/env/hotfixland.js +302 -0
  56. package/src/env/integrate.js +126 -0
  57. package/src/env/live.js +504 -0
  58. package/src/env/mainguard.js +299 -0
  59. package/src/env/provision.js +466 -0
  60. package/src/env/proxy.js +225 -0
  61. package/src/env/prune.js +119 -0
  62. package/src/env/registry.js +159 -0
  63. package/src/env/render.js +17 -0
  64. package/src/env/resolve.js +716 -0
  65. package/src/env/review.js +2577 -0
  66. package/src/env/reviewers/coderabbit.js +228 -0
  67. package/src/env/reviewers.js +517 -0
  68. package/src/env/serve.js +1044 -0
  69. package/src/env/supervise.js +157 -0
  70. package/src/env/teardown.js +248 -0
  71. package/src/env/trust.js +87 -0
  72. package/src/gating.js +155 -0
  73. package/src/init.js +1150 -0
  74. package/src/lines-diff.js +114 -0
  75. package/src/prompts.js +129 -0
  76. package/src/vendor/github/api.js +800 -0
  77. package/src/vendor/github/cli-sync.js +1530 -0
  78. package/src/vendor/github/commands.js +44 -0
  79. package/src/vendor/github/config.js +414 -0
  80. package/src/vendor/github/credentials.js +109 -0
  81. package/src/vendor/github/dialect.js +62 -0
  82. package/src/vendor/github/identity.js +38 -0
  83. package/src/vendor/github/mcp.js +85 -0
  84. package/src/vendor/provider-kit/index.js +41 -0
  85. package/src/vendor/provider-kit/src/adapter.js +23 -0
  86. package/src/vendor/provider-kit/src/apply.js +207 -0
  87. package/src/vendor/provider-kit/src/args.js +68 -0
  88. package/src/vendor/provider-kit/src/assignment.js +277 -0
  89. package/src/vendor/provider-kit/src/config.js +198 -0
  90. package/src/vendor/provider-kit/src/credentials.js +404 -0
  91. package/src/vendor/provider-kit/src/doctor.js +35 -0
  92. package/src/vendor/provider-kit/src/http.js +63 -0
  93. package/src/vendor/provider-kit/src/identity.js +93 -0
  94. package/src/vendor/provider-kit/src/md-compare.js +39 -0
  95. package/src/vendor/provider-kit/src/md-tables.js +94 -0
  96. package/src/vendor/provider-kit/src/prompt.js +50 -0
  97. package/src/vendor/provider-kit/src/released.js +269 -0
  98. package/src/vendor/provider-kit/src/releases.js +380 -0
  99. package/src/vendor/provider-kit/src/specs.js +166 -0
  100. package/src/vendor/provider-kit/src/transport.js +22 -0
  101. package/src/vendor/sync-core/index.js +93 -0
  102. package/src/vendor/sync-core/src/base.js +81 -0
  103. package/src/vendor/sync-core/src/compare.js +338 -0
  104. package/src/vendor/sync-core/src/dialect.js +51 -0
  105. package/src/vendor/sync-core/src/fields.js +36 -0
  106. package/src/vendor/sync-core/src/legacy.js +100 -0
  107. package/src/vendor/sync-core/src/normalize.js +998 -0
  108. package/src/vendor/sync-core/src/push.js +85 -0
  109. package/src/vendor/sync-core/src/retarget.js +278 -0
  110. package/src/vendor/sync-core/src/task-block.js +308 -0
  111. package/src/vendor/sync-core/src/verify.js +67 -0
  112. package/src/vendor/sync-core/src/write.js +191 -0
@@ -0,0 +1,718 @@
1
+ ---
2
+ name: spec
3
+ description: Create a new spec-driven-development spec. Grills the user to a clear, shared understanding of the requirement AND the proposed solution FIRST, then writes one concise, phased, test-included, change-logged spec into specs/backlog/. Use when the user wants to plan a feature, write a spec, capture a requirement, or says "/spec" or "spec this out".
4
+ ---
5
+
6
+ # /spec — author a new spec
7
+
8
+ > Stay silent while this runs — speak only to ask something you cannot answer
9
+ > yourself, or to report a failure at the moment it happens. Read
10
+ > `.claude/rules/spec-reports.md` before reporting; it defines the block this
11
+ > skill ends with.
12
+
13
+ Produce ONE concise spec in `specs/backlog/`. Do not start coding — this skill
14
+ plans only. Implementation happens later via `/spec-start`.
15
+
16
+ Lifecycle (the governing skills) — status in parentheses:
17
+ `/spec` (writes **Ready** when fully groomed, else Draft; backlog) → `/spec-start`
18
+ (In Progress, in-progress; implement phase 1) → `/spec-complete` (Complete) /
19
+ `/spec-cancel` (Cancelled). See `.claude/rules/spec-planning.md`. (There is no
20
+ separate grooming command — `/spec` grills to a Ready spec directly.)
21
+
22
+ ## Phase 0 — start from a GitHub issue (only when asked)
23
+
24
+ **Only when `specs/.core/github.config.json` exists** *and* the invocation names an
25
+ issue. Otherwise skip this phase entirely and grill from the user's own words.
26
+
27
+ Two ways in:
28
+
29
+ - **`<ISSUE-REF>`** (`#123`, an issue URL, or a bare `#N` anywhere in the
30
+ arguments) — adopt that issue.
31
+ - **`--from-issue [query]`** — browse the intake inbox:
32
+ `skitterspec spec-sync intake [query] --json` lists the open issues carrying
33
+ `intake.label` that no spec has adopted and that are not spec or phase issues
34
+ themselves, each with the skill its labels route it to. `query` filters titles
35
+ case-insensitively. Show the shortlist and let the user pick one. Without a
36
+ token it says so and exits 0 — fall back to `list_issues` over MCP.
37
+
38
+ Then:
39
+
40
+ 1. **Exclude what's already adopted.** Run `skitterspec spec-sync linked --json`
41
+ and drop any issue whose identifier is already stamped on a spec. If the user
42
+ named such an issue directly, **stop** and point them at that spec — one issue
43
+ never becomes two specs.
44
+ 2. **Read the issue** with the discovered issue-read tool (`issue_read`):
45
+ title, description, labels, reporter, URL. If GitHub isn't connected, say so
46
+ and offer to carry on without it — a spec written from the user's own
47
+ description is still a spec.
48
+ 3. **Route the issue to the right skill.** Match the issue's labels
49
+ (case-insensitively) against two lists, **checking `hotfixLabels` first**:
50
+
51
+ - **`intake.hotfixLabels`** → this is broken in **production**, so it needs a
52
+ fix against the released version, not `main`. Say so, name the matching
53
+ label, and tell the user to run **`/spec-hotfix <ISSUE-REF>`** — then stop.
54
+ - **`intake.bugLabels`** → a bug report, not a feature request. Say so, name
55
+ the label, and tell the user to run **`/spec-bug <ISSUE-REF>`** — then stop,
56
+ without authoring a Feature spec.
57
+
58
+ **Hotfix wins when an issue carries both**, and deliberately: production is the
59
+ more specific destination, and the two mistakes are not equally costly. Routing
60
+ a prod issue to `/spec-bug` produces a fix that lands on `main` and never
61
+ reaches the running version — discovered only when someone asks why it hasn't
62
+ shipped. The reverse is a hotfix branch for something that could have waited,
63
+ which is merely wasteful.
64
+
65
+ With a list unset, nothing routes through it; with both unset every issue is
66
+ treated as a feature request, exactly as before.
67
+
68
+ **Which checks run depends on where you are**, because a skip is about not
69
+ bouncing someone to the skill they are already in — not about ignoring an
70
+ escalation:
71
+
72
+ - **In `/spec`** — both checks run.
73
+ - **In `/spec-bug`** — the bug check is skipped (it would route you to
74
+ yourself), but the **hotfix check still runs**. A bug report labelled for
75
+ production is not "already handled" by being in the bug path: `/spec-bug`
76
+ fixes on `main`, and prod would stay broken. Say so and hand off.
77
+ - **In `/spec-hotfix`** — both are skipped. It is already the most specific
78
+ destination; there is nowhere left to route.
79
+
80
+ Then adopt the issue and reproduce it as usual: the issue body is your repro
81
+ material, and the failing test comes before the spec exactly as normal.
82
+ 4. **Seed, don't skip, the grill.** The issue's title becomes the working spec
83
+ title and its description the starting material for **Problem** — or
84
+ **Symptom** in a bug or hotfix spec, which is where a report belongs. Quote the
85
+ reporter's words rather than paraphrasing them away. Note the reporter and the
86
+ issue URL for context. Everything after this runs exactly as normal: an issue
87
+ is a *request*, not a groomed spec, so grill it as hard as anything else.
88
+
89
+ **In `/spec-hotfix`, also mine the issue for a version.** Any release-shaped
90
+ string in the report is a *suggestion* for the base tag, offered when the skill
91
+ asks which version prod is running — never used as a default. The reporter's
92
+ version is the one they saw the bug on, which is often not what is deployed.
93
+
94
+ ### Adopting the issue
95
+
96
+ The issue **becomes** the spec's issue — it is not copied and no second issue is
97
+ minted. This is identical in `/spec`, `/spec-bug` and `/spec-hotfix`; only *when*
98
+ it happens differs (`/spec` writes the spec in Phase B, `/spec-bug` in its step 4,
99
+ `/spec-hotfix` in its step 5). Once the spec file exists:
100
+
101
+ - **Stamp `github_identifier` and `github_url`** in `00-overview.md` frontmatter
102
+ from the adopted issue. That is the whole link: every later skill
103
+ (`/spec-push`, `/spec-status`, `/spec-start`) keys off it being present.
104
+ - **Adoption is not a mint.** The issue was filed somewhere deliberately — it
105
+ stays where it is, and nothing moves it to another repo or board.
106
+ - **Do not write a base sidecar.** Leaving `sync.baseDir` empty for this spec is
107
+ what makes the **linking push** send the spec over the reporter's original
108
+ description (an **update** to the existing issue, plus a sub-issue per phase).
109
+ Recording a snapshot here would declare the mirror already in sync and strand
110
+ the issue showing the raw report forever.
111
+ - **Preserve the original, before anything replaces it.** Run this the moment
112
+ the spec file exists and **before the linking push**:
113
+
114
+ ```
115
+ skitterspec spec-sync preserve <spec>
116
+ ```
117
+
118
+ It posts the issue's current description onto the issue as a comment — the one
119
+ surface one-way sync never touches, so no push can clobber it. On the API path
120
+ it reads the description itself; without credentials it prints the body and
121
+ the marker, and you post it with the discovered GitHub comment tool after
122
+ checking the comments for that marker.
123
+
124
+ **The ordering is the whole correctness condition.** Run before the push, this
125
+ keeps what the reporter filed. Run after it, it would keep the generated spec
126
+ and report success — which is why it is a step of its own here rather than a
127
+ line in the push sequence. The engine warns when it can tell it is late, but it
128
+ cannot always tell.
129
+
130
+ **It never fails the adoption.** A project that set
131
+ `intake.preserveOriginal: false`, an unreachable GitHub, an issue with no
132
+ description, a comment GitHub refused — every one of them exits 0 and says so.
133
+ Relay what it printed and carry on.
134
+ - **Say what will happen** in the finish-up message. The linking step runs right
135
+ after the spec is written, so the issue's description is replaced by the spec
136
+ **then** — not on some later manual push. Say both halves: the description
137
+ becomes the spec, **and** the original is preserved as a comment on the same
138
+ issue, so the reporter can still read what they wrote.
139
+
140
+ **Do not send anyone to the issue's history for it.** This used to say the
141
+ tracker keeps the original there, and that is true and useless: history is a
142
+ diff viewer nobody opens, it is not quotable, and it degrades to "it is in
143
+ there somewhere". The comment is the answer, and the other half is the spec's
144
+ own **Problem** (or **Symptom**) section quoting the reporter.
145
+
146
+ ## Phase A — reach a clear shared understanding (grill first)
147
+
148
+ Interview the user until requirement AND proposed solution are unambiguous. Do
149
+ not write the spec until this is resolved.
150
+
151
+ - Break the problem into **distinctive areas** and work them in logical order,
152
+ resolving dependencies between decisions one at a time.
153
+ - **Batch independent questions; sequence dependent ones.** When several
154
+ questions do not affect each other's answers, put them to the user together
155
+ (up to four at once — use the harness's multi-question ask tool where it has
156
+ one) rather than spending a round trip on each. When an answer would change
157
+ what you ask next, ask that one alone and wait for it. Give your
158
+ **recommended answer** either way.
159
+ - If a question can be answered by **reading the codebase, read it** instead of
160
+ asking. Verify endpoints/models/files actually exist before relying on them.
161
+ - Cover, at minimum, the areas that apply:
162
+ 1. **Problem & why** — what's broken/missing, who feels it, why now.
163
+ 2. **Scope & non-goals** — explicit out-of-scope items.
164
+ 3. **Affected areas** — concrete files/modules/packages this touches.
165
+ 4. **Proposed solution shape** — the chosen approach and the alternatives
166
+ rejected, with the reason (this becomes "Decisions").
167
+ 5. **Data / API impact** — schema/model changes, new endpoints, and
168
+ **backward compatibility** (additive = safe; breaking = needs explicit
169
+ permission and coordination).
170
+ 6. **Security & multi-tenancy** — authz, tenant scoping, untrusted input.
171
+ 7. **Edge cases & failure modes.**
172
+ 8. **Testing approach** — what proves each phase correct.
173
+ 9. **Isolation stack** *(only when `specs/.core/env.config.json` exists)* — does
174
+ this spec touch the DB / stateful services (so its worktree needs a Docker
175
+ stack), or is a plain worktree enough? Default `worktree`; escalate to
176
+ `worktree + docker` only when it must. This sets the `> **Stack:**` header
177
+ that `/spec-start` acts on (it can be escalated later). Skip when isolation
178
+ isn't enabled — leave the default `worktree`.
179
+ 10. **Release gating** *(only when `specs/.core/gating.config.json` exists)* —
180
+ should this ship behind a feature flag, or land live?
181
+ **Offer, don't impose**: the user decides and you raise it, so a spec
182
+ never reaches
183
+ `/spec-complete` with the question unasked. Cite the project's own
184
+ `guidance` path from that config when it names one — skitterspec knows
185
+ nothing about how this project does flags, and must not guess. Record the
186
+ answer **either way**: a flag name, or `none: <one-line reason>`. "No" is a
187
+ decision and belongs in the header; silence is not. Skip entirely when the
188
+ config is absent — that project does not use flags.
189
+ 11. **Open questions** — anything still undecided.
190
+
191
+ Stop grilling when there are no unresolved branches that would change the spec.
192
+ Briefly play back the agreed understanding before writing.
193
+
194
+ ## Phase B — write the spec
195
+
196
+ This skill is for **features**. For bugs, use `/spec-bug` (test-first, red→green).
197
+
198
+ ### Write it in its own worktree
199
+
200
+ **Only when the project has per-spec isolation** (`specs/.core/env.config.json`
201
+ present). Without it there is no worktree to make and this section does not
202
+ apply — write the folder where you are standing, exactly as before.
203
+
204
+ **Provision before you write, not after.** Grilling put nothing on disk and the
205
+ spec's name is settled by the time Phase A ends, so this is the one moment where
206
+ a worktree costs nothing to obtain and everything is still ahead of it:
207
+
208
+ ```
209
+ skitterspec spec-env up <name> --docs
210
+ ```
211
+
212
+ Run the commands it prints under `to provision, run:`, and the
213
+ `skitterspec spec-env bootstrap <name> --docs` under `then, run:` where there is
214
+ one (it seeds the gitignored files, nothing more). Then move this session into
215
+ the worktree with a plain `cd` — the Bash working directory persists between
216
+ calls, so from here on the spec is written on its own branch. Confirm the move landed rather than
217
+ reading silence as success (`.claude/rules/negative-checks.md` rule 1):
218
+ `skitterspec spec-env resolve` with no argument must name this spec. If it does
219
+ not, say so and write the spec where you are standing instead; a spec in the
220
+ wrong tree is worse than a spec with no worktree.
221
+
222
+ **`--docs` is what makes this cheap.** It skips the `setup` commands and the
223
+ Docker stack — everything whose only purpose is making a tree *runnable* — so
224
+ provisioning a worktree to write markdown in is a `git worktree add` and nothing
225
+ else. `/spec-start` re-runs `up` over the same worktree without the flag, and the
226
+ setup runs then, at the first moment the tree is used for code.
227
+
228
+ **Why the base branch is no longer where this happens.** `main` is where work
229
+ **lands**, not where it happens. Authoring on it meant the spec sat uncommitted
230
+ there for as long as Phase C2's page went unanswered — which is unbounded by
231
+ design, because a reader walking away from a diff is the normal case — and a
232
+ release could not be cut through it. The verdict lands the spec instead, so
233
+ `main` gains it as one commit and is never dirty on the way.
234
+
235
+ **A spec written in ANOTHER spec's worktree is still the mistake it always was**,
236
+ and this section does not soften that. It physically lives on that branch: not on
237
+ `main` until that spec lands, invisible to anyone listing `specs/backlog/`
238
+ meanwhile, and cancelled along with its host. Committing it there also mis-stamps
239
+ the ticket trailer, which is resolved from the branch (see
240
+ `.claude/rules/commit-trailers.md`, installed with a ticketing provider). The
241
+ difference is whose worktree: **its own** is now the normal path, and someone
242
+ else's is the accident.
243
+
244
+ So if Phase A ran inside another spec's worktree — most likely because a design
245
+ question came up part-way through implementing it — the provision above is the
246
+ fix rather than something to warn about: it moves the session out of that tree
247
+ and into this spec's own. Where isolation is off and there is no worktree to
248
+ move to, **warn, don't refuse**, and say the trailer for that commit wants
249
+ `spec-sync ref <new-spec-name>` rather than the bare form.
250
+
251
+ - **Every spec is a folder** — never a bare file, even for a one-line change:
252
+ `specs/backlog/feat-<kebab-name>/`. Create it with `mkdir -p`.
253
+ - The entry point is **always `00-overview.md`** — the index/dashboard for the
254
+ spec. It holds the header block, Problem, Decisions, Solution overview, the
255
+ **phase index** (a table linking to each phase file), Open questions, State
256
+ log, and Changelog. It does **not** hold the per-phase task lists.
257
+ - **Each phase is its own file** — `01-<phase-slug>.md`, `02-<phase-slug>.md`, …
258
+ numbered in execution order; the slug is a short kebab description of the phase
259
+ goal (e.g. `01-data-model.md`, `02-api-endpoints.md`). The phase file holds
260
+ that phase's goal, its task checkboxes (tests included), and any phase-specific
261
+ notes. **Even a single-phase spec gets `01-….md`** — never lump phase tasks
262
+ into `00-overview.md`. This keeps each phase easy to dive into on its own.
263
+ - Choose a short kebab-case name and **prefix it `feat-`** (the bug counterpart
264
+ uses `bug-`).
265
+
266
+ Use this template (keep it **as concise as possible** — no filler, no restating
267
+ the codebase, link rather than duplicate):
268
+
269
+ ```markdown
270
+ # <Feature title>
271
+
272
+ > **Type:** Feature
273
+ > **Name:** feat-<kebab-name> (the spec folder name — the handle you paste into `/spec-start`)
274
+ > **Status:** Ready — not started
275
+ > **Author:** <git user.name — `git config user.name`>
276
+ > **Developer:** —
277
+ > **Raised:** <YYYY-MM-DD (today)>
278
+ > **Area:** <comma-separated files/modules this touches>
279
+ > **Stack:** <worktree — or "worktree + docker" if it touches the DB/stateful
280
+ > services; only acted on when isolation is enabled — see Phase A item 9>
281
+ > **Gating:** <flag name — or "none: <one-line reason>". Only when release gating
282
+ > is configured; omit the line entirely otherwise. An empty value or a bare
283
+ > "none" is not a valid outcome — see Phase A item 10>
284
+
285
+ ## Problem
286
+
287
+ <2–6 sentences: what's wrong/missing and why it matters. No fluff.>
288
+
289
+ ## Decisions
290
+
291
+ <Numbered, confirmed decisions from Phase A. Each: the choice + one-line why,
292
+ and the rejected alternative when it sharpens the choice. This is the heart of
293
+ the spec — be specific.>
294
+
295
+ ## Solution overview
296
+
297
+ <Short prose or bullets describing the chosen shape end-to-end. Optional small
298
+ schema/grammar/output snippets where they remove ambiguity.>
299
+
300
+ ## Impact
301
+
302
+ <The concrete surfaces this spec touches — the scannable blast radius, so a
303
+ reader can eyeball where the spec got something wrong without reading prose.
304
+ `Change` is `add` · `update` · `remove`. `Surface` is guided-but-open: use
305
+ values like Endpoint, Route/UI, Schema/model, DB table/migration, Domain object,
306
+ Service, CLI command, Config key, Skill/rule, Business rule — or whatever fits
307
+ this project (skitterspec itself is a CLI with no HTTP surface). Keep `Detail`
308
+ terse — names/signatures, not sentences. List **only** surfaces that actually
309
+ change; the heading is always present, but if nothing external changes write the
310
+ single line below instead of an empty table.>
311
+
312
+ | Surface | Change | Detail |
313
+ |---------|--------|--------|
314
+ | <e.g. Endpoint> | add | <e.g. POST /orders> |
315
+ | <e.g. DB> | update | <e.g. orders (+status col)> |
316
+
317
+ <_No external surface changes — internal refactor only._ — use this line in
318
+ place of the table when the spec touches no external surface.>
319
+
320
+ ## Phases
321
+
322
+ Each phase lives in its own file in this folder. Status: ⬜ not started ·
323
+ 🔄 in progress · ✅ done.
324
+
325
+ | # | Phase | Status | File |
326
+ |---|-------|--------|------|
327
+ | 1 | <goal> | ⬜ | [01-<phase-slug>.md](01-<phase-slug>.md) |
328
+ | 2 | <goal> | ⬜ | [02-<phase-slug>.md](02-<phase-slug>.md) |
329
+
330
+ ## Open questions
331
+
332
+ - [ ] <anything deferred — or "None">
333
+
334
+ ## State log
335
+
336
+ | Date | Status | Folder | By |
337
+ |------|--------|--------|----|
338
+ | <YYYY-MM-DD> | Ready | backlog | <author> |
339
+
340
+ ## Changelog
341
+
342
+ - <YYYY-MM-DD> — Spec created.
343
+ ```
344
+
345
+ Then create **one file per phase** (`01-<phase-slug>.md`, `02-…`, in execution
346
+ order). Each phase file uses this template:
347
+
348
+ ```markdown
349
+ # Phase 1 — <goal> ⬜
350
+
351
+ > Spec: [00-overview.md](00-overview.md) · **Status:** Not started
352
+
353
+ **Goal:** <one line — what this phase delivers and how it's proven>.
354
+
355
+ ## Tasks
356
+
357
+ - [ ] <clear, verb-first task>
358
+ - [ ] <clear, verb-first task>
359
+ - [ ] Add/extend tests covering this phase; run the project's typecheck and
360
+ test commands (see `.claude/rules/spec-planning.md`) — green before the
361
+ phase is done.
362
+
363
+ ## Notes
364
+
365
+ <Phase-specific decisions, gotchas, or context. Delete if empty.>
366
+ ```
367
+
368
+ Keep the `00-overview.md` phase index and the phase files in sync: the index row
369
+ is the one-line summary + status; the phase file is the detail.
370
+
371
+ The **State log** is the audit trail of folder/status transitions — every
372
+ lifecycle skill (`/spec-start`, `/spec-complete`, `/spec-cancel`) appends one row
373
+ when it moves the spec. The **Changelog** is for decisions and course-corrections
374
+ only — keep the two separate.
375
+
376
+ Rules for the spec body:
377
+
378
+ - **Every phase is independently shippable and ends with tests.** A phase is
379
+ not "done" until its tests are written and the suite is green. Bake a test
380
+ task into each phase — never a separate "testing phase" at the end only.
381
+ - **Tasks are checkboxes** (`- [ ]`), clear, verb-first, and granular enough to
382
+ finish in one session. They live in the **phase files**, not the overview. Use
383
+ `⬜`/`🔄`/`✅` on each phase-file heading and mirror it in the `00-overview.md`
384
+ phase index.
385
+ - **Honour project conventions** when writing tasks — reference the relevant
386
+ `.claude/rules/*.md` rather than re-explaining them.
387
+ -
388
+ **The `## Impact` table is derived from Phase A items 3 (Affected areas) & 5 (Data/API impact)**
389
+ — a structured place to record what those already surface, not new grilling.
390
+ It is the scannable substitute for spelling impact out in prose: name the
391
+ surfaces (endpoints, schemas, DB tables, domain objects, routes, business
392
+ rules) instead of describing them, keep `Detail` terse, and let it — not
393
+ paragraphs — carry the blast radius. It complements the `Area:` header
394
+ (files) by naming behavioural surfaces.
395
+ - **Changelog** is mandatory and lives in the spec. Every later decision or
396
+ course-correction gets a dated one-line entry. Convert relative dates to
397
+ absolute.
398
+ - Keep it tight. If a section adds no information, delete it.
399
+
400
+ ## Phase C — finish up
401
+
402
+ Decide the status: **`Ready`** in `backlog` when grilling in Phase A resolved the
403
+ open questions, `Draft` when you deliberately left some unresolved. Either way
404
+ the next step is `/spec-start`. The Report section below is where all of that
405
+ reaches the user — do not narrate it here as well.
406
+
407
+ ## Phase C2 — render the spec, then wait for the verdict
408
+
409
+ **Only when the project has per-spec isolation** (`specs/.core/env.config.json`
410
+ present). Without it there is no page and this phase does not exist — skip it in
411
+ silence rather than explaining an absence.
412
+
413
+ A spec is the one artefact whose whole purpose is to be
414
+ **read before work begins**, and until now it was the only one with no reading
415
+ surface: `/spec`
416
+ finished, the spec sat uncommitted, and `/spec-start` had to point that out and
417
+ commit it as a side effect of provisioning. So this phase ends where every other
418
+ phase of the lifecycle ends — on a page, in a verdict.
419
+
420
+ ```
421
+ skitterspec spec-env review <spec> --docs --buttons authoring
422
+ ```
423
+
424
+ `--docs` reads the spec's own documents from the tree you are standing in, which
425
+ after Phase B is **this spec's own worktree**. It renders
426
+ **this spec's documents and nobody else's**: the `owned` half of
427
+ `spec-env stage` is what supplies the file set, and it stays load-bearing even
428
+ now that the tree holds one spec — a project's `spec.companionPaths` and a
429
+ hand-edited `specs/.core/` both land in the same tree, and only the spec's own
430
+ documents belong under this verdict.
431
+
432
+ **This is free.** The engine reads git and splices text into a template; the
433
+ diff never passes through you.
434
+
435
+ **Never pass `--run-reviewers` here.** A spec is prose, and the reviewers
436
+ `review.reviewers` names read code — spending a rate-limited review on a
437
+ paragraph buys nothing. The engine refuses it on a `--docs` render whatever this
438
+ skill asks for, so this is a note about intent rather than a guard you are
439
+ holding: do not add the flag on the assumption that it was an oversight.
440
+
441
+ **Render nothing when nothing was written.** A `⏸` run — grilling that never
442
+ reached a shared understanding — has no spec to show, and must not ask for a
443
+ verdict on one.
444
+
445
+ **Arm nothing.** There is no `spec-env review arm` in this path, and that is a
446
+ decision rather than an omission: the gate asserts that *a phase which ended*
447
+ owes an answer, and a backlog spec owes no phase. A `/spec` run must leave
448
+ `spec-env review gate --check` exiting 0.
449
+
450
+ **And walking away from this page now costs nobody anything**, which is a
451
+ stronger reason than the one that used to sit here. It read *"the spec is simply
452
+ still uncommitted, which `/spec-start` already handles"* — true, and a
453
+ concession: an uncommitted spec meant a dirty base branch, which is everyone's
454
+ problem, so "arm nothing" was tolerating a mess rather than describing a clean
455
+ state. Since Phase B the unanswered spec sits on its own branch in its own
456
+ worktree, where it is in nothing's way: no release is blocked, no other spec has
457
+ to replay over it, and it is still exactly where it was tomorrow morning.
458
+
459
+ ### The two endings this page offers
460
+
461
+ `--buttons authoring` offers `Commit & Start` and `Commit` in place of the
462
+ committing pair, because "commit and build the next phase" is meaningless for a
463
+ spec with no phase in flight.
464
+
465
+ - **`commit-start`** — hand off to `review.commitWith` (`/commit` by default),
466
+ passing the pathspec the render reported on `docs.paths`; **land it** (below);
467
+ then **keep the worktree** and run **`/spec-start <name>`**, and **stop there**.
468
+ It never completes or tears anything down, exactly as `commit-continue` stops
469
+ after `/spec-next`. This is the `commit && /spec-start` that was typed by hand.
470
+ - **`commit`** — the same commit and the same land, then
471
+ **tear the worktree down** and finish. The spec stays `Ready` in `backlog` —
472
+ on the base branch, where anyone can see it — ready for a `/spec-start`
473
+ whenever it is wanted.
474
+
475
+ **Both committing verdicts land, and that is what keeps the backlog findable.**
476
+ `ls specs/backlog/` is how specs are found, and a folder bucket is only the truth
477
+ on the branch you are standing on — so a spec left on its own branch would be
478
+ invisible to everyone, including the next `/spec` run. The commit goes on the
479
+ branch and then the branch goes onto the base:
480
+
481
+ ```
482
+ skitterspec spec-env integrate <name>
483
+ ```
484
+
485
+ It plans a rebase onto the base branch in the worktree, then a
486
+ `merge --ff-only` in the primary checkout — run the commands it prints. It
487
+ refuses on a dirty tree, which is correct here: the commit ran first, so anything
488
+ still uncommitted at this point is not this spec's and the land must not proceed.
489
+
490
+ **Do not run its after-land section.** Where the plan ends with
491
+ `then, in the primary checkout (<path>), run:`, those are the project's
492
+ `afterLand` commands — a data migration, an install — and they exist for code
493
+ that landed. This land is documents only, so it changes nothing they would
494
+ catch up on; `/spec-complete`, `/spec-to-main` and `/no-spec` run them.
495
+
496
+ **If the rebase conflicts, stop and say so.** It is unlikely on a
497
+ documents-only branch and not impossible — two specs authored at once can both
498
+ touch `specs/.core/`. Run `git rebase --abort`, leave the commit sitting on the
499
+ branch, and report `❌` with the conflict: there is a standing worktree to clear,
500
+ which is what separates `❌` from `⏸`. Never resolve someone else's conflict to
501
+ get the land through.
502
+
503
+ **The worktree lifetime follows the verdict, and the asymmetry is deliberate.**
504
+ `commit-start` keeps it because you are carrying straight on, and `/spec-start`
505
+ re-runs `up` and `bootstrap` over it without `--docs`, which is where the setup commands
506
+ Phase B skipped finally run. Plain `commit` tears it down with
507
+ `skitterspec spec-env down <name>`, because a spec parked in the backlog should
508
+ hold no worktree and no `node_modules`; `/spec-start` provisions from scratch
509
+ whenever it is wanted. Always-keep would leave five backlog specs holding five
510
+ checkouts, and always-teardown would have `commit-start` re-provision seconds
511
+ after destroying the tree it needed.
512
+ - **`changes`** — work the notes into the spec, record a resolution for each one
513
+ so the next render shows it struck through with what changed, then
514
+ **re-render, and wait again**. The reader is still holding a decision, so
515
+ ending the turn and
516
+ making them type `/spec-diff` would reopen the loop this exists to close.
517
+ - **`discuss`** — report and talk. Claim nothing, change nothing.
518
+
519
+ **Take the pathspec from the render, not from the tree.** A checkout is shared,
520
+ so the set of this spec's uncommitted documents can differ between the render and
521
+ the verdict — and the reader's conclusion is about what the page showed them.
522
+
523
+ ### Then wait for it
524
+
525
+ **The wait is a command. Do not write one.**
526
+
527
+ 1. **Note the moment you start waiting**, as an ISO timestamp. That instant is
528
+ the whole scope of what you may claim.
529
+ 2. **Run the engine's wait, and end your turn** — under the harness's
530
+ persistent watch primitive where one exists, else in the background
531
+ (`.claude/rules/spec-reports.md` carries the preference):
532
+
533
+ ```
534
+ skitterspec spec-env review wait <spec> --since <the timestamp>
535
+ ```
536
+
537
+ It takes no timeout unless you pass one, and you must not pass one: a reader
538
+ who walks away from a spec is the normal case, and a bounded watch once lost a
539
+ verdict to a lunch break.
540
+ 3. **On waking, let the engine pick:**
541
+
542
+ **A watch that dies is re-armed on the same window**, silently and bounded by
543
+ the age of that window — `.claude/rules/spec-reports.md` carries the contract,
544
+ including when to stop and what the banner says instead. Do not restate it
545
+ here.
546
+
547
+ ```
548
+ skitterspec spec-env review <spec> --docs --claim-since <the timestamp> --json
549
+ ```
550
+
551
+ It claims the one pass that arrived inside the window, acts on nothing when
552
+ none did, and refuses to choose when two did.
553
+ 4. **Route on the verdict** as above.
554
+
555
+ **Where the page is `file://`** — the engine could not serve — there is no server
556
+ to POST to, so the pass is copied and pasted and the reader's next message is
557
+ what carries it. **Do not start a watch that cannot fire**: a wait on the pending
558
+ store would spin forever while the report underneath it claimed to be holding,
559
+ which is the exact failure `.claude/rules/spec-reports.md` records. The wait is
560
+ the turn ending, and the banner says so.
561
+
562
+ Relay the engine's **stack** — the `local:`, `network:` and `remote:` lines, all
563
+ three, in that order — never the bare `page:` path. `.claude/rules/spec-reports.md`
564
+ carries the shape and why every tier is named rather than one being chosen.
565
+
566
+ ## Phase D — record the isolation stack (only if configured)
567
+
568
+ **Only when `specs/.core/env.config.json` exists** (per-spec isolation is
569
+ enabled), make sure the `> **Stack:**` header reflects the Phase A item 9
570
+ decision — `worktree` (default) or `worktree + docker` when it touches the DB /
571
+ stateful services. Nothing to provision now: `/spec-start` gives every in-progress
572
+ spec its own worktree automatically, and brings up Docker only when the Stack
573
+ says so. Mention the operator can escalate the Stack later (edit the header, or
574
+ run `skitterspec spec-env up <name>` to add Docker to an existing worktree). If
575
+ `env.config.json` is absent, isolation is off — leave the default `worktree` and
576
+ finish as above.
577
+
578
+ ## Phase D2 — record the gating decision (only if configured)
579
+
580
+ **Only when `specs/.core/gating.config.json` exists.** Make sure the
581
+ `> **Gating:**` header carries the Phase A item 10 answer — a flag name, or
582
+ `none: <reason>` using the config's `default` wording if it sets one. Nothing is
583
+ provisioned or enforced by this: the header exists so the decision is
584
+ **on the record and reviewable**, and `skitterspec gating check` reports a spec that has
585
+ none. It never blocks. If the config is absent, do not write the line at all.
586
+
587
+ ## Phase E — link to a ticketing provider (only if one is installed)
588
+
589
+ **Only when a ticketing provider is installed and configured** (it ships the
590
+ `/spec-push` · `/spec-status` skills and a provider config under
591
+ `specs/.core/`). If none is present, skip this phase entirely — the spec stays
592
+ local-only and `/spec` behaves exactly as above. When a provider is present, link
593
+ the spec to the tracker after writing it, so status and discussion live there
594
+ while the repo stays the source of truth — follow the provider's link steps
595
+ below (nothing to do here without one).
596
+
597
+ **Only when `specs/.core/github.config.json` exists** (GitHub sync is opted in).
598
+ If it's absent, skip this entirely — the spec stays local-only and the skill
599
+ behaves exactly as above. When present, link the spec you just wrote so status
600
+ and discussion live in GitHub while the repo stays the source of truth. A spec is
601
+ a GitHub **issue**; each phase is a **sub-issue**, carrying that phase's tasks in
602
+ its description as a read-only checklist.
603
+
604
+ **Linking is just the first push**, so it runs the same engine path `/spec-push`
605
+ does — you never create the issue by hand:
606
+
607
+ 1. **Pick the transport.** `skitterspec spec-sync states --json`. With a GitHub
608
+ token set it answers `api` and prints the board's Status options; without
609
+ one it answers `mcp` and you do the MCP work `/spec-push` describes. Write
610
+ the option names to a file for step 2.
611
+ 2. **Get the plan.**
612
+ `skitterspec spec-sync plan <spec> --workspace-states <file> --json > plan.json`
613
+ — the spec is unlinked, so this plan is all-creates: the issue and one
614
+ sub-issue per phase.
615
+ 3. **Apply it.**
616
+ `skitterspec spec-sync apply <spec> --plan plan.json`. There is no project
617
+ to pick: the issue lands in the configured repo, on the configured board.
618
+ That creates the issue and its sub-issues, adds each to the board with its
619
+ Status, and checks what GitHub stored. It then
620
+ **stamps the numbers into the spec** — `github_identifier`/`github_url` on the
621
+ overview, `github_issue_id` on each phase — and **records the base snapshot**,
622
+ so `/spec-status` reports in-sync immediately. There is no hand-editing of
623
+ frontmatter and no separate `stamp` or `record` call.
624
+
625
+ If it prints `transport = mcp`, it wrote nothing: apply the plan over MCP as
626
+ `/spec-push` steps 4a–5 describe, ending with `spec-sync stamp` and
627
+ `spec-sync record`. That path is fully supported — it is what anyone without
628
+ credentials uses.
629
+ 4. **Echo the branch name** from `branch.pattern` so the user knows what
630
+ `/spec-start` will fork.
631
+
632
+ **If GitHub can't be reached**, say so in one line and leave the spec written and
633
+ local — it is still a perfectly good spec, and `/spec-push` links it later. Do
634
+ nothing destructive.
635
+
636
+ **A spec that adopted an existing issue** (see the intake step) is already
637
+ stamped, so its plan is an **update**, not a create: applying it replaces the
638
+ reporter's description with the spec. That is the one-way rule working as
639
+ intended — the repo is canonical, and the original was preserved as a comment
640
+ on the issue by the intake step. Nothing re-homes an adopted issue: where it
641
+ lives stays GitHub's.
642
+
643
+ Leave committing to the existing convention (the user commits the spec as usual)
644
+ and **never auto-push git** — GitHub's own automation reacts to real branch/PR
645
+ events later. Report the GitHub issue URL as part of the skill's finish-up
646
+ message.
647
+
648
+ GitHub has no project picker: a minted issue lands in the configured
649
+ `github.owner`/`github.repo`, on the one board `github.project` names — both
650
+ decided once in `specs/.core/github.config.json`. There is nothing to ask.
651
+
652
+ ## Report
653
+
654
+ End with the block defined in `.claude/rules/spec-reports.md`. That file carries
655
+ the shape; this section carries only what is specific here.
656
+
657
+ **Verdicts**
658
+
659
+ - `✅` — a `Ready` spec is written to `specs/backlog/<name>/`.
660
+ - `⚠️` — written as `Draft`; open questions were deliberately left. Name them.
661
+ - `❌` — the spec was committed and the land failed part-way: the rebase
662
+ conflicted, or the fast-forward was refused. There is a standing worktree and a
663
+ branch to deal with, so say where both are.
664
+ - `⏸` — grilling did not reach a shared understanding, so nothing was written.
665
+ That is the skill working: a spec written over an unresolved requirement is
666
+ the outcome Phase A exists to prevent.
667
+
668
+ **Fields:** `Tracker` · `Spec` · `Built` · `Landed` · `Worktree` · `Follow-ups` ·
669
+ `Next`
670
+
671
+ `Built` is the spec's path and phase count; `Spec` is its status and bucket;
672
+ `Tracker` appears only when a provider is installed and linked it.
673
+
674
+ `Landed` and `Worktree` belong to the **verdict** half of the run and appear
675
+ only once one has been acted on — a run that is still waiting on the page has
676
+ neither. `Landed` says the base branch fast-forwarded and to what; `Worktree`
677
+ says kept (on `commit-start`) or removed (on `commit`), with the path. Neither
678
+ appears where isolation is off: nothing was provisioned and nothing was landed.
679
+
680
+ **`Next` depends on whether Phase C2 rendered a page.** Where it did, the run is
681
+ waiting on a verdict, so the block **omits the `Review` row** and ends on the
682
+ banner defined in `.claude/rules/spec-reports.md` — counts, the tier stack, and
683
+ this page's two exits:
684
+
685
+ ---
686
+
687
+ ## ⏸ Review ready — &lt;N&gt; files, +&lt;a&gt; −&lt;d&gt;
688
+
689
+ - **local** — &lt;the `local:` URL&gt;
690
+ - **network** — &lt;the `network:` URL, or off with the command that turns it on&gt;
691
+ - **remote** — &lt;the `remote:` URL, or off with the command that turns it on&gt;
692
+
693
+ I'm holding here until you send a verdict — the wait covers local and network.
694
+
695
+ `Commit & Start` puts it in flight · `Commit` keeps it for later
696
+
697
+ ---
698
+
699
+ There `Next` names the page rather than a command, because the button is what
700
+ carries the work on.
701
+
702
+ **Neither exit leaves the spec anywhere awkward**, and the banner does not
703
+ explain that — the whole point of Phase B is that there is nothing to warn
704
+ about. Both buttons commit and land, so either way the spec reaches the base
705
+ branch as one commit; the only difference is whether the worktree stays.
706
+
707
+ Where no page was rendered — isolation is not configured, or nothing was
708
+ written — `Next` is `/spec-start <name>`, with the name spelled the way it must
709
+ be typed.
710
+
711
+ **A spec written without a page is still uncommitted**, so that `Next` relies on
712
+ `/spec-start` committing the spec when it is all that is uncommitted. Say
713
+ `/commit, then /spec-start <name>` when anything else is uncommitted too, or the
714
+ row sends the reader to a refusal.
715
+
716
+ **`Follow-ups` is almost always `none` here.** This skill's whole job is to
717
+ capture work, so anything it surfaced belongs in the spec it just wrote rather
718
+ than in a follow-up line beneath it.