jettypod 4.4.0 β†’ 4.4.2

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.
@@ -22,15 +22,28 @@ Guides Claude Code through speed mode implementation with autonomous analysis an
22
22
 
23
23
  ## Instructions
24
24
 
25
- When this skill is activated, you are helping implement a speed mode chore to make the happy path scenario pass. Follow this structured approach:
25
+ When this skill is activated, you are helping implement a speed mode chore to make all success scenarios pass. Follow this structured approach:
26
+
27
+ ## πŸ”‘ Critical Context
28
+
29
+ **You are working in an isolated git worktree:**
30
+ - `work start [chore-id]` created a dedicated worktree for this chore
31
+ - All file operations must use **absolute paths** from the worktree (not relative paths)
32
+ - The worktree has its own branch - changes are isolated from main
33
+ - BDD tests and unit tests run in the worktree context
34
+
35
+ **Worktree path is available in Step 0 output** - use it for all file operations.
36
+
37
+ ---
26
38
 
27
39
  ### Overview
28
40
 
29
- **Speed Mode Goal:** Implement ALL scoped functionality to make the happy path BDD scenario pass, assuming everything works correctly.
41
+ **Speed Mode Goal:** Make it work - implement ALL functionality (required + optional features) to make success scenarios pass, assuming everything works correctly.
30
42
 
31
43
  **Key Principles:**
