@seanyao/roll 0.5.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.
Files changed (50) hide show
  1. package/README.md +201 -0
  2. package/bin/roll +1375 -0
  3. package/conventions/config.yaml +15 -0
  4. package/conventions/global/.cursor-rules +31 -0
  5. package/conventions/global/AGENTS.md +100 -0
  6. package/conventions/global/CLAUDE.md +32 -0
  7. package/conventions/global/GEMINI.md +28 -0
  8. package/conventions/templates/backend-service/.cursor-rules +17 -0
  9. package/conventions/templates/backend-service/AGENTS.md +88 -0
  10. package/conventions/templates/backend-service/CLAUDE.md +18 -0
  11. package/conventions/templates/backend-service/GEMINI.md +16 -0
  12. package/conventions/templates/cli/.cursor-rules +17 -0
  13. package/conventions/templates/cli/AGENTS.md +66 -0
  14. package/conventions/templates/cli/CLAUDE.md +18 -0
  15. package/conventions/templates/cli/GEMINI.md +16 -0
  16. package/conventions/templates/frontend-only/.cursor-rules +16 -0
  17. package/conventions/templates/frontend-only/AGENTS.md +71 -0
  18. package/conventions/templates/frontend-only/CLAUDE.md +16 -0
  19. package/conventions/templates/frontend-only/GEMINI.md +14 -0
  20. package/conventions/templates/fullstack/.cursor-rules +17 -0
  21. package/conventions/templates/fullstack/AGENTS.md +87 -0
  22. package/conventions/templates/fullstack/CLAUDE.md +17 -0
  23. package/conventions/templates/fullstack/GEMINI.md +15 -0
  24. package/package.json +33 -0
  25. package/skills/roll-.changelog/SKILL.md +79 -0
  26. package/skills/roll-.clarify/SKILL.md +59 -0
  27. package/skills/roll-.echo/SKILL.md +113 -0
  28. package/skills/roll-.qa/SKILL.md +204 -0
  29. package/skills/roll-.review/SKILL.md +105 -0
  30. package/skills/roll-build/SKILL.md +559 -0
  31. package/skills/roll-debug/SKILL.md +428 -0
  32. package/skills/roll-design/ENGINEERING_CHECKLIST.md +256 -0
  33. package/skills/roll-design/SKILL.md +276 -0
  34. package/skills/roll-fix/SKILL.md +442 -0
  35. package/skills/roll-jot/SKILL.md +50 -0
  36. package/skills/roll-research/SKILL.md +307 -0
  37. package/skills/roll-research/references/schema.json +162 -0
  38. package/skills/roll-research/scripts/md_to_pdf.py +289 -0
  39. package/skills/roll-sentinel/SKILL.md +355 -0
  40. package/skills/roll-spar/SKILL.md +287 -0
  41. package/template/.env.example +47 -0
  42. package/template/.github/workflows/ci.yml +32 -0
  43. package/template/.github/workflows/sentinel.yml +26 -0
  44. package/template/AGENTS.md +80 -0
  45. package/template/BACKLOG.md +42 -0
  46. package/template/package.json +43 -0
  47. package/tools/roll-fetch/SKILL.md +182 -0
  48. package/tools/roll-fetch/package.json +15 -0
  49. package/tools/roll-fetch/smart-web-fetch.js +558 -0
  50. package/tools/roll-probe/SKILL.md +84 -0
