@nt-ai-lab/opencode-skillz 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,598 @@
1
+ ---
2
+ description: "Strict test-driven development state machine with red-green-refactor cycles. Enforces test-first development, meaningful failures, minimum implementations, and full verification. Activates when user requests: 'use a TDD approach', 'start TDD', 'test-drive this'."
3
+ ---
4
+
5
+ Use the following TDD process to implement all code changes.
6
+
7
+ **In Plan Mode: Plans should be test specifications, not implementation designs. Include key insights, architectural constraints, and suggestionsβ€”but never the full implementation of production code.**
8
+
9
+ # 🚨 CRITICAL: TDD STATE MACHINE GOVERNANCE 🚨
10
+
11
+ **EVERY SINGLE MESSAGE MUST START WITH YOUR CURRENT TDD STATE**
12
+
13
+ Format:
14
+ ```
15
+ πŸ”΄ TDD: RED
16
+ 🟒 TDD: GREEN
17
+ πŸ”΅ TDD: REFACTOR
18
+ βšͺ TDD: PLANNING
19
+ 🟑 TDD: VERIFY
20
+ ⚠️ TDD: BLOCKED
21
+ ```
22
+
23
+ **NOT JUST THE FIRST MESSAGE. EVERY. SINGLE. MESSAGE.**
24
+
25
+ When you read a file β†’ prefix with TDD state
26
+ When you run tests β†’ prefix with TDD state
27
+ When you explain results β†’ prefix with TDD state
28
+ When you ask a question β†’ prefix with TDD state
29
+
30
+ Example:
31
+ ```
32
+ βšͺ TDD: PLANNING
33
+ Writing test for negative price validation...
34
+
35
+ βšͺ TDD: PLANNING
36
+ Running npm test to see it fail...
37
+
38
+ βšͺ TDD: PLANNING
39
+ Test output shows: Expected CannotHaveNegativePrice error but received -50
40
+ Test fails correctly. Transitioning to RED.
41
+
42
+ πŸ”΄ TDD: RED
43
+ Test IS failing. Addressing what the error message demands...
44
+ ```
45
+
46
+ **🚨 FAILURE TO ANNOUNCE TDD STATE = SEVERE VIOLATION 🚨**
47
+
48
+ ---
49
+
50
+ <meta_governance>
51
+ 🚨 STRICT STATE MACHINE GOVERNANCE 🚨
52
+
53
+ - CANNOT skip states or assume completion without evidence
54
+ - MUST announce state on EVERY message
55
+ - MUST validate post-conditions before transitioning
56
+
57
+ **Before each response:** Verify your claimed state matches your tool call evidence.
58
+ If mismatch: `πŸ”₯ STATE VIOLATION DETECTED` β†’ announce correct state β†’ recover.
59
+
60
+ **State announcement:** Every message starts with `πŸ”΄ TDD: RED` (or current state).
61
+ Forgot prefix? Announce violation immediately, then continue.
62
+ </meta_governance>
63
+
64
+ <state_machine>
65
+ <diagram>
66
+ ```
67
+ user request
68
+ ↓
69
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
70
+ β”Œβ”€β”€β”€β”€β”‚ PLANNING │────┐
71
+ β”‚ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚
72
+ β”‚ β”‚ β”‚
73
+ β”‚ test fails β”‚
74
+ β”‚ correctly β”‚
75
+ unclear β”‚ ↓ β”‚ blocker
76
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
77
+ └────│ RED β”‚ β”‚
78
+ β”‚ β”‚ β”‚
79
+ β”‚ Test IS β”‚ β”‚
80
+ β”‚ failing β”‚ β”‚
81
+ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚
82
+ β”‚ β”‚
83
+ test β”‚ β”‚
84
+ passes β”‚ β”‚
85
+ ↓ β”‚
86
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
87
+ β”‚ GREEN β”‚ β”‚
88
+ β”‚ β”‚ β”‚
89
+ β”‚ Test IS β”‚ β”‚
90
+ β”‚ passing β”‚ β”‚
91
+ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜β”€β”€β”€β”€β”˜
92
+ β”‚
93
+ refactoring β”‚
94
+ needed β”‚
95
+ ↓
96
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
97
+ β”Œβ”€β”€β”€β”€β”‚ REFACTOR β”‚
98
+ β”‚ β”‚ β”‚
99
+ β”‚ β”‚ Improve β”‚
100
+ β”‚ β”‚ design β”‚
101
+ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
102
+ β”‚ β”‚
103
+ β”‚ done β”‚
104
+ β”‚ β”‚
105
+ β”‚ ↓
106
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
107
+ β”‚ β”‚ VERIFY β”‚
108
+ β”‚ β”‚ β”‚
109
+ β”‚ β”‚ Run full β”‚
110
+ fail β”‚ β”‚ suite + β”‚
111
+ β”‚ β”‚ lint + β”‚
112
+ └────│ build β”‚
113
+ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
114
+ β”‚
115
+ pass β”‚
116
+ β”‚
117
+ ↓
118
+ [COMPLETE]
119
+ ```
120
+ </diagram>
121
+
122
+ <states>
123
+ <state name="PLANNING">
124
+ <prefix>βšͺ TDD: PLANNING</prefix>
125
+ <purpose>Writing a failing test to prove requirement</purpose>
126
+
127
+ <pre_conditions>
128
+ βœ“ User has provided a task/requirement/bug report
129
+ βœ“ No other TDD cycle in progress
130
+ </pre_conditions>
131
+
132
+ <actions>
133
+ 1. Analyze requirement/bug
134
+ 2. Ask clarifying questions if needed
135
+ 3. Determine what behavior needs testing
136
+ 4. Identify edge cases using writing-tests skill checklists (numbers, strings, collections, dates, null/undefined, typed property validation)
137
+ 5. Write test for specific behavior
138
+ 6. Run test (use Bash tool to execute test command)
139
+ 7. VERIFY test fails correctly
140
+ 8. Show exact failure message to user (copy/paste verbatim output)
141
+ 9. Justify why failure message proves test is correct
142
+ 10. If failure is "method doesn't exist" - implement empty/dummy method and re-run from step 6
143
+ 11. Repeat until you get a "meaningful" failure
144
+ 12. Improve the code to produce a more explicit error message. Does the test failure provide a precise reason for the failure, if not ask the user if they want to make it better.
145
+ 13. Transition to RED
146
+ </actions>
147
+
148
+ <post_conditions>
149
+ βœ“ Test written and executed
150
+ βœ“ Test FAILED correctly (red bar achieved)
151
+ βœ“ Failure message shown to user verbatim
152
+ βœ“ Failure reason justified (proves test is correct)
153
+ βœ“ Failure is "meaningful" (not setup/syntax error)
154
+ </post_conditions>
155
+
156
+ <validation_before_transition>
157
+ BEFORE transitioning to RED, announce:
158
+ "Pre-transition validation:
159
+ βœ“ Test written: [yes]
160
+ βœ“ Test executed: [yes]
161
+ βœ“ Test failed correctly: [yes]
162
+ βœ“ Failure message shown: [yes - output above]
163
+ βœ“ Meaningful failure: [yes - justification]
164
+
165
+ Transitioning to RED - test is now failing for the right reason."
166
+ </validation_before_transition>
167
+
168
+ <transitions>
169
+ - PLANNING β†’ RED (when test fails correctly - red milestone achieved)
170
+ - PLANNING β†’ BLOCKED (when cannot write valid test)
171
+ </transitions>
172
+ </state>
173
+
174
+ <state name="RED">
175
+ <prefix>πŸ”΄ TDD: RED</prefix>
176
+ <purpose>Test IS failing for the right reason. Implement ONLY what the error message demands.</purpose>
177
+
178
+ 🚨 CRITICAL: You are in RED state - test IS CURRENTLY FAILING. You MUST implement code and see test PASS, code COMPILE, code LINT before transitioning to GREEN.
179
+ DO NOT transition to GREEN until you have:
180
+ 1. Implemented ONLY what the error message demands
181
+ 2. Executed the test with Bash tool
182
+ 3. Seen the SUCCESS output (green bar)
183
+ 4. Executed compile check and seen SUCCESS
184
+ 5. Executed lint check and seen PASS
185
+ 6. Shown all success outputs to the user
186
+
187
+ <pre_conditions>
188
+ βœ“ Test written and executed (from PLANNING)
189
+ βœ“ Test IS FAILING correctly (red bar visible)
190
+ βœ“ Failure message shown and justified
191
+ βœ“ Failure is "meaningful" (not setup/syntax error)
192
+ </pre_conditions>
193
+
194
+ <actions>
195
+ 1. Read the error message - what does it literally ask for?
196
+ 2. 🚨 MANDATORY SELF-CHECK - announce before implementing:
197
+ "Minimal implementation check:
198
+ - Error demands: [what the error literally says]
199
+ - Could hardcoded value work? [yes/no]
200
+ - If yes: [what hardcoded value]
201
+ - If no: [why real logic is required]"
202
+
203
+ Guidelines:
204
+ - If test asserts `x === 5` β†’ return `5`
205
+ - If test asserts `count === 0` β†’ return object with `count: 0`
206
+ - If test asserts type β†’ return minimal stub of that type
207
+ - Only add logic when tests FORCE you to (multiple cases, different inputs)
208
+ 3. Implement ONLY what that error message demands (hardcoded if possible)
209
+ 4. Do NOT anticipate future errors - address THIS error only
210
+ 5. Run test (use Bash tool to execute test command)
211
+ 6. VERIFY test PASSES (green bar)
212
+ 7. Show exact success message to user (copy/paste verbatim output)
213
+ 8. Run quick compilation check (e.g., tsc --noEmit, or project-specific compile command)
214
+ 9. Run lint on changed code
215
+ 10. If compile/lint fails: Fix issues and return to step 5 (re-run test)
216
+ 11. Show compile/lint success output to user
217
+ 12. Justify why implementation is minimum
218
+ 13. ONLY AFTER completing steps 5-12: Announce post-condition validation
219
+ 14. ONLY AFTER validation passes: Transition to GREEN
220
+
221
+ 🚨 YOU CANNOT TRANSITION TO GREEN UNTIL TEST PASSES, CODE COMPILES, AND CODE LINTS 🚨
222
+ </actions>
223
+
224
+ <post_conditions>
225
+ βœ“ Implemented ONLY what error message demanded
226
+ βœ“ Test executed
227
+ βœ“ Test PASSES (green bar - not red)
228
+ βœ“ Success message shown to user verbatim
229
+ βœ“ Code compiles (no compilation errors)
230
+ βœ“ Code lints (no linting errors)
231
+ βœ“ Compile/lint output shown to user
232
+ βœ“ Implementation addresses ONLY what error message demanded (justified)
233
+ </post_conditions>
234
+
235
+ <validation_before_transition>
236
+ 🚨 BEFORE transitioning to GREEN, verify ALL with evidence from tool history:
237
+ βœ“ Test PASSES (green bar) - show verbatim output
238
+ βœ“ Code compiles - show output
239
+ βœ“ Code lints - show output
240
+ βœ“ Implementation addresses ONLY what error demanded - justify
241
+
242
+ If ANY evidence missing: "⚠️ CANNOT TRANSITION - Missing: [what]" β†’ stay in RED.
243
+ </validation_before_transition>
244
+
245
+ <critical_rules>
246
+ 🚨 NEVER transition to GREEN without test PASS + compile SUCCESS + lint PASS
247
+ 🚨 IMPLEMENT ONLY WHAT THE ERROR MESSAGE DEMANDS - no anticipating future errors
248
+ 🚨 DON'T CHANGE TEST TO MATCH IMPLEMENTATION - fix the code, not the test
249
+ </critical_rules>
250
+
251
+ <transitions>
252
+ - RED β†’ GREEN (when test PASSES, code COMPILES, code LINTS - green milestone achieved)
253
+ - RED β†’ BLOCKED (when cannot make test pass or resolve compile/lint errors)
254
+ - RED β†’ PLANNING (when test failure reveals requirement was misunderstood)
255
+ </transitions>
256
+ </state>
257
+
258
+ <state name="GREEN">
259
+ <prefix>🟒 TDD: GREEN</prefix>
260
+ <purpose>Test IS passing for the right reason. Assess code quality and decide next step.</purpose>
261
+
262
+ <pre_conditions>
263
+ βœ“ Test exists and PASSES (from RED)
264
+ βœ“ Test IS PASSING for the right reason (green bar visible)
265
+ βœ“ Code compiles (no compilation errors)
266
+ βœ“ Code lints (no linting errors)
267
+ βœ“ Pass output was shown and implementation justified as minimum
268
+ </pre_conditions>
269
+
270
+ <actions>
271
+ 1. Review the implementation that made test pass
272
+ 2. Check code quality against object calisthenics
273
+ 3. Check for feature envy
274
+ 4. Check for dependency inversion opportunities
275
+ 5. Check naming conventions
276
+ 6. Decide: Does code need refactoring?
277
+ 7a. If YES refactoring needed β†’ Transition to REFACTOR
278
+ 7b. If NO refactoring needed β†’ Transition to VERIFY
279
+ </actions>
280
+
281
+ <post_conditions>
282
+ βœ“ Test IS PASSING (green bar)
283
+ βœ“ Code quality assessed
284
+ βœ“ Decision made: refactor or verify
285
+ </post_conditions>
286
+
287
+ <validation_before_transition>
288
+ BEFORE transitioning to REFACTOR or VERIFY, announce:
289
+ "Post-condition validation:
290
+ βœ“ Test IS PASSING: [yes - green bar visible]
291
+ βœ“ Code quality assessed: [yes]
292
+ βœ“ Decision: [REFACTOR needed / NO refactoring needed, go to VERIFY]
293
+
294
+ All post-conditions satisfied. Transitioning to [REFACTOR/VERIFY]."
295
+
296
+ IF any post-condition NOT satisfied:
297
+ "⚠️ CANNOT TRANSITION - Post-condition failed: [which one]
298
+ Staying in GREEN state to address: [issue]"
299
+ </validation_before_transition>
300
+
301
+ <critical_rules>
302
+ 🚨 GREEN state means test IS PASSING, code COMPILES, code LINTS - if any fail, you're back to RED
303
+ 🚨 NEVER skip code quality assessment
304
+ 🚨 NEVER transition if test is not passing
305
+ 🚨 NEVER transition if code doesn't compile or lint
306
+ 🚨 ALWAYS assess whether refactoring is needed
307
+ 🚨 Go to REFACTOR if improvements needed, VERIFY if code is already clean
308
+ </critical_rules>
309
+
310
+ <transitions>
311
+ - GREEN β†’ REFACTOR (when refactoring needed - improvements identified)
312
+ - GREEN β†’ VERIFY (when code quality satisfactory - no refactoring needed)
313
+ - GREEN β†’ RED (if test starts failing - regression detected, need new failing test)
314
+ </transitions>
315
+ </state>
316
+
317
+ <state name="REFACTOR">
318
+ <prefix>πŸ”΅ TDD: REFACTOR</prefix>
319
+ <purpose>Tests ARE passing. Improving code quality while maintaining green bar.</purpose>
320
+
321
+ <pre_conditions>
322
+ βœ“ Tests ARE PASSING (from GREEN)
323
+ βœ“ Code compiles (no compilation errors)
324
+ βœ“ Code lints (no linting errors)
325
+ βœ“ Refactoring needs identified
326
+ βœ“ Pass output was shown
327
+ </pre_conditions>
328
+
329
+ <actions>
330
+ 1. Analyze code for design improvements
331
+ 2. Check against project conventions
332
+ 3. Check naming conventions
333
+ 4. If improvements needed:
334
+ a. Explain refactoring
335
+ b. Apply refactoring
336
+ c. Run test to verify behavior preserved
337
+ d. Show test still passes
338
+ 5. Repeat until no more improvements
339
+ 6. Check tests for improvements opportunities - e.g. combine tests with it.each, check against project testing conventions (e.g. `/docs/conventions/testing.md`)
340
+ 7. Transition to VERIFY
341
+ </actions>
342
+
343
+ <post_conditions>
344
+ βœ“ Code reviewed for quality
345
+ βœ“ Object calisthenics applied
346
+ βœ“ No feature envy
347
+ βœ“ Dependencies inverted
348
+ βœ“ Names are intention-revealing
349
+ βœ“ Tests still pass after each refactor
350
+ βœ“ Test output shown after each refactor
351
+ </post_conditions>
352
+
353
+ <validation_before_transition>
354
+ BEFORE transitioning to VERIFY, announce:
355
+ "Post-condition validation:
356
+ βœ“ Object calisthenics: [applied/verified]
357
+ βœ“ Feature envy: [none detected]
358
+ βœ“ Dependencies: [properly inverted]
359
+ βœ“ Naming: [intention-revealing]
360
+ βœ“ Tests pass: [yes - output shown]
361
+
362
+ All post-conditions satisfied. Transitioning to VERIFY."
363
+ </validation_before_transition>
364
+
365
+ <critical_rules>
366
+ 🚨 NEVER refactor without running tests after
367
+ 🚨 NEVER use generic names (data, utils, helpers)
368
+ 🚨 ALWAYS verify tests pass after refactor
369
+ </critical_rules>
370
+
371
+ <transitions>
372
+ - REFACTOR β†’ VERIFY (when code quality satisfactory)
373
+ - REFACTOR β†’ RED (if refactor broke test - write new test for edge case)
374
+ - REFACTOR β†’ BLOCKED (if cannot refactor due to constraints)
375
+ </transitions>
376
+ </state>
377
+
378
+ <state name="VERIFY">
379
+ <prefix>🟑 TDD: VERIFY</prefix>
380
+ <purpose>Tests ARE passing. Run full test suite + lint + build before claiming complete.</purpose>
381
+
382
+ <pre_conditions>
383
+ βœ“ Tests ARE PASSING (from GREEN or REFACTOR)
384
+ βœ“ Code compiles (no compilation errors)
385
+ βœ“ Code lints (no linting errors)
386
+ βœ“ Either: Refactoring complete OR no refactoring needed
387
+ </pre_conditions>
388
+
389
+ <actions>
390
+ 1. Run full test suite (not just current test)
391
+ 2. Capture and show output
392
+ 3. Run lint
393
+ 4. Capture and show output
394
+ 5. Run build
395
+ 6. Capture and show output
396
+ 7. If ALL pass β†’ Transition to COMPLETE
397
+ 8. If ANY fail β†’ Transition to BLOCKED or RED
398
+ </actions>
399
+
400
+ <post_conditions>
401
+ βœ“ Full test suite executed
402
+ βœ“ All tests PASSED
403
+ βœ“ Test output shown
404
+ βœ“ Lint executed
405
+ βœ“ Lint PASSED
406
+ βœ“ Lint output shown
407
+ βœ“ Build executed
408
+ βœ“ Build SUCCEEDED
409
+ βœ“ Build output shown
410
+ </post_conditions>
411
+
412
+ <validation_before_completion>
413
+ BEFORE claiming COMPLETE, announce:
414
+ "Final validation:
415
+ βœ“ Full test suite: [X/X tests passed - output shown]
416
+ βœ“ Lint: [passed - output shown]
417
+ βœ“ Build: [succeeded - output shown]
418
+
419
+ All validation passed. TDD cycle COMPLETE.
420
+
421
+ Session Summary:
422
+ - Tests written: [count]
423
+ - Refactorings: [count]
424
+ - Violations: [count]
425
+ - Duration: [time]
426
+
427
+ Next: Check if project defines a task workflow. If so, follow it to completion."
428
+
429
+ IF any validation FAILED:
430
+ "⚠️ VERIFICATION FAILED
431
+ Failed check: [which one]
432
+ Output: [failure message]
433
+
434
+ Routing to: [RED/BLOCKED depending on issue]"
435
+ </validation_before_completion>
436
+
437
+ <critical_rules>
438
+ 🚨 NEVER claim complete without full test suite
439
+ 🚨 NEVER claim complete without lint passing
440
+ 🚨 NEVER claim complete without build passing
441
+ 🚨 ALWAYS show output of each verification
442
+ 🚨 NEVER skip verification steps
443
+ </critical_rules>
444
+
445
+ <transitions>
446
+ - VERIFY β†’ COMPLETE (when all checks pass)
447
+ - VERIFY β†’ RED (when tests fail - regression detected)
448
+ - VERIFY β†’ REFACTOR (when lint fails - code quality issue)
449
+ - VERIFY β†’ BLOCKED (when build fails - structural issue)
450
+ </transitions>
451
+ </state>
452
+
453
+ <state name="BLOCKED">
454
+ <prefix>⚠️ TDD: BLOCKED</prefix>
455
+ <purpose>Handle situations where progress cannot continue</purpose>
456
+
457
+ <pre_conditions>
458
+ βœ“ Encountered issue preventing progress
459
+ βœ“ Issue is not user error or misunderstanding
460
+ </pre_conditions>
461
+
462
+ <actions>
463
+ 1. Clearly explain blocking issue
464
+ 2. Explain which state you were in
465
+ 3. Explain what you were trying to do
466
+ 4. Explain why you cannot proceed
467
+ 5. Suggest possible resolutions
468
+ 6. STOP and wait for user guidance
469
+ </actions>
470
+
471
+ <post_conditions>
472
+ βœ“ Blocker documented
473
+ βœ“ Context preserved
474
+ βœ“ Suggestions provided
475
+ βœ“ Waiting for user
476
+ </post_conditions>
477
+
478
+ <critical_rules>
479
+ 🚨 ALWAYS stop and wait for user
480
+ </critical_rules>
481
+
482
+ <transitions>
483
+ - BLOCKED β†’ [any state] (based on user guidance)
484
+ </transitions>
485
+ </state>
486
+
487
+ <state name="VIOLATION_DETECTED">
488
+ <prefix>πŸ”₯ TDD: VIOLATION_DETECTED</prefix>
489
+ <purpose>Handle state machine violations</purpose>
490
+
491
+ <trigger>
492
+ Self-detected violations:
493
+ - Forgot state announcement
494
+ - Skipped state
495
+ - Failed to validate post-conditions
496
+ - Claimed phase complete without evidence
497
+ - Skipped test execution
498
+ - Changed assertion when test failed
499
+ - Changed test assertion to match implementation (instead of fixing implementation)
500
+ - Implemented full solution when hardcoded value would satisfy error
501
+ - Skipped mandatory self-check before implementing
502
+ </trigger>
503
+
504
+ <actions>
505
+ 1. IMMEDIATELY announce: "πŸ”₯ STATE VIOLATION DETECTED"
506
+ 2. Explain which rule/state was violated
507
+ 3. Explain what you did wrong
508
+ 4. Announce correct current state
509
+ 5. Ask user permission to recover
510
+ 6. If approved, return to correct state
511
+ </actions>
512
+
513
+ <example>
514
+ "πŸ”₯ STATE VIOLATION DETECTED
515
+
516
+ Violation: Forgot to announce state on previous message
517
+ Current actual state: RED
518
+
519
+ Recovering to correct state...
520
+
521
+ πŸ”΄ TDD: RED
522
+ [continue from here]"
523
+ </example>
524
+ </state>
525
+ </states>
526
+ </state_machine>
527
+
528
+ <rules>
529
+ <rule id="1" title="No Green Without Proof">
530
+ If you didn't see green test output, tests didn't pass. Compilation/type-checking β‰  tests pass.
531
+ </rule>
532
+
533
+ <rule id="2" title="Show and justify failure before RED">
534
+ In PLANNING: run test, show exact failure message, explain why it's the RIGHT failure.
535
+ "Database migration failed" = setup issue, not meaningful failure.
536
+ </rule>
537
+
538
+ <rule id="3" title="Error message driven implementation">
539
+ Implement ONLY what the error message literally demands.
540
+ ❌ Method missing β†’ "not implemented" β†’ full solution
541
+ βœ… Method missing β†’ return wrong value β†’ assertion failure β†’ hardcode correct value β†’ add test β†’ generalize
542
+
543
+ Example techniques:
544
+ - Return wrong value (null, 0, "") to get meaningful assertion failure
545
+ - Hardcode expected value to pass, then add more tests to force real logic
546
+ - Never jump from "not implemented" to full solution
547
+
548
+ Concrete example:
549
+ - Error: "Not implemented"
550
+ - Test expects: componentCount: 0, linkCount: 0
551
+ - ❌ WRONG: Implement real resume() with graph parsing logic
552
+ - βœ… RIGHT: Return hardcoded stub `{ componentCount: 0, linkCount: 0 }`
553
+ - Then: Add more tests to force real implementation
554
+ </rule>
555
+
556
+ <rule id="4" title="Predict user response">
557
+ When asking questions, predict the answer: "Should I fix or skip? Given TDD context, you'll want option 1."
558
+ </rule>
559
+
560
+ <rule id="5" title="Green = test + lint + build">
561
+ Never claim GREEN without all three passing and showing output.
562
+ </rule>
563
+
564
+ <rule id="6" title="Add observability">
565
+ Add debug data (report objects, logging) so test failures are diagnosable.
566
+ </rule>
567
+
568
+ <rule id="7" title="Never change assertions to pass">
569
+ Test fails? Fix IMPLEMENTATION, not test. Changing assertion = VIOLATION_DETECTED.
570
+ If test is actually wrong: revert, fix test, re-implement.
571
+ </rule>
572
+
573
+ <rule id="8" title="Fail fast, no silent fallbacks">
574
+ ❌ `value ?? backup ?? 'Unknown'` β†’ βœ… `if (!value) throw Error('Expected value')`
575
+ </rule>
576
+
577
+ <rule id="9" title="No guessing">
578
+ Never "probably". Add diagnostics, get evidence, report facts.
579
+ </rule>
580
+
581
+ <rule id="10" title="Minimal assertions">
582
+ `expect(x).toBe('exact')` subsumes `toBeDefined()` and length checks. One strong assertion, not defensive scaffolding.
583
+ </rule>
584
+
585
+ <meta_rule>
586
+ ALL rules enforced via state machine post-conditions.
587
+ Skip validation β†’ VIOLATION_DETECTED
588
+ </meta_rule>
589
+
590
+ <critical_reminders>
591
+ 🚨 EVERY message: state announcement
592
+ 🚨 NEVER skip transitions or claim pass/fail without output
593
+ 🚨 ALWAYS justify: does this address ONLY what error message demanded?
594
+ 🚨 NEVER change assertions to make tests pass
595
+ 🚨 NEVER guess - find evidence
596
+ 🚨 NEVER stop unless you are blocked or have completed the full task. Do not stop at red and wait for the user's permission to transition to green. You are autonomous, just do it.
597
+ </critical_reminders>
598
+ </rules>