32
- - **Implement ALL features/functions** defined in the scenario - do not skip functionality
33
- - **Assume happy path** - assume inputs are valid, files upload successfully, types are correct
44
+ - **Implement ALL features/functions** defined in scenarios - both required and optional functionality
45
+ - **All success paths** - every workflow that should work when inputs are valid
46
+ - **Assume success** - assume inputs are valid, files upload successfully, types are correct
34
47
  - **No error handling** - no validation, no edge case handling, no error messages (that's for stable mode)
35
48
  - **Fast iteration** - single file when possible, inline code over abstraction
36
49
  - **Use real infrastructure** - use the actual database/storage from your tech stack, not mocks
@@ -40,20 +53,136 @@ When this skill is activated, you are helping implement a speed mode chore to ma
40
53
 
41
54
  ---
42
55
 
56
+ ## πŸ§ͺ Unit Testing in Speed Mode - True TDD
57
+
58
+ **Unit tests are written DURING the RED→GREEN loop, not after.**
59
+
60
+ **The TDD workflow (each iteration):**
61
+ 1. **Identify next failing BDD step** - Which scenario step needs to pass next?
62
+ 2. **Write unit test for the function** - Test the specific function/logic needed
63
+ 3. **Watch unit test fail (RED)** - Confirm test catches the missing implementation
64
+ 4. **Write minimal code** - Just enough to make the unit test pass
65
+ 5. **Run unit test (GREEN)** - Verify the function works in isolation
66
+ 6. **Run BDD scenarios** - Check if this makes any BDD steps pass
67
+ 7. **Next iteration** - Repeat for next failing step
68
+
69
+ **What to unit test:**
70
+ - New functions you're creating (not framework/library code)
71
+ - Core logic and business rules
72
+ - Success scenarios only (no error cases - that's stable mode)
73
+
74
+ **Where to put unit tests:**
75
+ - Follow project conventions: `test/`, `__tests__/`, or `*.test.js` alongside code
76
+ - Check existing test files for patterns
77
+
78
+ **Example of TDD iteration:**
79
+ ```javascript
80
+ // Iteration 1: BDD step "Given a user exists" is failing
81
+
82
+ // 1. Write unit test first (RED)
83
+ test('createUser creates user with valid data', () => {
84
+ const user = createUser('John', 'john@example.com');
85
+ expect(user.name).toBe('John');
86
+ expect(user.email).toBe('john@example.com');
87
+ });
88
+ // Run: FAILS - createUser doesn't exist
89
+
90
+ // 2. Write minimal implementation (GREEN)
91
+ function createUser(name, email) {
92
+ return { name, email };
93
+ }
94
+ // Run unit test: PASSES
95
+ // Run BDD: "Given a user exists" now passes
96
+
97
+ // Iteration 2: Next failing BDD step...
98
+ ```
99
+
100
+ **Unit test scope in speed mode:**
101
+ ```javascript
102
+ // βœ… Speed mode unit tests (success paths)
103
+ test('createUser creates user with valid data', () => {
104
+ const user = createUser('John', 'john@example.com');
105
+ expect(user.name).toBe('John');
106
+ expect(user.email).toBe('john@example.com');
107
+ });
108
+
109
+ // ❌ NOT in speed mode (stable mode adds these)
110
+ test('createUser throws error for invalid email', () => {
111
+ expect(() => createUser('John', 'invalid')).toThrow();
112
+ });
113
+ ```
114
+
115
+ <details>
116
+ <summary><strong>πŸ“‹ Speed Mode Constraints (click to expand)</strong></summary>
117
+
118
+ **What to implement:**
119
+ - ALL scoped functionality - required features AND optional features from all success scenarios
120
+ - Multiple valid workflows if the feature supports them
121
+ - Success variations (different outcomes that are all correct)
122
+
123
+ **What NOT to implement:**
124
+ - ❌ Error handling (try/catch, validation, edge cases)
125
+ - ❌ Input validation (null checks, type checks, range validation)
126
+ - ❌ Error messages for failures
127
+ - ❌ Edge case handling (empty arrays, boundary values, race conditions)
128
+
129
+ **Code organization:**
130
+ - Single file when possible - keep it simple
131
+ - Inline code over separate modules initially
132
+ - Use real infrastructure (actual database/storage from your tech stack, not mocks)
133
+ - Focus: Make. All. Features. Work. (all success paths)
134
+
135
+ </details>
136
+
137
+ ---
138
+
139
+ ### Step 0: Initialize Speed Mode Context
140
+
141
+ **You are now in speed mode,** implementing a chore to make success scenarios pass.
142
+
143
+ **Get the current work context:**
144
+
145
+ ```bash
146
+ sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.parent_id, parent.title as parent_title, parent.scenario_file, wt.worktree_path, wt.branch_name FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id LEFT JOIN worktrees wt ON wi.id = wt.work_item_id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
147
+ ```
148
+
149
+ **Display to user:**
150
+
151
+ ```
152
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
+ πŸš€ SPEED MODE: Implementing Chore #[id]
154
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
+
156
+ Chore: [title]
157
+ Feature: #[parent-id] [parent-title]
158
+ Worktree: [worktree_path]
159
+ Branch: [branch_name]
160
+
161
+ Analyzing BDD scenarios to determine implementation approach...
162
+ ```
163
+
164
+ **Then proceed to Step 1.**
165
+
166
+ ---
167
+
43
168
  ## Quick Reference: Async Boundaries
44
169
 
45
170
  **Where Claude Code MUST wait for user confirmation:**
46
171
 
47
- | Phase | Location | Why |
48
- |-------|----------|-----|
49
- | Step 3 Phase 1 | Before implementing | User confirms implementation approach |
50
- | Step 4 Phase 2 | Before creating chores | User confirms proposed stable mode chores |
172
+ | Phase | Location | Why | Condition |
173
+ |-------|----------|-----|-----------|
174
+ | Step 3A | Before implementing (conditional) | User confirms implementation approach | Only if approach is ambiguous or multiple valid paths |
175
+ | Step 6 Phase 2 | Before creating stable chores | User confirms proposed stable mode chores | Always |
51
176
 
52
177
  **Where Claude Code executes autonomously:**
53
- - Step 1: Scenario analysis
178
+ - Step 0: Initialize context
179
+ - Step 1: Scenario analysis and breadcrumb check
54
180
  - Step 2: Codebase analysis
55
- - Step 3 Phase 2: RED→GREEN→REFACTOR loop
56
- - Step 4 Phases 3-4: Create chores and elevate
181
+ - Step 3: Decision to skip/ask for confirmation
182
+ - Step 4: Establish RED baseline
183
+ - Step 5: RED→GREEN→REFACTOR loop (true TDD)
184
+ - Step 6 Phase 1: Generate stable mode scenarios/steps
185
+ - Step 6 Phases 3-5: Create chores and invoke stable-mode skill
57
186
 
58
187
  ---
59
188
 
@@ -61,7 +190,7 @@ When this skill is activated, you are helping implement a speed mode chore to ma
61
190
 
62
191
  **DO NOT mark features as complete after speed mode implementation.**
63
192
 
64
- Speed mode is ONLY a checkpoint to prove the happy path works. Features are INCOMPLETE without stable mode chores that add:
193
+ Speed mode is ONLY a checkpoint to prove functionality works. Features are INCOMPLETE without stable mode chores that add:
65
194
  - Error handling and validation
66
195
  - Edge case coverage
67
196
  - Comprehensive testing
@@ -69,7 +198,7 @@ Speed mode is ONLY a checkpoint to prove the happy path works. Features are INCO
69
198
 
70
199
  **Required workflow after speed mode implementation:**
71
200
 
72
- 1. βœ… **Complete ALL speed mode chores** - Implement happy path functionality
201
+ 1. βœ… **Complete ALL speed mode chores** - Implement all success scenarios (required + optional features)
73
202
  2. βœ… **Elevate to stable mode** - Use `node jettypod.js work set-mode <feature-id> stable` to auto-generate stable mode chores
74
203
  3. βœ… **Implement stable mode chores** - Add error handling and edge cases
75
204
  4. ❌ **NEVER mark feature complete in speed mode** - This bypasses critical quality gates
@@ -81,17 +210,12 @@ The validation will require you to:
81
210
  - This will automatically analyze the implementation and generate appropriate stable mode chores
82
211
  - Or explicitly skip (not recommended): `node jettypod.js work set-mode <feature-id> stable --force`
83
212
 
84
- **Remember:** Speed mode proves it works on the happy path. Stable mode makes it production-ready.
213
+ **Remember:** Speed mode makes it work (all success scenarios). Stable mode makes it robust (handles failures).
85
214
 
86
215
  ---
87
216
 
88
217
  ## Implementation Steps
89
218
 
90
- <!-- ═══════════════════════════════════════════════════════════════════════════
91
- PHASE 1: AUTONOMOUS ANALYSIS
92
- No user input required - Claude Code executes independently
93
- ═══════════════════════════════════════════════════════════════════════════ -->
94
-
95
219
  ### Step 1: Check for Breadcrumbs and Analyze Scenario
96
220
 
97
221
  **CRITICAL:** Claude Code executes this autonomously - no user permission needed.
@@ -106,15 +230,8 @@ The validation will require you to:
106
230
  **To get current work and check for breadcrumbs:**
107
231
 
108
232
  ```bash
109
- # Get current work item with description
110
- jettypod work current
111
-
112
- # Get parent feature details including scenario_file
113
- jettypod work show <parent-feature-id>
114
-
115
- # Or query database directly
116
- sqlite3 .jettypod/work.db "SELECT id, title, description, parent_id FROM work_items WHERE status = 'in_progress' AND type = 'chore'"
117
- sqlite3 .jettypod/work.db "SELECT id, title, scenario_file FROM work_items WHERE id = <parent-feature-id>"
233
+ # Get current work item with description and parent feature's scenario_file
234
+ sqlite3 .jettypod/work.db "SELECT wi.id, wi.title, wi.description, wi.parent_id, parent.title as parent_title, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress' AND wi.type = 'chore'"
118
235
  ```
119
236
 
120
237
  **Check for breadcrumbs** by examining the chore's description for:
@@ -127,8 +244,8 @@ If all three sections exist, use them. Otherwise, fall back to autonomous analys
127
244
  **Then read the scenario file** using the Read tool on the path returned by `scenario_file`.
128
245
 
129
246
  **Parse Gherkin:**
130
- - Extract first `Scenario:` block (happy path)
131
- - Parse Given/When/Then/And steps
247
+ - Extract all `Scenario:` blocks (all success paths - required + optional features)
248
+ - Parse Given/When/Then/And steps for each scenario
132
249
  - Identify:
133
250
  - Initial state setup (Given)
134
251
  - User actions (When)
@@ -241,65 +358,62 @@ Integration Points:
241
358
  Now proposing implementation approach...
242
359
  ```
243
360
 
244
- **Move to Step 3 automatically.**
361
+ ### Step 3: Decide if Confirmation Needed
362
+
363
+ **Evaluate if you need user confirmation before implementing:**
245
364
 
246
- <!-- ═══════════════════════════════════════════════════════════════════════════
247
- PHASE 2: USER CONFIRMATION REQUIRED
248
- ⚑ ASYNC BOUNDARY - Must wait for user response before proceeding
249
- ═══════════════════════════════════════════════════════════════════════════ -->
365
+ **Skip confirmation (proceed directly to Step 4) if:**
366
+ - Breadcrumbs are comprehensive (files, patterns, functions all specified)
367
+ - Implementation approach is clear and unambiguous
368
+ - Only one reasonable way to implement the scenario
369
+ - Epic architectural decisions are clear and constraining
250
370
 
251
- ### Step 3: Propose and Execute Implementation
371
+ **Ask for confirmation (Step 3A) if:**
372
+ - Multiple valid implementation approaches exist
373
+ - Breadcrumbs are vague or missing key details
374
+ - Architectural choice impacts other features
375
+ - You're uncertain about the right approach
252
376
 
253
- **Two phases: Propose (get user confirmation) β†’ Execute (autonomous)**
377
+ ### Step 3A: Propose Implementation Approach (Conditional)
254
378
 
255
- #### Phase 1: Propose Implementation Approach
379
+ **⚑ ASYNC BOUNDARY - Only execute this if confirmation needed**
256
380
 
257
- **Present your analysis and proposal:**
381
+ **Present your analysis and proposal to the user:**
258
382
 
259
383
  ```
260
384
  πŸ’‘ Implementation Proposal
261
385
 
262
- Based on scenario analysis and codebase patterns, here's how I'll make the scenario pass:
386
+ I see multiple ways to approach this. Here's what I'm thinking:
263
387
 
264
- **Files to create/modify:**
265
- 1. [file path] - [what it will do]
266
- 2. [file path] - [what it will do]
388
+ **Option I'm recommending:**
389
+ β€’ Files to create/modify: [specific paths]
390
+ β€’ Key approach: [what makes this the right choice]
391
+ β€’ Why: [rationale - why this over alternatives]
267
392
 
268
- **Key implementation points:**
269
- β€’ [Point 1]: [specific approach]
270
- β€’ [Point 2]: [specific approach]
271
- β€’ [Point 3]: [specific approach]
393
+ **Alternative considered:**
394
+ β€’ [Brief description] - not choosing because [reason]
272
395
 
273
- **Why this approach:**
274
- [Brief explanation of how this satisfies the scenario while following codebase patterns]
275
-
276
- Sound good? I'll implement this autonomously once you confirm.
396
+ Sound good, or would you prefer a different approach?
277
397
  ```
278
398
 
279
- **WAIT for user confirmation or adjustments.**
399
+ **⚑ WAIT for user confirmation or adjustments.**
280
400
 
281
- If user adjusts: revise proposal and confirm again.
401
+ If user adjusts: revise proposal and confirm again before proceeding.
282
402
 
283
- <!-- ═══════════════════════════════════════════════════════════════════════════
284
- PHASE 3: AUTONOMOUS EXECUTION
285
- User has confirmed - Claude Code executes RED→GREEN loop independently
286
- ═══════════════════════════════════════════════════════════════════════════ -->
403
+ **If you skipped this step:** Proceed directly to Step 4.
287
404
 
288
- #### Phase 2: Autonomous Execution
405
+ ---
289
406
 
290
- **CRITICAL:** After user confirms, Claude Code executes autonomously - no permission needed for individual code changes.
407
+ ### Step 4: Establish RED Baseline
291
408
 
292
- **Step 1: Establish RED Baseline**
409
+ **CRITICAL:** After user confirms, execute autonomously - no permission needed for code changes.
293
410
 
294
411
  Before writing any implementation code, run tests to establish the RED state:
295
412
 
296
413
  ```bash
297
414
  # Get current work and parent feature's scenario file
298
- jettypod work current
299
- # Note the parent_id from output
300
-
301
- sqlite3 .jettypod/work.db "SELECT scenario_file FROM work_items WHERE id = <parent-feature-id>"
302
- # This gives you the path to the .feature file
415
+ sqlite3 .jettypod/work.db "SELECT wi.id, wi.parent_id, parent.scenario_file FROM work_items wi LEFT JOIN work_items parent ON wi.parent_id = parent.id WHERE wi.status = 'in_progress'"
416
+ # This gives you the chore ID, parent feature ID, and path to the .feature file
303
417
 
304
418
  # Run BDD tests to establish RED baseline
305
419
  npx cucumber-js <scenario-file-path> --format progress
@@ -334,441 +448,360 @@ First error:
334
448
  Now implementing...
335
449
  ```
336
450
 
337
- **Step 2: RED→GREEN Iteration Loop**
451
+ ---
338
452
 
339
- Iterate until all tests pass or MAX_ITERATIONS reached:
453
+ ### Step 5: RED→GREEN→REFACTOR Loop
340
454
 
341
- <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
342
- β”‚ πŸ”„ ITERATION LOOP: REDβ†’GREEN β”‚
343
- β”‚ β”‚
344
- β”‚ Progress Tracking: β”‚
345
- β”‚ β€’ Display: "Iteration X/10" at start of each cycle β”‚
346
- β”‚ β€’ Track: steps passing vs total, newly passing steps β”‚
347
- β”‚ β€’ Goal: All steps pass (exit code 0) β”‚
348
- β”‚ β”‚
349
- β”‚ Return Points: β”‚
350
- β”‚ β€’ CHECKPOINT_ITERATION: Resume at specific iteration number β”‚
351
- β”‚ β€’ CHECKPOINT_PROGRESS: Resume with known passing step count β”‚
352
- β”‚ β€’ If session interrupted, can resume from last known iteration β”‚
353
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
455
+ **Execute autonomously** - iterate until tests pass (max 10 iterations).
354
456
 
355
- ```javascript
356
- // --- Imports and setup ---
357
- const { runBddScenarioWithTimeout, parseTestProgress, findNewlyPassingSteps, extractErrors, MAX_ITERATIONS } = require('./.claude/skills/speed-mode/test-runner');
358
-
359
- let previousResult = global.redBaseline; // From Step 1
360
- let iteration = 0;
361
-
362
- // --- Main iteration loop ---
363
- // πŸ“Š PROGRESS: Iteration {iteration}/{MAX_ITERATIONS} | Steps: {passed}/{total}
364
- while (iteration < MAX_ITERATIONS) {
365
- iteration++;
366
- console.log(`\n━━━ Iteration ${iteration}/${MAX_ITERATIONS} ━━━`);
367
-
368
- // --- Make code changes ---
369
- console.log(`\n✍️ Making code changes...`);
370
- // [Claude Code writes implementation code here using Write/Edit tools]
371
-
372
- // --- Run tests ---
373
- console.log(`\nπŸ§ͺ Running tests...`);
374
- const result = await runBddScenarioWithTimeout(feature.scenario_file, happyPathLine);
375
-
376
- // --- Handle timeout ---
377
- if (result.timedOut) {
378
- console.log(`⚠️ Test execution timed out - tests may be hanging`);
379
- console.log(`Stopping iteration loop`);
380
- break;
381
- }
457
+ **Each iteration (True TDD):**
382
458
 
383
- // --- Parse results and track progress ---
384
- const currentResult = parseTestProgress(result.stdout + result.stderr);
385
- const errors = extractErrors(result.stdout + result.stderr);
386
- const newlyPassing = findNewlyPassingSteps(previousResult, currentResult);
459
+ 1. **Identify next failing BDD step** - Which scenario step to tackle?
460
+ 2. **Write unit test** - Test the function/logic needed for that step (watch it fail - RED)
461
+ 3. **Write minimal implementation** - Just enough code to pass the unit test
462
+ 4. **Run unit test** - Verify it passes (GREEN)
463
+ 5. **Run BDD scenarios** - Check if BDD step now passes
464
+ 6. **Display progress** - Show what's passing, what's next
465
+ 7. **Continue or exit** - If all BDD scenarios pass β†’ REFACTOR. Otherwise, repeat.
387
466
 
388
- // --- Display progress ---
389
- console.log(`\nπŸ“Š Progress: ${currentResult.passed}/${currentResult.total} steps passing`);
390
-
391
- if (newlyPassing.length > 0) {
392
- console.log(`\nβœ… Newly passing:`);
393
- newlyPassing.forEach(step => console.log(` β€’ ${step}`));
394
- }
467
+ **Show progress each iteration:**
468
+ ```
469
+ ━━━ Iteration 3/10 ━━━
470
+ πŸ“ Unit test: test/dashboard.test.js - sortActivityByDate()
471
+ RED: Test fails - function doesn't exist yet
472
+ ✍️ Implementation: src/dashboard.js - added sortActivityByDate()
473
+ GREEN: Unit test passes
474
+ πŸ§ͺ Running BDD scenarios...
475
+ πŸ“Š Progress: 7/8 BDD steps passing
476
+ βœ… Newly passing: And activity should be sorted by date
477
+ πŸ”§ Next failure: And activity should be filterable
478
+ BDD step: When I filter by category "work"
479
+ ```
395
480
 
396
- // --- Check for GREEN state ---
397
- if (currentResult.exitCode === 0 || currentResult.passed === currentResult.total) {
398
- console.log(`\nπŸŽ‰ GREEN: All tests passing!`);
399
- break;
400
- }
481
+ **When GREEN achieved:**
482
+ ```
483
+ πŸŽ‰ GREEN: All success scenarios passing!
484
+ ```
401
485
 
402
- // --- Display next failure ---
403
- if (errors.errors.length > 0) {
404
- const nextError = errors.errors[0];
405
- console.log(`\nπŸ”§ Next failure to address:`);
406
- console.log(` Step: ${nextError.step}`);
407
- console.log(` Error: ${nextError.message}`);
408
- if (nextError.stack) {
409
- console.log(` Stack: ${nextError.stack.split('\n')[0]}`);
410
- }
411
- } else if (currentResult.failedSteps.length > 0) {
412
- console.log(`\nπŸ”§ Still failing:`);
413
- currentResult.failedSteps.slice(0, 3).forEach(step => console.log(` β€’ ${step}`));
414
- if (currentResult.failedSteps.length > 3) {
415
- console.log(` ... and ${currentResult.failedSteps.length - 3} more`);
416
- }
417
- }
486
+ **Then REFACTOR (quick pass, 5 min max):**
487
+ - Extract duplicated code
488
+ - Rename unclear variables
489
+ - Simplify complex expressions
490
+ - Remove dead code
418
491
 
419
- previousResult = currentResult;
420
- }
492
+ **Re-run tests after refactor** to ensure nothing broke.
421
493
 
422
- // --- Handle max iterations reached ---
423
- if (iteration >= MAX_ITERATIONS) {
424
- console.log(`\n⚠️ Maximum iterations (${MAX_ITERATIONS}) reached without achieving GREEN`);
425
- console.log(`Final progress: ${previousResult.passed}/${previousResult.total} steps passing`);
426
- console.log(`\nConsider:`);
427
- console.log(` β€’ Breaking down the chore into smaller pieces`);
428
- console.log(` β€’ Reviewing the implementation approach`);
429
- console.log(` β€’ Checking for incorrect assumptions`);
430
- }
431
- ```
494
+ <details>
495
+ <summary><strong>πŸ“‹ TDD Loop Guidelines (click to expand)</strong></summary>
432
496
 
433
- **Display example:**
434
- ```
435
- ━━━ Iteration 1/10 ━━━
497
+ **Iteration strategy:**
498
+ - Start with first failing step
499
+ - Make minimal change to pass that step
500
+ - Run tests immediately
501
+ - Move to next failure
436
502
 
437
- ✍️ Making code changes...
438
- Created src/login.js
439
- Modified src/app.js
503
+ **If stuck after 5 iterations:**
504
+ - Review approach - is there a simpler path?
505
+ - Check assumptions - are you solving the right problem?
506
+ - Break down the change - can you make smaller steps?
440
507
 
441
- πŸ§ͺ Running tests...
508
+ **Max 10 iterations:**
509
+ - If you hit max without GREEN, stop
510
+ - Display final progress and suggest next steps
511
+ - Consider breaking chore into smaller pieces
442
512
 
443
- πŸ“Š Progress: 2/8 steps passing
513
+ </details>
444
514
 
445
- βœ… Newly passing:
446
- β€’ Given a user is logged in
447
- β€’ When they click the dashboard button
515
+ ---
448
516
 
449
- πŸ”§ Next failure to address:
450
- Step: Then they should see their dashboard
451
- Error: Cannot read property 'innerText' of null
452
- Stack: at Dashboard.render (src/dashboard.js:12:15)
517
+ **CRITICAL: Check if ALL speed mode chores are complete. Stable mode transition happens ONLY after all speed chores are done.**
453
518
 
454
- ━━━ Iteration 2/10 ━━━
519
+ <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
520
+ β”‚ πŸ” COMPLETION CHECK: Speed Chores β”‚
521
+ β”‚ β”‚
522
+ β”‚ Progress Tracking: β”‚
523
+ β”‚ β€’ Query: Count incomplete speed chores for feature β”‚
524
+ β”‚ β€’ Display: "X speed mode chores remaining" or "All complete" β”‚
525
+ β”‚ β€’ Action: Generate stable scenarios/steps/chores if all complete β”‚
526
+ β”‚ β”‚
527
+ β”‚ Return Point: β”‚
528
+ β”‚ β€’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β”‚
529
+ β”‚ β€’ If session interrupted, re-query to get current count β”‚
530
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
455
531
 
456
- ✍️ Making code changes...
457
- Created src/dashboard.js
458
- Modified src/app.js
532
+ **Check for incomplete speed chores:**
459
533
 
460
- πŸ§ͺ Running tests...
534
+ ```bash
535
+ # Get current work to find parent feature ID
536
+ sqlite3 .jettypod/work.db "SELECT wi.parent_id FROM work_items wi WHERE wi.status = 'in_progress'"
461
537
 
462
- πŸ“Š Progress: 5/8 steps passing
538
+ # Get list of remaining speed chores (excluding current chore)
539
+ sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE parent_id = <feature-id> AND type = 'chore' AND mode = 'speed' AND status != 'done' AND id != <current-chore-id> ORDER BY created_at LIMIT 1"
540
+ ```
463
541
 
464
- βœ… Newly passing:
465
- β€’ Then they should see their dashboard
466
- β€’ And the dashboard should show their username
467
- β€’ And the dashboard should show their recent activity
542
+ **If speed chores remain, display and start next chore:**
468
543
 
469
- πŸ”§ Next failure to address:
470
- Step: And the activity should be sorted by date
471
- Error: Expected ['Post 2', 'Post 1'] but got ['Post 1', 'Post 2']
544
+ ```
545
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
546
+ 🎯 Speed Mode Chore Complete
547
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
472
548
 
473
- ━━━ Iteration 3/10 ━━━
549
+ βœ… Success scenarios pass for this chore
474
550
 
475
- ✍️ Making code changes...
476
- Modified src/dashboard.js
551
+ More speed mode chores remain. Starting next chore:
552
+ #[next-chore-id]: [next-chore-title]
553
+ ```
477
554
 
478
- πŸ§ͺ Running tests...
555
+ **Then immediately merge current chore and start next:**
479
556
 
480
- πŸ“Š Progress: 8/8 steps passing
557
+ ```bash
558
+ # Commit changes in the worktree
559
+ git add . && git commit -m "feat: [brief description of what was implemented]"
481
560
 
482
- βœ… Newly passing:
483
- β€’ And the activity should be sorted by date
561
+ # Merge current chore - this automatically marks it as done
562
+ jettypod work merge
484
563
 
485
- πŸŽ‰ GREEN: All tests passing!
564
+ # Start next speed chore
565
+ jettypod work start [next-chore-id]
486
566
  ```
487
567
 
488
- **Speed mode constraints:**
489
- - **Implement ALL scoped functionality** - if the scenario requires file upload, implement it (just assume it works)
490
- - **Single file when possible** - keep it simple
491
- - **NO error handling** - no try/catch, no validation, no edge cases
492
- - **Assume everything works** - valid inputs, successful operations, correct types
493
- - **Use real infrastructure** - actual database/storage from your tech stack
494
- - **Inline code over separate modules** - keep it simple
495
- - **Focus: Make. All. Features. Work.** (on the happy path)
568
+ **CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
569
+ - ❌ DO NOT use `jettypod work status <id> done`
570
+ - ❌ DO NOT use `jettypod work complete <id>`
571
+ - ❌ DO NOT use `jettypod work set-mode <id> done`
572
+ - βœ… ONLY use `jettypod work merge`
496
573
 
497
- **Step 3: REFACTOR**
574
+ The merge command handles everything: pushes branch, merges to main, marks chore done, cleans up worktree.
498
575
 
499
- After GREEN is achieved, do a quick refactor pass:
576
+ The speed-mode skill will automatically re-invoke for the next chore.
500
577
 
501
- 1. **Extract duplicated code** - DRY up any copy-pasted logic
502
- 2. **Rename unclear variables** - make intent obvious
503
- 3. **Simplify complex expressions** - break into readable steps
504
- 4. **Remove dead code** - delete unused variables/functions
578
+ **If all speed chores are done (count = 0), continue to Step 6 below.**
505
579
 
506
- **Keep it fast** - 5 minutes max. Major refactoring happens in stable mode.
580
+ ---
507
581
 
508
- **Re-run tests after refactoring** to ensure nothing broke:
582
+ ### Step 6: Transition to Stable Mode (After All Speed Chores Complete)
509
583
 
510
- ```javascript
511
- const result = await runBddScenarioWithTimeout(feature.scenario_file, scenarioLine);
512
- if (result.exitCode !== 0) {
513
- console.log('⚠️ Refactoring broke tests - revert and try again');
514
- }
515
- ```
584
+ **⚑ ASYNC BOUNDARY - Must wait for user to confirm proposed scenarios/chores**
516
585
 
517
- **Step 4: Final Verification and Completion**
586
+ **CRITICAL:** This step ONLY runs after ALL speed chores are complete. This is the transition from speed mode to stable mode.
518
587
 
519
- After GREEN + REFACTOR, run full feature file once to verify no regressions:
588
+ **Workflow: Merge last chore β†’ Generate scenarios β†’ Generate step definitions β†’ Propose chores β†’ Commit BDD files β†’ Create chores β†’ Set mode to stable β†’ Invoke stable-mode skill**
520
589
 
521
- ```javascript
522
- // After iteration loop succeeds (GREEN achieved)
523
- if (currentResult.exitCode === 0 || currentResult.passed === currentResult.total) {
524
- console.log(`\nπŸŽ‰ GREEN: Happy path scenario passing!`);
525
- console.log(`\nπŸ” Running full verification (all scenarios)...`);
526
-
527
- // Run entire feature file once for regression detection
528
- // Uses the already imported runBddScenarioWithTimeout with no line number to run all scenarios
529
- const fullResult = await runBddScenarioWithTimeout(feature.scenario_file);
530
-
531
- if (fullResult.timedOut) {
532
- console.log(`⚠️ Full verification timed out`);
533
- } else if (fullResult.exitCode !== 0) {
534
- const fullProgress = parseTestProgress(fullResult.stdout + fullResult.stderr);
535
- console.log(`⚠️ Full verification found regressions: ${fullProgress.total - fullProgress.passed} scenarios failing`);
536
- console.log(`This is expected in speed mode - stable mode will address additional scenarios.`);
537
- } else {
538
- console.log(`βœ… Full verification passed - all scenarios passing!`);
539
- }
540
- }
541
- ```
542
-
543
- Display comprehensive results:
590
+ #### Phase 1: Merge Final Speed Chore
544
591
 
545
- **On SUCCESS (GREEN achieved):**
592
+ **Complete the current (final) speed chore:**
546
593
 
547
- ```javascript
548
- // Track what files were created/modified during implementation
549
- const filesCreated = [/* list of created files */];
550
- const filesModified = [/* list of modified files */];
594
+ ```bash
595
+ # Commit changes in the worktree
596
+ git add . && git commit -m "feat: [brief description of what was implemented]"
551
597
 
552
- console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
553
- console.log(`βœ… SPEED MODE COMPLETE - GREEN STATE ACHIEVED`);
554
- console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
598
+ # Merge to main with lock held for transition phase
599
+ # This prevents race conditions when multiple instances generate BDD files simultaneously
600
+ jettypod work merge --with-transition
601
+ ```
555
602
 
556
- console.log(`πŸŽ‰ Happy path scenario: ALL TESTS PASSING\n`);
603
+ <details>
604
+ <summary>πŸ’‘ Why --with-transition? (click to expand)</summary>
557
605
 
558
- console.log(`Implementation Summary:`);
559
- console.log(` Iterations: ${iteration}/${MAX_ITERATIONS}`);
560
- console.log(` Test steps: ${currentResult.passed}/${currentResult.total} passing\n`);
606
+ The `--with-transition` flag holds the merge lock through the entire BDD generation phase (Phases 2-6).
561
607
 
562
- if (filesCreated.length > 0) {
563
- console.log(`Files created:`);
564
- filesCreated.forEach(file => console.log(` βœ… ${file}`));
565
- console.log();
566
- }
608
+ **Without this flag:**
609
+ - Instance A merges β†’ generates BDD β†’ appends to step_definitions/auth.steps.js
610
+ - Instance B merges β†’ generates BDD β†’ appends to step_definitions/auth.steps.js (CONFLICT!)
611
+ - Second write can overwrite first write, losing step definitions
567
612
 
568
- if (filesModified.length > 0) {
569
- console.log(`Files modified:`);
570
- filesModified.forEach(file => console.log(` ✏️ ${file}`));
571
- console.log();
572
- }
613
+ **With this flag:**
614
+ - Instance A acquires lock β†’ merges β†’ generates BDD β†’ commits β†’ releases lock
615
+ - Instance B waits β†’ acquires lock β†’ merges β†’ generates BDD β†’ commits β†’ releases lock
616
+ - No conflicts, all step definitions preserved
573
617
 
574
- // --- Create unit tests for new functions ---
575
- // For each new function implemented, create a unit test file with happy path coverage
618
+ You'll release the lock in Phase 6 after committing BDD files.
619
+ </details>
576
620
 
577
- // Unit test template for new functions:
578
- // test/[filename].test.js or __tests__/[filename].test.js
579
- /*
580
- const { functionName } = require('../src/path/to/module');
621
+ **CRITICAL: Use ONLY `jettypod work merge` to complete chores.**
622
+ - ❌ DO NOT use `jettypod work status <id> done`
623
+ - ❌ DO NOT use `jettypod work complete <id>`
624
+ - ❌ DO NOT use `jettypod work set-mode <id> done`
625
+ - βœ… ONLY use `jettypod work merge`
581
626
 
582
- describe('functionName', () => {
583
- it('should handle valid input successfully', () => {
584
- // Arrange
585
- const input = validTestData;
627
+ After merge, you are now on main branch. Ready to generate stable mode scenarios.
586
628
 
587
- // Act
588
- const result = functionName(input);
629
+ #### Phase 2: Generate Stable Mode BDD Scenarios
589
630
 
590
- // Assert
591
- expect(result).toEqual(expectedOutput);
592
- });
593
- });
594
- */
631
+ **Your task:** Create BDD scenarios for error handling, edge cases, and validation.
595
632
 
596
- // Speed mode unit tests focus on:
597
- // - Happy path with valid input
598
- // - One successful operation per function
599
- // - Basic return value verification
633
+ **Read the feature's existing scenario file:**
600
634
 
601
- console.log(`Next step: Elevate to stable mode using 'jettypod work set-mode <feature-id> stable'\n`);
635
+ ```bash
636
+ # Find the feature's scenario file
637
+ sqlite3 .jettypod/work.db "SELECT id, title FROM work_items WHERE id = <feature-id>"
638
+ # Look for: features/bdd/<epic-slug>/<feature-slug>.feature
602
639
  ```
603
640
 
604
- **Display:**
605
- ```
606
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
607
- βœ… GREEN STATE ACHIEVED - Now Creating Stable Chores
608
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
641
+ **Analysis checklist for new scenarios:**
642
+
643
+ 1. **Error scenarios** - What can go wrong?
644
+ - Invalid user input (wrong types, out of range, malformed data)
645
+ - Missing required parameters
646
+ - System errors (file not found, network errors, database errors)
647
+ - Permission/authorization failures
648
+
649
+ 2. **Edge case scenarios** - Boundary conditions
650
+ - Empty inputs (empty strings, empty arrays, null values)
651
+ - Maximum values (large numbers, long strings, many items)
652
+ - Minimum values (zero, negative numbers)
653
+ - Special characters and Unicode
609
654
 
610
- πŸŽ‰ Happy path scenario: ALL TESTS PASSING
655
+ 3. **State consistency scenarios** - Data integrity
656
+ - Concurrent operations (race conditions)
657
+ - Partial failures (transaction rollbacks)
658
+ - State transitions (invalid state changes)
611
659
 
612
- Implementation Summary:
613
- Iterations: 3/10
614
- Test steps: 8/8 passing
660
+ **Generate stable scenarios and append to feature file:**
615
661
 
616
- Files created:
617
- βœ… src/login.js
618
- βœ… src/dashboard.js
662
+ ```gherkin
663
+ Scenario: Handle missing required parameter
664
+ Given the system is initialized
665
+ When I call the function with missing "name" parameter
666
+ Then it should throw a validation error
667
+ And the error message should be "Parameter 'name' is required"
619
668
 
620
- Files modified:
621
- ✏️ src/app.js
622
- ✏️ src/index.html
669
+ Scenario: Handle empty input
670
+ Given the system is initialized
671
+ When I provide an empty string as input
672
+ Then it should return an appropriate error
673
+ And the error code should be "INVALID_INPUT"
623
674
 
624
- ⚠️ Speed mode is NOT complete until stable chores exist.
625
- Proceeding to Step 4 to create stable mode chores...
675
+ Scenario: Handle maximum boundary value
676
+ Given the system is initialized
677
+ When I provide the maximum allowed value
678
+ Then it should process successfully
679
+ And return the expected result
626
680
  ```
627
681
 
628
- **On FAILURE (max iterations or timeout):**
682
+ **Append scenarios to the feature file** (don't overwrite existing speed scenarios):
629
683
 
630
- ```javascript
631
- // --- Display failure header ---
632
- console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
633
- console.log(`⚠️ SPEED MODE INCOMPLETE - STILL IN RED STATE`);
634
- console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
635
-
636
- // --- Handle timeout case ---
637
- if (result.timedOut) {
638
- console.log(`❌ Test execution timed out`);
639
- console.log(`\nPossible causes:`);
640
- console.log(` β€’ Infinite loop in implementation code`);
641
- console.log(` β€’ Test is waiting for async operation that never completes`);
642
- console.log(` β€’ Step definition has blocking code`);
643
- } else {
644
- // --- Handle max iterations case ---
645
- console.log(`❌ Maximum iterations (${MAX_ITERATIONS}) reached\n`);
646
- console.log(`Final Progress: ${previousResult.passed}/${previousResult.total} steps passing\n`);
647
-
648
- // --- Display failing steps ---
649
- if (previousResult.failedSteps.length > 0) {
650
- console.log(`Still failing:`);
651
- previousResult.failedSteps.forEach(step => console.log(` βœ– ${step}`));
652
- console.log();
653
- }
684
+ ```bash
685
+ # Append to existing .feature file
686
+ cat >> features/bdd/<epic-slug>/<feature-slug>.feature << 'EOF'
654
687
 
655
- // --- Display remaining errors ---
656
- const errors = extractErrors(result.stdout + result.stderr);
657
- if (errors.errors.length > 0) {
658
- console.log(`Remaining errors:`);
659
- errors.errors.slice(0, 3).forEach(err => {
660
- console.log(` Step: ${err.step}`);
661
- console.log(` Error: ${err.message}\n`);
662
- });
663
- }
664
- }
688
+ # Stable Mode Scenarios - Error Handling and Edge Cases
665
689
 
666
- // --- Display next steps ---
667
- console.log(`\nWhat to do:`);
668
- console.log(` β€’ Review implementation approach - is it the right strategy?`);
669
- console.log(` β€’ Check for incorrect assumptions about existing code`);
670
- console.log(` β€’ Consider breaking this chore into smaller pieces`);
671
- console.log(` β€’ Verify step definitions match what implementation provides`);
672
- console.log(`\nDO NOT proceed to generate stable mode chores until GREEN is achieved.`);
673
- ```
690
+ Scenario: [Title]
691
+ Given [context]
692
+ When [action]
693
+ Then [expected behavior]
674
694
 
675
- **Display (on failure):**
695
+ Scenario: [Title]
696
+ Given [context]
697
+ When [action]
698
+ Then [expected behavior]
699
+ EOF
676
700
  ```
677
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
678
- ⚠️ SPEED MODE INCOMPLETE - STILL IN RED STATE
679
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
680
-
681
- ❌ Maximum iterations (10) reached
682
701
 
683
- Final Progress: 5/8 steps passing
702
+ #### Phase 3: Generate Stable Mode Step Definitions
684
703
 
685
- Still failing:
686
- βœ– Then they should see their dashboard
687
- βœ– And the dashboard should show their username
688
- βœ– And the dashboard should show their recent activity
704
+ **Your task:** Create step definition files for the new stable scenarios.
689
705
 
690
- Remaining errors:
691
- Step: Then they should see their dashboard
692
- Error: Cannot read property 'innerText' of null
706
+ **Identify new step definitions needed:**
693
707
 
694
- Step: And the dashboard should show their username
695
- Error: Expected 'John Doe' but got undefined
708
+ 1. Read the stable scenarios you just created
709
+ 2. Extract unique Given/When/Then steps
710
+ 3. Check if step definitions already exist in `features/bdd/<epic-slug>/steps/`
711
+ 4. Create new step definition files for missing steps
696
712
 
697
- What to do:
698
- β€’ Review implementation approach - is it the right strategy?
699
- β€’ Check for incorrect assumptions about existing code
700
- β€’ Consider breaking this chore into smaller pieces
701
- β€’ Verify step definitions match what implementation provides
713
+ **Generate step definition files:**
702
714
 
703
- DO NOT proceed to generate stable mode chores until GREEN is achieved.
704
- ```
715
+ ```javascript
716
+ // features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
717
+
718
+ const { Given, When, Then } = require('@cucumber/cucumber');
719
+ const { expect } = require('chai');
720
+
721
+ // Error handling steps
722
+ When('I call the function with missing {string} parameter', async function(paramName) {
723
+ try {
724
+ // Implementation that calls function without parameter
725
+ this.error = null;
726
+ } catch (err) {
727
+ this.error = err;
728
+ }
729
+ });
705
730
 
706
- **Move to Step 4 IMMEDIATELY if GREEN achieved.**
731
+ Then('it should throw a validation error', function() {
732
+ expect(this.error).to.exist;
733
+ expect(this.error.name).to.equal('ValidationError');
734
+ });
707
735
 
708
- **CRITICAL: GREEN is NOT completion - it's just a checkpoint. Speed mode is INCOMPLETE until stable mode chores are created. You MUST continue to Step 4.**
736
+ Then('the error message should be {string}', function(expectedMessage) {
737
+ expect(this.error.message).to.equal(expectedMessage);
738
+ });
709
739
 
710
- <!-- ═══════════════════════════════════════════════════════════════════════════
711
- PHASE 4: STABLE CHORE GENERATION
712
- ⚑ ASYNC BOUNDARY - Must wait for user to confirm proposed chores
713
- ═══════════════════════════════════════════════════════════════════════════ -->
740
+ // Edge case steps
741
+ When('I provide an empty string as input', async function() {
742
+ this.result = await this.functionUnderTest('');
743
+ });
714
744
 
715
- ### Step 4: Generate Stable Mode Chores (REQUIRED - Do Not Skip)
745
+ When('I provide the maximum allowed value', async function() {
746
+ this.result = await this.functionUnderTest(Number.MAX_SAFE_INTEGER);
747
+ });
748
+ ```
716
749
 
717
- **CRITICAL:** This step is MANDATORY. Speed mode is NOT complete until stable mode chores exist. Without them, users cannot resume work on this feature.
750
+ **Create step definition files:**
718
751
 
719
- **Two phases: Analyze and propose β†’ Get confirmation β†’ Create autonomously**
752
+ ```bash
753
+ # Create the step definition file
754
+ touch features/bdd/<epic-slug>/steps/<feature-slug>-stable.steps.js
755
+ # Write the step definitions to the file
756
+ ```
720
757
 
721
- #### Phase 1: Analyze Implementation
758
+ #### Phase 4: Analyze Implementation and Propose Stable Mode Chores
722
759
 
723
- **Your task:** Review what was built and identify what's needed for stable mode.
760
+ **Your task:** Based on the stable scenarios and step definitions, identify what needs to be implemented.
724
761
 
725
762
  **Analysis checklist:**
726
763
 
727
764
  1. **Error handling gaps**
728
- - What user errors are possible?
729
- - What system errors could occur?
730
- - What validation is missing?
731
-
732
- 2. **Edge cases**
733
- - Boundary conditions (empty inputs, max values, etc.)
734
- - Race conditions
735
- - State consistency issues
736
-
737
- 3. **Non-happy-path scenarios**
738
- - Read the full scenario file (not just happy path)
739
- - Identify scenarios 2+ (error handling, edge cases)
740
- - Check what additional behavior is needed
741
-
742
- 4. **Code quality needs**
743
- - What needs better structure/organization?
744
- - What needs proper error messages?
745
- - What needs logging/debugging support?
765
+ - What validation needs to be added?
766
+ - What error types need to be thrown?
767
+ - What error messages need to be user-friendly?
768
+
769
+ 2. **Edge case handling**
770
+ - What boundary checks are needed?
771
+ - What null/undefined checks are missing?
772
+ - What type validation is needed?
746
773
 
747
- #### Phase 2: Propose Stable Mode Chores
774
+ 3. **Code that needs refactoring**
775
+ - What needs better structure for error handling?
776
+ - What needs logging/debugging support?
777
+ - What needs better separation of concerns?
748
778
 
749
779
  **Present your analysis:**
750
780
 
751
781
  ```
752
782
  πŸ“‹ Stable Mode Chores Proposal
753
783
 
754
- I've analyzed the implementation. Here are the chores needed for stable mode:
784
+ I've generated [N] stable mode scenarios covering error handling and edge cases.
785
+ I've created step definitions for these scenarios.
786
+
787
+ Here are the chores needed to make these scenarios pass:
755
788
 
756
789
  **Chore 1: [Title]**
757
790
  - Why: [What gap this fills]
758
791
  - Scope: [What specifically needs to be done]
759
- - Scenario: [Which BDD scenario this addresses, if applicable]
792
+ - Scenarios: [Which BDD scenarios this addresses]
760
793
 
761
794
  **Chore 2: [Title]**
762
795
  - Why: [What gap this fills]
763
796
  - Scope: [What specifically needs to be done]
764
- - Scenario: [Which BDD scenario this addresses, if applicable]
797
+ - Scenarios: [Which BDD scenarios this addresses]
765
798
 
766
799
  **Chore 3: [Title]**
767
800
  - Why: [What gap this fills]
768
801
  - Scope: [What specifically needs to be done]
769
- - Scenario: [Which BDD scenario this addresses, if applicable]
802
+ - Scenarios: [Which BDD scenarios this addresses]
770
803
 
771
- These chores will make all BDD scenarios pass with proper error handling and edge case coverage.
804
+ These chores will make all stable mode scenarios pass with proper error handling and edge case coverage.
772
805
 
773
806
  Sound good? I'll create these chores once you confirm.
774
807
  ```
@@ -777,12 +810,7 @@ Sound good? I'll create these chores once you confirm.
777
810
 
778
811
  If user adjusts: revise chores and confirm again.
779
812
 
780
- <!-- ═══════════════════════════════════════════════════════════════════════════
781
- PHASE 5: AUTONOMOUS COMPLETION
782
- User has confirmed chores - create them and finalize
783
- ═══════════════════════════════════════════════════════════════════════════ -->
784
-
785
- #### Phase 3: Create Chores Autonomously
813
+ #### Phase 5: Create Chores Autonomously
786
814
 
787
815
  **CRITICAL:** After user confirms, create chores programmatically - no additional permission needed.
788
816
 
@@ -790,7 +818,7 @@ If user adjusts: revise chores and confirm again.
790
818
 
791
819
  ```javascript
792
820
  const { create } = require('./features/work-tracking');
793
- const { getCurrentWork } = require('../../lib/current-work');
821
+ const { getCurrentWork } = require('./lib/current-work');
794
822
 
795
823
  (async () => {
796
824
  const currentWork = await getCurrentWork();
@@ -812,46 +840,47 @@ Chores created:
812
840
  β€’ #[ID]: [Title]
813
841
  ```
814
842
 
815
- #### Phase 4: Auto-Elevate to Stable Mode (If All Speed Chores Done)
843
+ #### Phase 6: Commit Stable Mode Scenarios and Steps to Main
816
844
 
817
- **CRITICAL: Check if ALL speed mode chores are complete. If yes, auto-elevate to stable mode.**
845
+ **CRITICAL: Commit the BDD files to main BEFORE starting stable chores.**
818
846
 
819
- <!-- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
820
- β”‚ πŸ” COMPLETION CHECK: Speed Chores β”‚
821
- β”‚ β”‚
822
- β”‚ Progress Tracking: β”‚
823
- β”‚ β€’ Query: Count incomplete speed chores for feature β”‚
824
- β”‚ β€’ Display: "X speed mode chores remaining" or "All complete" β”‚
825
- β”‚ β€’ Action: Auto-elevate if all complete β”‚
826
- β”‚ β”‚
827
- β”‚ Return Point: β”‚
828
- β”‚ β€’ CHECKPOINT_CHORE_COUNT: Known incomplete count from last check β”‚
829
- β”‚ β€’ If session interrupted, re-query to get current count β”‚
830
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -->
847
+ ```bash
848
+ # You're currently on main after merging the last speed chore
849
+ # Commit the stable mode scenarios and step definitions
850
+ git add features/
851
+ git commit -m "test: Add stable mode BDD scenarios and step definitions
831
852
 
832
- **Check for incomplete speed chores:**
853
+ Added error handling and edge case scenarios for stable mode implementation.
833
854
 
834
- ```bash
835
- # Get current work to find parent feature ID
836
- jettypod work current
855
+ - [N] new stable mode scenarios
856
+ - Step definitions for validation, error handling, and edge cases"
837
857
 
838
- # Count incomplete speed chores for the feature
839
- sqlite3 .jettypod/work.db "SELECT COUNT(*) FROM work_items WHERE parent_id = <feature-id> AND type = 'chore' AND mode = 'speed' AND status != 'done'"
858
+ # Push to remote
859
+ git push
860
+
861
+ # Release the merge lock (held since Phase 1)
862
+ jettypod work merge --release-lock
840
863
  ```
841
864
 
842
- **If all speed chores are done (count = 0), EXECUTE elevation:**
865
+ This ensures stable mode BDD files are in main and will be present in stable chore worktrees.
866
+
867
+ The merge lock is now released - other instances can proceed with their transitions.
868
+
869
+ #### Phase 7: Set Feature Mode to Stable
870
+
871
+ **Set the feature mode:**
843
872
 
844
873
  ```bash
845
874
  jettypod work set-mode <feature-id> stable
846
875
  ```
847
876
 
848
- **DO NOT display this as example text. EXECUTE IT using the Bash tool.**
877
+ #### Phase 8: Invoke Stable Mode Skill
849
878
 
850
- After execution, display:
879
+ **CRITICAL: Immediately transition to stable-mode skill to start implementing stable chores.**
851
880
 
852
881
  ```
853
882
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
854
- 🎯 Speed Mode Complete! Feature Elevated to Stable Mode
883
+ 🎯 Speed Mode Complete! Transitioning to Stable Mode
855
884
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
856
885
 
857
886
  ⚠️ CRITICAL: Speed mode is ONLY a checkpoint to prove functionality works.
@@ -859,56 +888,35 @@ The feature is INCOMPLETE without stable mode - error handling, validation,
859
888
  edge cases, and comprehensive testing are ALL required.
860
889
 
861
890
  What we accomplished:
862
- βœ… Happy path scenario passes
863
891
  βœ… All speed mode chores complete
864
- βœ… Feature elevated to stable mode
865
- βœ… Stable mode chores created and ready
892
+ βœ… Generated [N] stable mode BDD scenarios
893
+ βœ… Created step definitions for stable scenarios
894
+ βœ… Created [N] stable mode chores
895
+ βœ… Feature mode set to stable
866
896
 
867
- πŸš€ NEVER leave a feature in speed mode - it's not production-ready.
897
+ πŸš€ NEVER leave a feature in speed mode.
868
898
  Stable mode adds:
869
899
  β€’ Comprehensive error handling and user-friendly error messages
870
900
  β€’ Input validation (null checks, type checks, range validation)
871
901
  β€’ Edge case handling (empty arrays, boundary values, race conditions)
872
902
  β€’ State consistency and data integrity
873
- β€’ All BDD scenarios passing (happy path + error/edge cases)
874
-
875
- **Next step:** IMMEDIATELY start the first stable mode chore
876
- jettypod work start [first-stable-chore-id]
877
- ```
878
-
879
- **If speed chores remain, display:**
903
+ β€’ All BDD scenarios passing (success scenarios + error/edge cases)
880
904
 
905
+ **Next step:** I'm now invoking the stable-mode skill to start implementing the first stable chore.
881
906
  ```
882
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
883
- 🎯 Speed Mode Chore Done - Stable Chores Created
884
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
885
-
886
- What we accomplished:
887
- βœ… Happy path scenario passes for this chore
888
- βœ… Stable mode chores created for when speed mode finishes
889
907
 
890
- Remaining speed mode chores: [count]
908
+ **Invoke the stable-mode skill:**
891
909
 
892
- ⚠️ Speed mode is NOT complete yet - [count] chores remain.
893
- You can take a break here - stable mode chores exist and work can resume.
910
+ Use the Skill tool to automatically transition to stable mode implementation:
894
911
 
895
- **Next step:** Continue with next speed mode chore
896
- jettypod work start [next-speed-chore-id]
897
912
  ```
898
-
899
- **Mark current chore as done:**
900
-
901
- Use Bash tool to commit and push:
902
- ```bash
903
- git add . && git commit -m "feat: [brief description of what was implemented]" && git push
904
- ```
905
-
906
- Then use the merge command to merge to main (which auto-marks chore as done via post-merge hook):
907
- ```bash
908
- jettypod work merge
913
+ Skill tool with skill="stable-mode"
909
914
  ```
910
915
 
911
- The post-merge hook will automatically mark the chore as done when merged to main.
916
+ The stable-mode skill will:
917
+ 1. Start the first stable chore automatically
918
+ 2. Guide implementation to make stable scenarios pass
919
+ 3. Continue with remaining stable chores
912
920
 
913
- **End skill.**
921
+ **End speed-mode skill.**
914
922