@@ -0,0 +1,105 @@
1
+ ---
2
+ hidden: true
3
+ name: roll-.code-review
4
+ description: Self code review step in the TCR workflow. Runs after each micro-step is completed and before commit, checking code quality, security, and design issues.
5
+ ---
6
+
7
+ # WK Self Code Review
8
+
9
+ **Quality gate for the TCR loop** - Self-review after each micro-step is completed and before commit.
10
+
11
+ ## Position in WK Workflow
12
+
13
+ ```
14
+ TCR Loop:
15
+ Write Test → Run Test → ✅ Green → Self Review → Commit
16
+
17
+ Critical?
18
+ Yes → Fix → Redo
19
+ No → Proceed
20
+ ```
21
+
22
+ ## When Triggered
23
+
24
+ - **Auto-triggered**: After each TCR micro-step in `$roll-story` / `$roll-fix` / `$roll-fly`
25
+ - **Manual trigger**: When the user wants to review current changes
26
+
27
+ ## Review Scope
28
+
29
+ ```bash
30
+ # Default: review staged changes (recommended for TCR)
31
+ $roll-.review staged
32
+
33
+ # Review all uncommitted changes
34
+ $roll-.review unstaged
35
+
36
+ # Review specific files
37
+ $roll-.review files src/utils.ts
38
+ ```
39
+
40
+ ## Review Dimensions (6 Core Dimensions)
41
+
42
+ ```
43
+ ┌─────────────────────────────────────────────────────────┐
44
+ │ WK Quality Checklist │
45
+ ├─────────────────────────────────────────────────────────┤
46
+ │ ✅ Correctness - Logic is correct, no bugs │
47
+ │ ✅ Security - No vulnerabilities, input valid. │
48
+ │ ✅ Maintainability - Clear naming, sound structure │
49
+ │ ✅ Performance - No performance pitfalls │
50
+ │ ✅ Testability - Easy to test, edge cases covered │
51
+ │ ✅ Scope - Focused on current task, no │
52
+ │ unrelated changes │
53
+ └─────────────────────────────────────────────────────────┘
54
+ ```
55
+
56
+ ## Severity Levels and Decisions
57
+
58
+ | Level | Definition | Decision |
59
+ |-------|-----------|----------|
60
+ | 🔴 **Critical** | Bug, security vulnerability | **Must fix**, redo TCR |
61
+ | 🟡 **Warning** | Maintainability issue | **Recommend fix** or document |
62
+ | 🟢 **Suggestion** | Minor optimization | Optional, proceed with commit |
63
+ | ✅ **Pass** | No issues | Proceed with commit |
64
+
65
+ ## Output Format
66
+
67
+ ```markdown
68
+ ## Self Review Report
69
+ **Scope**: staged (2 files, +45/-12 lines)
70
+
71
+ ### 🔴 Critical (Must Fix)
72
+ | File | Line | Issue | Action |
73
+ |------|------|-------|--------|
74
+ | auth.ts | 23 | SQL injection | Use parameterized query |
75
+
76
+ ### 🟡 Warnings
77
+ - utils.ts:45 - Magic number, consider: `const MAX_RETRY = 3`
78
+
79
+ ### ✅ Passed
80
+ - Naming conventions
81
+ - Error handling
82
+ ```
83
+
84
+ ## TCR Integration
85
+
86
+ In each micro-step of `$roll-build`:
87
+
88
+ ```markdown
89
+ **Micro-Step X: [Description]**
90
+
91
+ 1. Write/Update Test
92
+ 2. Run Test → ✅ Green
93
+ 3. **$roll-.review staged**
94
+ - 🔴 Critical? → Fix → Redo step
95
+ - 🟡 Warning? → Quick fix or document
96
+ - ✅ Pass? → Proceed
97
+ 4. git commit -m "tcr: description"
98
+ ```
99
+
100
+ ## WK Principle Alignment
101
+
102
+ - **Agent-First**: Structured review checklist, executable by AI
103
+ - **Check Phase**: Local quality control
104
+ - **Micro-steps**: Small fast steps, each review < 100 lines
105
+ - **TCR**: Can only commit after passing self-check, ensuring repo quality
@@ -0,0 +1,559 @@
1
+ ---
2
+ name: roll-build
3
+ description: "Universal delivery skill. Handles any input: a US-XXX ID executes from BACKLOG via TCR; a FIX-XXX redirects to roll-fix; any other text auto-clarifies, designs, and ships as a new Story."
4
+ ---
5
+
6
+ # Roll Build (Universal Delivery)
7
+
8
+ > Follows the Architecture Constraints, Development Discipline, and Engineering Common Sense defined in the project AGENTS.md.
9
+
10
+ One entry point. Any input. Full delivery.
11
+
12
+ ## Trigger
13
+
14
+ **Input detection:**
15
+
16
+ ```
17
+ Input received
18
+ ├── matches "US-[A-Z]+-[0-9]+" → Story mode: read BACKLOG → TCR workflow
19
+ ├── matches "FIX-[A-Z]+-[0-9]+" → redirect to $roll-fix
20
+ ├── matches "IDEA-[0-9]+" → redirect to $roll-jot (lookup and expand)
21
+ └── anything else → Fly mode: clarify → design → execute
22
+ ```
23
+
24
+ **Story mode** — use when:
25
+ - The user provides a `US-XXX` identifier
26
+ - An existing backlog Story needs to be executed
27
+
28
+ **Fly mode** — use when:
29
+ - The user has a vague one-sentence request
30
+ - No `US-XXX` exists yet; planning and execution are both needed
31
+ - No input at all — ask the user what they want to build
32
+
33
+ **Redirect to `$roll-fix`** when:
34
+ - Input matches `FIX-XXX` or `BUG-XXX` pattern
35
+
36
+ Do not use for:
37
+ - Pure analysis or research with no code changes (use `$roll-design`)
38
+ - Single-line hotfix with no planning needed (use `$roll-fix`)
39
+
40
+ ## Core Philosophy
41
+
42
+ 1. **Clarity over assumptions** — When scope is unclear, clarify first
43
+ 2. **Just enough planning** — Plan to the level the uncertainty demands
44
+ 3. **TCR rhythm** — Test-first, micro-steps, auto-commit on green, auto-revert on red
45
+ 4. **Push to GitHub** — Complete implementation, commit, and push; code is on remote
46
+ 5. **Stay reversible** — Every micro-step leaves the repo in a clean, green state
47
+
48
+ ---
49
+
50
+ ## Mode A: Story Mode (US-XXX input)
51
+
52
+ Activate when input is a `US-[A-Z]+-[0-9]+` identifier.
53
+
54
+ ### Step 1: Read the Story
55
+
56
+ 1. Open `BACKLOG.md`, find the US row, follow the link to `docs/features/<feature>.md`
57
+ 2. Read the full AC / Files / Dependencies section
58
+ 3. If a plan doc (`<feature>-plan.md`) exists, read it for context
59
+
60
+ ### Step 2: Split into Actions
61
+
62
+ - Write 2–6 candidate Actions
63
+ - Pick the smallest shippable Action first
64
+ - **Granularity constraint**: Each Action completable in 2–5 minutes; split if larger
65
+ - **No placeholders**: Action descriptions must be specific and directly executable
66
+
67
+ #### 2.5 Parallel Dispatch (auto-determined)
68
+
69
+ After splitting Actions, check if they can run in parallel:
70
+
71
+ ```
72
+ Conflict detection:
73
+ ├── List files involved in each Action
74
+ ├── Same file → cannot parallelize, must run sequentially
75
+ ├── Same directory, different files → can parallelize
76
+ └── Different directories → safe to parallelize
77
+ ```
78
+
79
+ **If 2+ Actions can run in parallel, automatically enable Worktree isolation:**
80
+
81
+ ```bash
82
+ git worktree add .worktrees/{action-id} -b dispatch/{action-id}
83
+ ```
84
+
85
+ - Each sub-agent executes TCR in its own worktree
86
+ - Sub-agent briefs must be **self-contained** (include: what to do, where, how to verify, what not to do)
87
+ - After all complete: review each → merge to main → run integration tests → clean up worktrees
88
+
89
+ **Status notifications (required):**
90
+
91
+ ```
92
+ 🔀 Parallel Dispatch: N Actions running in parallel
93
+
94
+ Agent 1 [Action: ...] ⏳ Running...
95
+ Agent 2 [Action: ...] ⏳ Running...
96
+
97
+ Agent 1 [Action: ...] ✅ Done (N TCR commits)
98
+ Agent 2 [Action: ...] ✅ Done (N TCR commits)
99
+
100
+ 🔀 Merge: N/N succeeded, merging...
101
+ 🧪 Integration tests: running...
102
+ ```
103
+
104
+ When parallel conditions are not met, execute Actions sequentially.
105
+
106
+ ### Step 3: Define Verification
107
+
108
+ - Test matrix: happy path + edge/failure/regression cases
109
+ - What "online verification" means for this repo (URL, endpoint, UI flow, log signal)
110
+ - Reference `$roll-.qa` for test pyramid (unit → E2E → visual → smoke)
111
+
112
+ Proceed to the **Shared TCR Workflow** (Phase 4 onward).
113
+
114
+ ---
115
+
116
+ ## Mode B: Fly Mode (free-text or no-input)
117
+
118
+ Activate when input does not match any `US-XXX` / `FIX-XXX` pattern, or when no input is given.
119
+
120
+ ### Phase 1: Clarify & Assess
121
+
122
+ Before any code, assess clarity:
123
+
124
+ ```
125
+ 🎯 Clarified Goal: {1-2 sentences capturing user intent}
126
+ 📏 Complexity Assessment: {small|medium|large}
127
+ 🔍 Uncertainty Areas: {list what needs investigation/decision}
128
+ ```
129
+
130
+ **If uncertainty areas are non-empty or the request is vague, auto-trigger `$roll-.clarify`:**
131
+ - Output the clarification block above
132
+ - Follow with 3–5 targeted questions
133
+ - Stop and wait for user answers before proceeding
134
+
135
+ **Complexity Rules (AI coding time):**
136
+
137
+ | Level | Scope | Action |
138
+ |-------|-------|--------|
139
+ | Small | ≤3 files, 5–15 min, single concern | Skip detailed planning, implement directly |
140
+ | Medium | Crosses modules, needs trade-offs, 15–30 min | Mini-plan then implement |
141
+ | Large | Multi-step, architectural, 30–60 min+ | Full plan + split into Actions via `$roll-design` |
142
+
143
+ ### Phase 2: Create US / Actions
144
+
145
+ - Use `$roll-design` to split vague request into INVEST-compliant User Stories
146
+ - Insert US into `BACKLOG.md` under the relevant Epic > Feature group
147
+ - If a new `docs/features/<feature>.md` is needed, create it
148
+
149
+ After creation, switch to **Story mode** and execute the first US immediately.
150
+
151
+ Proceed to the **Shared TCR Workflow** (Phase 4 onward).
152
+
153
+ ---
154
+
155
+ ## Shared TCR Workflow
156
+
157
+ The following phases apply to both Story mode and Fly mode after planning is complete.
158
+
159
+ ### Phase 4: Test Design Review
160
+
161
+ Before writing implementation code:
162
+
163
+ ```
164
+ 🧪 Test Design for Action: {Action name}
165
+
166
+ Scenarios:
167
+ ├── {Happy path scenario}
168
+ ├── {Edge case scenario}
169
+ └── {Failure/regression scenario}
170
+
171
+ Test Types:
172
+ ├── Unit tests for: {logic components}
173
+ ├── Integration tests for: {API/data flows}
174
+ └── Manual verification for: {UI/visual elements}
175
+ ```
176
+
177
+ **Self-review on test design:**
178
+ - Are we testing the right behavior?
179
+ - Are edge cases covered?
180
+ - Are tests independent and deterministic?
181
+
182
+ Reference `$roll-.qa` for coverage requirements and test pyramid strategy.
183
+
184
+ **Why this phase**: TCR only guarantees code passes tests — verify tests are correct first.
185
+
186
+ ### Phase 5: TCR Implementation Loop
187
+
188
+ ```
189
+ ┌────────────────────────────────────────────────────────────┐
190
+ │ TCR CYCLE (Test && Commit || Revert) │
191
+ └────────────────────────────────────────────────────────────┘
192
+
193
+ MICRO-STEP {N}: {description of smallest testable change}
194
+
195
+ Step 1: Write/Update Test
196
+ └── Run test → Confirm RED (expected failure)
197
+
198
+ Step 2: Implement Minimal Code
199
+ └── Write just enough to make test pass
200
+
201
+ Step 3: TCR Decision
202
+ └── Run test
203
+ ├── ✅ GREEN → git commit -m "tcr: {micro-step description}"
204
+ └── ❌ RED → git checkout -- . → Retry with new approach
205
+
206
+ Step 4: Refactor (optional, while green)
207
+ └── Run test → ✅ GREEN → Amend or new TCR cycle
208
+ ```
209
+
210
+ **Micro-step guidelines:**
211
+
212
+ | Change Type | Typical Micro-Steps |
213
+ |-------------|---------------------|
214
+ | Logic / algorithm | 1 function = 1–2 micro-steps |
215
+ | API endpoint | Route → Handler → Validation → Response |
216
+ | UI component | Skeleton → Props → Interaction → Styling |
217
+ | Bug fix | Regression test → Fix → Verify |
218
+ | Refactor | Extract method → Update calls → Remove old |
219
+
220
+ Accumulate 3–5 micro-commits per Action. Each commit is a guaranteed working state.
221
+
222
+ ### Phase 6: Pre-Push CI Gate
223
+
224
+ After all micro-steps, run full CI locally before pushing:
225
+
226
+ ```bash
227
+ npm run ci:local 2>/dev/null || (npm run lint && npm run build && npm test -- --run)
228
+ ```
229
+
230
+ **If CI fails:**
231
+ ```
232
+ ❌ Local CI check failed
233
+ ├── Run 'npm run ci:fix' or 'npm run format' for auto-fixable issues
234
+ ├── Fix remaining lint/build/test errors via new TCR cycle
235
+ └── Re-run until all pass
236
+ ```
237
+
238
+ **Setup `ci:local` script (if not in `package.json`):**
239
+ ```json
240
+ {
241
+ "scripts": {
242
+ "ci:local": "npm run format:check && npm run lint && npm run build && npm run test -- --run",
243
+ "ci:fix": "npm run format && npm run lint -- --fix"
244
+ }
245
+ }
246
+ ```
247
+
248
+ **Setup pre-push hook (recommended, one-time):**
249
+ ```bash
250
+ cat > .git/hooks/pre-push << 'EOF'
251
+ #!/bin/bash
252
+ echo "🔍 Running local CI checks..."
253
+ if ! npm run ci:local 2>/dev/null && ! (npm run lint && npm run build); then
254
+ echo "❌ CI check failed, push blocked"
255
+ exit 1
256
+ fi
257
+ echo "✅ CI check passed"
258
+ EOF
259
+ chmod +x .git/hooks/pre-push
260
+ ```
261
+
262
+ ### Phase 7: Pre-Push Code Review
263
+
264
+ ```bash
265
+ $roll-.review staged
266
+ ```
267
+
268
+ **Review output:**
269
+ ```
270
+ 🔍 Self Review Report
271
+ ├── Scope: X files (+Y/-Z lines)
272
+ ├── 🔴 Critical: N issues (must fix)
273
+ ├── 🟡 Warnings: N issues (should fix)
274
+ ├── 🟢 Suggestions: N items (optional)
275
+ └── ✅ Passed dimensions: [Quality, Design, Scope, ...]
276
+ ```
277
+
278
+ **Review dimensions** (correctness guaranteed by TCR):
279
+ - 🎯 **Quality**: Naming clarity, DRY, function size, readability
280
+ - 📐 **Design**: Architecture, abstraction level, separation of concerns
281
+ - ⚠️ **Scope**: No opportunistic changes
282
+ - 📝 **Documentation**: Comments where needed
283
+
284
+ **Decision:**
285
+ ```
286
+ 🔴 Critical > 0 → Fix via new TCR cycle → Re-review
287
+ 🟡 Warnings > 0 → Fix if quick (< 5 min) or document
288
+ 🟢 Suggestions / ✅ All clear → Proceed to push
289
+ ```
290
+
291
+ ### Phase 8: Commit & Push
292
+
293
+ ```bash
294
+ # All TCR micro-commits are already made
295
+ # Squash or keep as-is based on repo convention
296
+
297
+ git log --oneline -{n} # Review TCR commits
298
+
299
+ git pull origin main --rebase
300
+ git push origin main
301
+ ```
302
+
303
+ Commit message (if squashing):
304
+ ```
305
+ {story-id}: {action description}
306
+
307
+ - {what changed}
308
+ - {why}
309
+ - {test coverage}
310
+ - TCR: {n} micro-commits
311
+ ```
312
+
313
+ ### Phase 9: Watch CI & Deploy
314
+
315
+ ```
316
+ ⏳ CI Running...
317
+ ├── ✅ PASS → Proceed to deploy
318
+ └── ❌ FAIL →
319
+ ├── Diagnose failure
320
+ ├── Create new TCR micro-step to fix
321
+ └── Push and retry
322
+ ```
323
+
324
+ Follow the repo's deployment path (Vercel / Railway / etc.) and record the deployed target.
325
+
326
+ **CI failure recovery:**
327
+ ```
328
+ 1. Diagnose: environment-specific or real failure?
329
+
330
+ 2. If real failure:
331
+ ├── git reset --soft HEAD~{n}
332
+ ├── TCR micro-step to fix
333
+ └── Push again
334
+
335
+ 3. If environment-specific:
336
+ ├── Document exception
337
+ └── Get user approval to proceed
338
+ ```
339
+
340
+ ### Phase 10: Runtime Verification
341
+
342
+ - **Web apps**: verify on deployed URL (happy path, edge cases, no regression)
343
+ - **CLI tools**: verify via command execution
344
+ - **Libraries**: verify via test usage or example scripts
345
+
346
+ ### Phase 10.5: Verification Gate (MANDATORY)
347
+
348
+ **Before marking as DONE, fresh evidence must be provided.**
349
+
350
+ ```
351
+ 🚦 Verification Gate
352
+
353
+ Evidence checklist (each item must have actual output):
354
+ ├── [ ] Tests passed: paste actual test run output
355
+ ├── [ ] Build succeeded: paste build output
356
+ ├── [ ] Online verification: screenshot / curl output / log snippet
357
+ └── [ ] No regression: verify at least one existing feature still works
358
+
359
+ Gate Decision:
360
+ ├── ✅ All items have evidence → Can mark as DONE
361
+ └── ❌ Any item missing evidence → Gather evidence before passing the gate
362
+ ```
363
+
364
+ **Hard Rule**: "I confirmed the tests passed" does not count as evidence. Must be **freshly run** command output from this session.
365
+
366
+ ### Phase 11: Write Back Status (REQUIRED)
367
+
368
+ Both locations must be updated — neither can be skipped:
369
+
370
+ **① Update BACKLOG.md index row (Status column):**
371
+
372
+ ```markdown
373
+ | [US-{ID}](docs/features/<feature>.md#us-{id}) | {Title} | ✅ Done |
374
+ ```
375
+
376
+ Change the Status from `📋 Todo` to `✅ Done`.
377
+ For Fly mode: first append an index row under the appropriate Epic > Feature group, then mark it done.
378
+
379
+ **② Update `docs/features/<feature>.md` US section:**
380
+
381
+ ```markdown
382
+ ## US-{ID} {Story Title} ✅
383
+
384
+ **Completed**: {YYYY-MM-DD}
385
+
386
+ **AC:**
387
+ - [x] {Completed acceptance criterion 1}
388
+ - [x] {Completed acceptance criterion 2}
389
+
390
+ **Files:**
391
+ - `{added/modified file 1}`
392
+ - `{added/modified file 2}`
393
+ ```
394
+
395
+ - Add ✅ to the heading
396
+ - Add `**Completed**` date
397
+ - Change AC items from `[ ]` to `[x]`
398
+ - Update Files to reflect actual changed files
399
+
400
+ If the US section does not yet exist, create the full section (AC / Files / Dependencies).
401
+
402
+ ```bash
403
+ git add BACKLOG.md docs/features/
404
+ git commit -m "docs: mark {US-ID} as completed"
405
+ git push
406
+ ```
407
+
408
+ ### Phase 12: Report & Celebrate
409
+
410
+ ```
411
+ ✅ Pushed to GitHub: origin/main
412
+ 🚀 Deployed: <url>
413
+ ✅ Verified: <what was checked>
414
+ 📦 Changes: <summary>
415
+ 🔢 Commits: <count> micro-commits via TCR
416
+ 🧪 Tests: <what tests were added/modified>
417
+ 📊 TCR Stats: <success rate, revert count if any>
418
+ 📋 Review Gate: <self-review findings summary>
419
+ 📝 BACKLOG: <US-ID> marked ✅ Done
420
+
421
+ 🎉 Shipped.
422
+
423
+ 🔄 Next Options:
424
+ 1. Continue to next Action (if Story has more)
425
+ 2. Start next US (if Fly mode created multiple)
426
+ 3. Done (if all completed)
427
+ ```
428
+
429
+ ---
430
+
431
+ ## Project Context Rule
432
+
433
+ Before creating any file or directory:
434
+
435
+ 1. **Read existing project structure** — check for `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, existing `src/`, `api/`, `cmd/` directories
436
+ 2. **Infer conventions from evidence** — don't assume a project type; observe what already exists
437
+ 3. **Follow what already exists** — introduce new patterns only when the current structure has no precedent
438
+
439
+ > `roll init` no longer asks for project type. Skills are responsible for reading context and acting accordingly.
440
+
441
+ ---
442
+
443
+ ## Hard Rules
444
+
445
+ 1. **No local-only "done"**
446
+ Work is not complete until it reaches:
447
+ commit → push → CI signal → deploy → online verification → backlog update
448
+
449
+ 2. **TCR for every micro-step**
450
+ - Each behavior change: Test → Green=Commit / Red=Revert
451
+ - No "I'll fix it in the next step" — revert and retry
452
+ - Each commit is a guaranteed working state
453
+
454
+ 3. **Test Design Review before implementation**
455
+ - Design test scenarios and edge cases first
456
+ - TCR only works if tests are correct — validate early
457
+
458
+ 4. **Micro-steps only**
459
+ - If a step feels "a bit complex", split it
460
+ - Each micro-step completable in 1–3 minutes
461
+ - **No placeholders**: Action/AC descriptions must be specific — no "TBD"
462
+
463
+ 5. **Pre-push self-review required**
464
+ - Run `$roll-.review staged` on final diff
465
+ - Fix blocking (Critical) issues via new TCR cycle
466
+
467
+ 6. **No hidden work**
468
+ - Every file changed must relate to the current Action
469
+ - No "while I'm here" refactors unless in a separate TCR cycle
470
+
471
+ 7. **Always update BACKLOG status**
472
+ - BACKLOG.md index row and `docs/features/<feature>.md` US section are both required
473
+ - Neither can be skipped
474
+
475
+ ---
476
+
477
+ ## Definition of Done (per Action)
478
+
479
+ - [ ] Story and Action clearly defined
480
+ - [ ] Test design reviewed and approved
481
+ - [ ] **TCR cycles completed** (all micro-steps via Test && Commit)
482
+ - [ ] All commits are green states (no broken commits)
483
+ - [ ] Local CI checks passed (format + lint + build + test)
484
+ - [ ] Self-code-review passed, blocking issues fixed via TCR
485
+ - [ ] Changes pushed to remote
486
+ - [ ] CI is green (or explicit, recorded exception)
487
+ - [ ] Deployed to production
488
+ - [ ] Online verification performed
489
+ - [ ] **Verification Gate passed** (fresh evidence for tests, build, deploy, no regression)
490
+ - [ ] **BACKLOG.md index status updated** (📋 → ✅, REQUIRED)
491
+ - [ ] **`docs/features/<feature>.md` US section updated** (Completed date + [x] ACs, REQUIRED)
492
+ - [ ] Summary reported to user
493
+
494
+ ---
495
+
496
+ ## TCR Recovery Patterns
497
+
498
+ ### Pattern 1: Red After Multiple Attempts
499
+
500
+ ```
501
+ If same micro-step fails 3 times:
502
+ 1. Revert to clean state
503
+ 2. Escalate: "This micro-step is actually medium complexity"
504
+ 3. Split into smaller micro-steps
505
+ 4. Retry TCR
506
+ ```
507
+
508
+ ### Pattern 2: Refactoring While Green
509
+
510
+ ```
511
+ If refactoring during green state:
512
+ Option A: Amend last commit (if refactor is tiny)
513
+ Option B: New TCR cycle (treat as new micro-step)
514
+ ```
515
+
516
+ ### Pattern 3: Test Design Was Wrong
517
+
518
+ ```
519
+ If implementation reveals test design flaw:
520
+ 1. Revert current micro-step
521
+ 2. Return to Phase 4 (Test Design Review)
522
+ 3. Update test design
523
+ 4. Resume TCR cycles
524
+ ```
525
+
526
+ ### Pattern 4: Complex State vs Simple Reset
527
+
528
+ ```
529
+ When complex state management is error-prone → consider full reset + re-initialization.
530
+ 60% less code, zero bugs is better than an elegant but fragile transition.
531
+ ```
532
+
533
+ ---
534
+
535
+ ## When to Use What
536
+
537
+ ```
538
+ roll-build → ship anything (new idea, US-ID, free-text request)
539
+ roll-fix → fix a specific known bug (FIX-XXX / BUG-XXX)
540
+ roll-design → plan and design before building (no code output)
541
+ roll-jot → fast capture a bug or idea into BACKLOG.md
542
+ roll-.clarify → passive scope clarification for vague build requests
543
+ ```
544
+
545
+ ---
546
+
547
+ ## Required Artifacts (per Action)
548
+
549
+ The agent must explicitly produce (in text) before or during execution:
550
+
551
+ - **Current User Story**: 1–3 sentences, INVEST-lean
552
+ - **Current Action**: smallest shippable increment
553
+ - **Acceptance criteria**: measurable outcomes for this Action
554
+ - **Write scope**: files/areas expected to change
555
+ - **Test Design**: scenarios, edge cases, test types
556
+ - **Test Design Review**: coverage validation result
557
+ - **TCR Log**: micro-step descriptions and commit count
558
+ - **Quality Review**: post-TCR code review result
559
+ - **Deployment target**: where it will be verified