superspecs 0.1.0 → 0.2.0

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.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: cross-linker
3
+ description: Scan the wiki vault for unlinked mentions of page titles and topics. Insert [[wikilinks]] automatically. Run after /wiki ingest or standalone. Triggers on /cross-linker, "cross-link the wiki", "add wikilinks", "link wiki pages".
4
+ slash_command: cross-linker
5
+ phase: "3.2 — Verify › Wiki Cross-link"
6
+ ---
7
+
8
+ # Skill: cross-linker
9
+
10
+ You are weaving the knowledge graph. After new pages are ingested, unlinked mentions of their topics exist across the vault — prose that says "JWT refresh" without linking to `[[auth/jwt-refresh]]`. You find those gaps and insert `[[wikilinks]]`.
11
+
12
+ ---
13
+
14
+ ## Steps
15
+
16
+ ### 1. Build the link target map
17
+
18
+ Scan every `.md` file in `superspec/wiki/` (excluding `raw/`, `.obsidian/`, `_meta/`).
19
+
20
+ For each page, collect:
21
+ - The page path (e.g. `auth/jwt-refresh`)
22
+ - The `title:` from frontmatter
23
+ - Common aliases: derived from the title (e.g. "JWT Refresh", "jwt refresh", "JWT refresh token")
24
+ - Any explicit `aliases:` field in frontmatter if present
25
+
26
+ Build a lookup: `alias → [[domain/page]]`
27
+
28
+ ---
29
+
30
+ ### 2. Scan all pages for unlinked mentions
31
+
32
+ For each wiki page, scan the body text for occurrences of any alias from the map that:
33
+ 1. Is **not already inside a `[[wikilink]]`**
34
+ 2. Is **not in a code block** (fenced ``` or inline `` ` ``)
35
+ 3. Is **not in a heading** (`#`, `##`, etc.)
36
+ 4. Is **not a self-reference** (page doesn't link to itself)
37
+ 5. Appears as a **standalone phrase** (not a substring of a longer word)
38
+
39
+ Collect all candidates: `{page, line, alias, target}`.
40
+
41
+ ---
42
+
43
+ ### 3. Apply links — first occurrence per page only
44
+
45
+ For each candidate:
46
+ - Link only the **first occurrence** of each alias per page
47
+ - Replace the plain text with `[[target|alias]]` if the alias differs from the page title, or `[[target]]` if it matches exactly
48
+ - Preserve surrounding punctuation and capitalization
49
+
50
+ Example:
51
+ ```
52
+ Before: The system uses JWT refresh tokens to maintain sessions.
53
+ After: The system uses [[auth/jwt-refresh|JWT refresh tokens]] to maintain sessions.
54
+ ```
55
+
56
+ Do **not** link:
57
+ - Occurrences in frontmatter
58
+ - Occurrences already inside `[[...]]`
59
+ - Occurrences inside code blocks
60
+ - Generic words that happen to match a title (use judgment — "data" should not auto-link to a page titled "Data")
61
+
62
+ ---
63
+
64
+ ### 4. Avoid over-linking
65
+
66
+ Apply these guards:
67
+ - Skip aliases shorter than 4 characters (too generic)
68
+ - Skip aliases that are common English words unlikely to be intentional references (use judgment)
69
+ - If uncertain: skip and note it in the report
70
+
71
+ ---
72
+
73
+ ### 5. Write changes
74
+
75
+ For each modified page:
76
+ - Apply all link insertions in a single write (don't write page multiple times)
77
+ - Update the `updated:` date in frontmatter to today
78
+
79
+ ---
80
+
81
+ ### 6. Report
82
+
83
+ ```
84
+ Cross-link complete
85
+
86
+ Pages scanned: N
87
+ Pages modified: M
88
+ Links inserted: K
89
+
90
+ Changes:
91
+ - auth/session-management.md: 3 links inserted
92
+ - "JWT refresh" → [[auth/jwt-refresh]]
93
+ - "Redis" → [[infra/redis-cache]]
94
+ - "session TTL" → [[auth/session-management]] (self-link skipped)
95
+ - patterns/error-handling.md: 1 link inserted
96
+ - "circuit breaker" → [[patterns/circuit-breaker]]
97
+
98
+ Skipped (ambiguous):
99
+ - data/pipeline.md: "data" matched [[data/Home]] — too generic, skipped
100
+
101
+ Append to log.md: [YYYY-MM-DD] cross-link | K links inserted across M pages
102
+ ```
103
+
104
+ ---
105
+
106
+ ### 7. Append to log.md
107
+
108
+ ```markdown
109
+ ## [<YYYY-MM-DD>] cross-link | <K> links inserted across <M> pages
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Output
115
+
116
+ - Modified wiki pages with `[[wikilinks]]` inserted
117
+ - Updated `updated:` dates in modified pages
118
+ - Appended `superspec/wiki/log.md`
119
+ - Cross-link report in response
@@ -0,0 +1,289 @@
1
+ ---
2
+ name: design-import
3
+ description: Import a DesignOS export as structured context for Phase 1 planning. Reads the export and creates a design-context.md that enriches /discuss and /spec with design constraints, data shapes, milestone structure, and test scaffolding. Optional — the normal /discuss + /spec flow still runs. Triggers on /design-import, "import design", "import DesignOS", "import from design export".
4
+ slash_command: design-import
5
+ phase: "1.x — Plan › Design Import (optional)"
6
+ ---
7
+
8
+ # Skill: design-import
9
+
10
+ You are enriching the Phase 1 planning process with a DesignOS export.
11
+
12
+ This is an **optional step** — it does not replace `/discuss` or `/spec`. It reads a DesignOS export and extracts the design constraints, data shapes, milestone structure, and test scaffolding into a `design-context.md` file. The normal `/discuss` + `/spec` flow then uses both the discussion and the design context together.
13
+
14
+ **Use it to integrate a DesignOS-built prototype into your planning — not to skip planning.**
15
+
16
+ ---
17
+
18
+ ## When to run it
19
+
20
+ ```
21
+ # Run before /discuss — design context informs the conversation:
22
+ /design-import <path> → /discuss → /spec → /grill
23
+
24
+ # Run after /discuss — enrich discussion with design details before writing spec:
25
+ /discuss → /design-import <path> → /spec → /grill
26
+
27
+ # Run alongside /discuss — reference the context during discussion:
28
+ /discuss (with design-context.md open as reference) + /design-import <path>
29
+ ```
30
+
31
+ All paths still go through `/discuss`, `/spec`, and `/grill`. The design import adds structured input; it doesn't make those steps optional.
32
+
33
+ ---
34
+
35
+ ## Expected DesignOS Export Structure
36
+
37
+ ```
38
+ <export-folder>/
39
+ ├── product-plan/
40
+ │ ├── product-overview.md ← product description, goals, non-goals
41
+ │ ├── one-shot-instructions.md ← (optional) full one-shot guide
42
+ │ └── incremental/
43
+ │ ├── 01-shell.md ← milestone 1: design tokens + app shell
44
+ │ ├── 02-<section>.md ← milestone 2: first content section
45
+ │ └── NN-<section>.md ← milestone N: last section
46
+
47
+ ├── design-system/
48
+ │ ├── tokens.css ← CSS custom properties
49
+ │ ├── tailwind.config.js ← Tailwind configuration
50
+ │ └── fonts.md ← font setup
51
+
52
+ ├── data-shape/
53
+ │ ├── types.ts ← TypeScript interfaces
54
+ │ ├── sample-data.ts ← sample data
55
+ │ └── entities.md ← entity documentation
56
+
57
+ ├── components/
58
+ │ └── <section>/
59
+ │ └── screenshots/ ← visual references
60
+
61
+ └── test-instructions/
62
+ ├── tests.md ← overall test specification
63
+ ├── user-flow-tests.md ← (optional) end-to-end user flows
64
+ └── <section>-tests.md ← per-section test specs
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Steps
70
+
71
+ ### 1. Locate the export
72
+
73
+ Ask the user for the path to the DesignOS export folder if not provided.
74
+
75
+ Verify the folder exists and contains at minimum `product-plan/product-overview.md`.
76
+
77
+ If the structure is partial (some files missing), proceed with what's available and note gaps.
78
+
79
+ ---
80
+
81
+ ### 2. Read the export
82
+
83
+ Read in this order:
84
+
85
+ 1. `product-plan/product-overview.md` — product description, goals, constraints
86
+ 2. `product-plan/incremental/` — all milestone files, sorted numerically
87
+ 3. `test-instructions/tests.md` + per-section test files
88
+ 4. `data-shape/types.ts` + `entities.md`
89
+ 5. `design-system/tokens.css` — skim for token naming convention
90
+
91
+ Do NOT read component `.tsx` files — they are reference material, not planning input.
92
+
93
+ ---
94
+
95
+ ### 3. Check for existing DISCUSS.md
96
+
97
+ Check if `superspec/specs/<slug>/DISCUSS.md` already exists.
98
+
99
+ - **If it does:** the design context will enrich it — merge relevant design decisions into the existing doc (Step 4b)
100
+ - **If it doesn't:** create `design-context.md` as standalone context for the upcoming `/discuss` session (Step 4a)
101
+
102
+ If no slug exists yet, derive one from the product name in `product-overview.md`.
103
+
104
+ ---
105
+
106
+ ### 4a. Create design-context.md (no DISCUSS.md yet)
107
+
108
+ Create `superspec/specs/<slug>/design-context.md`:
109
+
110
+ ```markdown
111
+ # Design Context: <Product Name>
112
+
113
+ Source: DesignOS export — <export-folder-name>
114
+ Imported: <today>
115
+
116
+ > This file is input for `/discuss` and `/spec`. It captures the design constraints,
117
+ > data contract, milestone plan, and test scaffolding from the DesignOS export.
118
+ > Review it before running `/discuss` so these decisions inform the conversation.
119
+
120
+ ---
121
+
122
+ ## Product Overview
123
+
124
+ <Summary from product-overview.md — what the product is and why it exists>
125
+
126
+ ## Design System (locked)
127
+
128
+ The following are provided by the DesignOS export and should be treated as constraints, not decisions to re-make:
129
+
130
+ - **CSS tokens:** `design-system/tokens.css` — all colors, spacing, typography
131
+ - **Tailwind config:** `design-system/tailwind.config.js`
132
+ - **Fonts:** see `design-system/fonts.md`
133
+
134
+ No hardcoded color or spacing values. All styling via the token set.
135
+
136
+ ## Data Contract
137
+
138
+ Types from `data-shape/types.ts` that are relevant to planning:
139
+
140
+ ```typescript
141
+ <key interfaces — trimmed to what matters for behavior decisions>
142
+ ```
143
+
144
+ Entity relationships: <summary from entities.md>
145
+
146
+ ## Build Order (Incremental Milestones)
147
+
148
+ The DesignOS export defines N milestones. Each should become one execution wave:
149
+
150
+ | Wave | Milestone | What it builds |
151
+ |------|-----------|---------------|
152
+ | 1 | 01-shell | Design tokens applied, app shell structure |
153
+ | 2 | 02-<section> | <section description> |
154
+ | … | … | … |
155
+
156
+ **Shell (Wave 1) must complete before any section wave.** Each section wave depends on the shell having established design tokens and layout structure.
157
+
158
+ ## Test Scaffolding
159
+
160
+ Key behaviors from `test-instructions/tests.md` to incorporate into spec scenarios:
161
+
162
+ <Extracted test scenarios as bullet points — what needs to be verified>
163
+
164
+ **User flows:**
165
+ <From user-flow-tests.md if present>
166
+
167
+ **Per-section tests:**
168
+ <Summarized from section test files>
169
+
170
+ ## Open Questions for /discuss
171
+
172
+ Based on the export, these decisions still need to be made in the discussion:
173
+
174
+ - [ ] <Gap or ambiguity found in the export>
175
+ - [ ] <Stack/framework choice if not specified>
176
+ - [ ] <Integration points not covered by the design>
177
+
178
+ ## Visual References
179
+
180
+ Screenshots preserved in `superspec/wiki/raw/design-system/screenshots/` for use during execution.
181
+ ```
182
+
183
+ ---
184
+
185
+ ### 4b. Enrich existing DISCUSS.md
186
+
187
+ If DISCUSS.md already exists, add a `## Design Import` section to it:
188
+
189
+ ```markdown
190
+ ## Design Import
191
+
192
+ Source: DesignOS export — <export-folder-name>
193
+ Imported: <today>
194
+
195
+ ### Design System Constraints (locked)
196
+ - CSS tokens: `design-system/tokens.css` — use as-is
197
+ - Tailwind: `design-system/tailwind.config.js` — use as-is
198
+ - No hardcoded styling values
199
+
200
+ ### Data Contract
201
+ <Key types from types.ts relevant to this feature>
202
+
203
+ ### Milestone Structure → Waves
204
+ | Wave | Milestone | What it builds |
205
+ |------|-----------|---------------|
206
+ | 1 | 01-shell | Design tokens + shell |
207
+ | … | … | … |
208
+
209
+ ### Test Scaffolding
210
+ <Key test scenarios to incorporate into spec>
211
+
212
+ ### Additional Open Questions
213
+ - [ ] <Gaps found in the design export>
214
+ ```
215
+
216
+ ---
217
+
218
+ ### 5. Preserve design assets in wiki/raw/
219
+
220
+ Copy to `superspec/wiki/raw/design-system/`:
221
+
222
+ ```
223
+ superspec/wiki/raw/design-system/
224
+ ├── tokens.css
225
+ ├── tailwind.config.js
226
+ ├── fonts.md
227
+ ├── entities.md
228
+ └── screenshots/
229
+ └── <section>/
230
+ ```
231
+
232
+ Create `superspec/wiki/raw/design-system/README.md` with source info and link to spec slug.
233
+
234
+ ---
235
+
236
+ ### 6. Update status.md
237
+
238
+ If status.md exists, add a line. If not, create it:
239
+
240
+ ```markdown
241
+ ## Design Import
242
+ - [x] DesignOS export imported (design-context.md)
243
+ - [x] Design assets preserved (wiki/raw/design-system/)
244
+ ```
245
+
246
+ ---
247
+
248
+ ### 7. Handoff
249
+
250
+ ```
251
+ Design import complete: <slug>
252
+
253
+ Created: superspec/specs/<slug>/design-context.md
254
+ Preserved: superspec/wiki/raw/design-system/
255
+
256
+ What was extracted:
257
+ - Design system constraints (tokens, Tailwind, fonts)
258
+ - Data contract (N TypeScript interfaces)
259
+ - N milestones → N execution waves (sequential)
260
+ - Test scaffolding (N scenarios)
261
+ - N open questions for /discuss
262
+
263
+ Next steps:
264
+ /superspecs:discuss <slug> Open the discussion (design-context.md is ready as input)
265
+ /superspecs:spec <slug> Write the spec (reads DISCUSS.md + design-context.md)
266
+ ```
267
+
268
+ ---
269
+
270
+ ## How /spec uses design-context.md
271
+
272
+ When `/spec` runs, it should check for `design-context.md` alongside `DISCUSS.md`:
273
+
274
+ - Design system constraints → Non-Functional Requirements + Out of Scope section
275
+ - Data contract types → Interface/Contract section
276
+ - Milestone structure → waves in `tasks.md`
277
+ - Test scaffolding → GIVEN/WHEN/THEN scenarios (starting points, not verbatim copy)
278
+ - Open questions → open questions in DISCUSS.md (if not yet addressed)
279
+
280
+ The spec writer merges both sources. DISCUSS.md carries the human decisions; design-context.md carries the design constraints.
281
+
282
+ ---
283
+
284
+ ## Output
285
+
286
+ - `superspec/specs/<slug>/design-context.md` (if no DISCUSS.md exists)
287
+ - OR enriched `superspec/specs/<slug>/DISCUSS.md` (if DISCUSS.md already exists)
288
+ - `superspec/wiki/raw/design-system/` (design assets for later wiki ingest)
289
+ - Updated `superspec/specs/<slug>/status.md`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: execute-subagent
3
- description: Dispatch fresh subagents per task for parallel execution. Two-stage review per task. Human checkpoints between waves. Triggers on /subagent, "start executing", "run the tasks", "dispatch agents". Run after /branch.
3
+ description: Dispatch fresh subagents per task for parallel execution. Each subagent runs RED-GREEN-REFACTOR TDD on their task. Two-stage review per task. Human checkpoints between waves. Triggers on /subagent, "start executing", "run the tasks", "dispatch agents". Run after /branch.
4
4
  slash_command: subagent
5
5
  phase: "2.3 — Execute › Subagent Development"
6
6
  ---
@@ -11,9 +11,12 @@ You are orchestrating subagent-driven execution.
11
11
 
12
12
  Each subagent gets a **clean 200k-token context**: the spec, one task, and the codebase. Nothing else. No prior chat history. No shared state.
13
13
 
14
+ **TDD is not a separate step after subagent development. TDD happens inside every subagent task.** Each task follows RED → GREEN → REFACTOR before it is considered done. The `/superspecs:tdd` skill defines the cycle; this skill embeds it into every task.
15
+
14
16
  ## Core Principles
15
17
 
16
18
  - **Fresh context per task.** Each subagent starts clean.
19
+ - **TDD per task.** Every task: RED → GREEN → REFACTOR → commit. No exceptions.
17
20
  - **Two-stage review per task.** Every task gets reviewed for spec compliance first, then code quality.
18
21
  - **Human checkpoints between waves.** No wave starts without human approval.
19
22
  - **Critical findings block progress.** A Critical issue in code review stops the wave.
@@ -46,11 +49,29 @@ For each task in this wave, assemble the context package. This is what each suba
46
49
  Branch: superspec/<slug>
47
50
  Relevant files: <list files the task touches>
48
51
 
49
- ## Rules
50
- 1. Write the failing test first (see /tdd skill)
51
- 2. Make it pass with minimum code
52
- 3. Run all tests after your change
53
- 4. Commit with message: "task <task-id>: <short description>"
52
+ ## TDD — Non-Negotiable
53
+ You follow RED GREEN REFACTOR for every piece of implementation code.
54
+
55
+ **RED**
56
+ 1. Write a failing test for the behavior described in your task
57
+ 2. Run it — confirm it fails for the RIGHT reason (feature missing, not a syntax error)
58
+ - If it passes immediately: the test is wrong. Rewrite it.
59
+ - If it fails for the wrong reason: fix the test, not the implementation.
60
+
61
+ **GREEN**
62
+ 3. Write the minimum code to make the test pass
63
+ - No YAGNI additions. No refactoring yet.
64
+ 4. Run the test — confirm PASS
65
+ 5. Run the full test suite — confirm no regressions
66
+
67
+ **REFACTOR**
68
+ 6. Clean up: duplication, naming, complexity — keep tests green throughout
69
+ 7. Run the full suite after each refactor step
70
+
71
+ **COMMIT**
72
+ 8. `git commit -m "task <task-id>: <description>"`
73
+
74
+ **Code written before a failing test exists gets deleted. Start over from RED.**
54
75
 
55
76
  ## Done When
56
77
  <done criteria from tasks.md for this task>
@@ -59,11 +80,10 @@ Relevant files: <list files the task touches>
59
80
  ### 3. Execute the wave
60
81
 
61
82
  #### Sequential tasks
62
- Execute task by task. After each:
63
- 1. Run `/tdd` enforcement (see tdd skill)
64
- 2. Run `/code-review` (see code-review skill)
65
- 3. If Critical finding: STOP. Report. Wait for resolution.
66
- 4. If no Critical finding: proceed to next task.
83
+ Execute task by task. For each task, the subagent follows the full TDD cycle (RED-GREEN-REFACTOR) as defined in the context package above. After TDD is complete:
84
+ 1. Run `/code-review` (see code-review skill)
85
+ 2. If Critical finding: STOP. Report. Wait for resolution.
86
+ 3. If no Critical finding: proceed to next task.
67
87
 
68
88
  #### Parallel tasks
69
89
  For tasks that can run in parallel (stated in plan.md):
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: execute-tdd
3
- description: Enforce RED-GREEN-REFACTOR for every implementation task. Write failing test, watch it fail, write minimal code, watch it pass, commit. Delete code written before tests. Activates during implementation. Triggers on /tdd, when a task starts, or when code is being written without a test.
3
+ description: Enforce RED-GREEN-REFACTOR for every implementation task. This cycle runs inside each subagent task not as a separate sequential step. Triggers on /tdd, when a task starts, or when code is being written without a failing test. Also used standalone when implementing outside of subagent mode.
4
4
  slash_command: tdd
5
- phase: "2.4 — Execute › TDD"
5
+ phase: "2.3 — Execute › per task (TDD)"
6
6
  ---
7
7
 
8
8
  # Skill: execute-tdd
9
9
 
10
- You are enforcing test-driven development. This skill activates during every implementation task.
10
+ You are enforcing test-driven development. **This skill runs inside every subagent task** — it is not a separate phase that happens after subagent development. Every implementation task, in every wave, follows this cycle.
11
+
12
+ If you are implementing code outside of subagent mode (e.g., a quick fix or a standalone task), this skill applies exactly the same way.
11
13
 
12
14
  ## The Law
13
15
 
@@ -19,12 +19,21 @@ Decisions made during planning are cheap. Decisions discovered during implementa
19
19
 
20
20
  ### 1. Orient with the wiki
21
21
 
22
- Before asking anything, check `superspec/wiki/`:
23
- - Read `_index.md`
24
- - Scan domain folders relevant to what's being described
25
- - Note: existing patterns, past decisions, anything that should inform this discussion
22
+ Before asking anything, scan the wiki for relevant context using tiered retrieval:
26
23
 
27
- Report what you found (or "wiki is empty / nothing relevant").
24
+ **Tier 1 Index scan (always):**
25
+ - Read `superspec/wiki/Home.md` — domain catalog and recent ingest activity
26
+ - Read only the frontmatter (`title`, `tags`, `summary`) of every page in `superspec/wiki/` (skip `raw/`, `.obsidian/`)
27
+ - Score each page for relevance to the feature being described
28
+
29
+ **Tier 2 — Deep read (targeted):**
30
+ - Open the full body of the 3–5 most relevant pages
31
+ - Follow `[[wikilinks]]` one level deep for directly related pages
32
+
33
+ **Report before the first question:**
34
+ - List relevant pages found with a one-line summary of what each contributes
35
+ - Flag decisions, patterns, or interfaces that should inform or constrain this discussion
36
+ - If the wiki is empty or nothing is relevant: say so explicitly — "Wiki has no relevant pages for this feature."
28
37
 
29
38
  ### 2. Understand the rough idea
30
39