@jakkrichm/create-nexus-devflow 2.16.2 → 2.16.4

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,36 @@
1
+ # Root-Cause Tracing
2
+
3
+ Read when an error occurs deep in the call stack or the source of invalid data is unclear.
4
+ Use with Phase 4 of [debug](SKILL.md); hand repair plans to /fix and /implement.
5
+
6
+ ## 5-Step Backward Trace
7
+
8
+ 1. **Observe symptom**: Capture the error, stack, and exact location.
9
+ 2. **Immediate cause**: Identify the failing operation and invalid input.
10
+ 3. **Caller**: Find who supplied that input.
11
+ 4. **Trace upward**: Follow the parameter back one call at a time to its origin.
12
+ 5. **Original trigger**: Reproduce the root cause and propose a regression test.
13
+
14
+ Example: a test reads tempDir before beforeEach runs, passes an empty value,
15
+ and git init uses the wrong cwd. Prove the setup order before proposing a source guard.
16
+
17
+ ## Stack Trace Instrumentation
18
+
19
+ Use a scratch reproduction or debugger within /debug's boundaries.
20
+ Record only redacted data; never dump the environment or secrets.
21
+
22
+ ```typescript
23
+ console.error('[DEBUG-trace]', {
24
+ hasDirectory: Boolean(directory?.trim()),
25
+ stack: new Error().stack,
26
+ });
27
+ ```
28
+
29
+ Use `rg 'DEBUG-trace' diagnostic.log` to locate probes, then remove them when finished.
30
+ Across multiple layers, compare inputs and outputs at each seam using SET/UNSET status only.
31
+
32
+ If the bug appears only when tests run together, repeatedly bisect the test set
33
+ to find the polluter, checking state before and after each subset.
34
+
35
+ Finish when the trigger, call chain, and reproduction evidence are established.
36
+ Then use [defense-in-depth.md](defense-in-depth.md) to plan protective checks.
@@ -114,6 +114,18 @@ Work through the spec's build steps in order, one at a time. For each step:
114
114
  - **🟢 GREEN**: Implement only the minimal code in the source file necessary to make the test pass. Re-run test and show passing output.
115
115
  - **🔵 REFACTOR**: Refactor and format cleanly, verifying that 100% of tests remain green.
116
116
  - *Code Reversion Rule*: If production code is written without a prior test for behavior changes, revert it and write the test first.
117
+
118
+ **⚖️ The Iron Law**: `NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST` — Apply to behavior changes according to the spec's test decision. If code came first, revert only your own work for that step and restart from the test, preserving the user's existing work.
119
+
120
+ **Red-Phase Verification (confirm all three before GREEN):**
121
+ - The test actually fails, rather than encountering a syntax error
122
+ - The error message identifies missing behavior, rather than invalid configuration
123
+ - The failure reflects the behavior under test, rather than a bug in the test itself
124
+
125
+ **Green-Phase Discipline**: Write the minimum code needed to pass the test; add only the options/features it requires (YAGNI constraint).
126
+
127
+ > 📖 For anti-patterns and Bad vs Good examples, read [`tdd-anti-patterns.md`](tdd-anti-patterns.md).
128
+
117
129
  2. Implement just that step: the smallest change that satisfies its "done when."
118
130
  3. Show the **diff**, not whole files.
119
131
  4. **Explain it, and prove it.** Give a short summary: what the step delivered,
@@ -0,0 +1,44 @@
1
+ # TDD Anti-Patterns
2
+
3
+ Read when planning RED/GREEN or reviewing test quality.
4
+ Follow the test decision in the spec and [implement](SKILL.md).
5
+
6
+ ## The Iron Law
7
+
8
+ `NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST`
9
+
10
+ For behavior changes, observe the intended test failure before writing production code.
11
+ If code came first, revert only your own work for that step and restart from the test.
12
+ Preserve the user's existing work; verify docs/config without logic as specified in the spec.
13
+
14
+ ## Red-Phase Checklist
15
+
16
+ - The test actually fails, rather than encountering a syntax/import error.
17
+ - The failure message identifies missing or incorrect behavior.
18
+ - Test setup is valid, and the intended assertion fails.
19
+
20
+ If the test passes immediately, check whether it exercises the new behavior.
21
+ Fix setup errors and rerun before GREEN.
22
+
23
+ | Bad | Good |
24
+ | :--- | :--- |
25
+ | Name: `retry works` | `returns success after transient failure` |
26
+ | Assert only mock calls | Assert outcomes and attempt counts when part of the contract |
27
+ | Combine multiple behaviors | Separate success, retry, and exhausted failure |
28
+ | Write tests without running them | RED → GREEN → REFACTOR with evidence at each stage |
29
+ | Add options for future use | Implement only behavior required by the spec/test |
30
+
31
+ ```typescript
32
+ let attempts = 0;
33
+ const result = await retryOperation(async () => {
34
+ attempts++;
35
+ if (attempts < 3) throw new Error('transient');
36
+ return 'ok';
37
+ });
38
+ assert.equal(result, 'ok');
39
+ assert.equal(attempts, 3);
40
+ ```
41
+
42
+ During GREEN, write the minimum code needed to pass; then REFACTOR while tests stay green.
43
+ Mock only necessary boundaries; check the dependency's contract before creating a fake.
44
+ Finish with evidence of RED for the intended reason, GREEN for the behavior, and regression checks.
@@ -268,3 +268,11 @@
268
268
  - *Scope*: สร้างและกำหนดค่า Wrapper Shims สำหรับ Unscoped NPM Packages: `nexus-devflow` (เพื่อรองรับ `npx nexus-devflow`) และ `create-nexus-devflow` (เพื่อรองรับ `npm create nexus-devflow`), อัปเดต Pipeline การ Publish ใน `.github/workflows/publish.yml` และ `publish-devflow` ให้ซิงก์เวอร์ชันและเผยแพร่คู่ขนานกับ `@jakkrichm/create-nexus-devflow`, อัปเดตเอกสาร `AGENTS.md`, `CLAUDE.md` และ README ให้แนะนำคำสั่งสั้นเป็นหลัก
269
269
 
270
270
 
271
+
272
+ ---
273
+
274
+ ## Phase 35: Superpowers Debugging & TDD Heuristics Integration
275
+
276
+ - [x] **35. Superpowers Debugging Heuristics & TDD Reference Guides (`DISC-20260909-003`, `085-superpowers-debugging-heuristics-integration`)** `[Size: S]`
277
+ - *Dependencies*: Feature 31 (`081`), Feature 32 (`082`)
278
+ - *Scope*: เพิ่ม JIT reference guides สำหรับ root-cause tracing, defense-in-depth, condition-based waiting, TDD anti-patterns และ two-stage review พร้อม 3-Strike Rule และ Iron Law; ซิงก์ `.agents/` กับ `.claude/` และตรวจ file contracts
@@ -121,6 +121,55 @@ abstraction. `/debug` diagnoses first and hands confirmed repairs to `/fix` or
121
121
 
122
122
  ---
123
123
 
124
+ ### Debugging, TDD & Review Reference Guides
125
+
126
+ The `debug`, `implement`, and `audit` skills include five English reference guides.
127
+ They are supporting files read when needed, not additional commands. Both
128
+ `.agents/skills/` and `.claude/skills/` contain matching copies; no separate
129
+ Superpowers plugin installation is required.
130
+
131
+ | Situation | Entry point | Reference guide |
132
+ | :--- | :--- | :--- |
133
+ | Error deep in a call stack or unclear input origin | `/debug` Phase 4 | [Root-cause tracing](../../.agents/skills/debug/root-cause-tracing.md) |
134
+ | Confirmed root cause needs protective checks | `/debug` repair planning → `/fix` → `/implement` | [Defense-in-depth](../../.agents/skills/debug/defense-in-depth.md) |
135
+ | Flaky async tests or guessed sleep delays | `/debug` Phase 4 | [Condition-based waiting](../../.agents/skills/debug/condition-based-waiting.md) |
136
+ | Planning RED/GREEN or inspecting test quality | `/implement [id]` | [TDD anti-patterns](../../.agents/skills/implement/tdd-anti-patterns.md) |
137
+ | Preparing an independent review | `/audit independent current` | [Two-stage review template](../../.agents/skills/audit/two-stage-review-template.md) |
138
+
139
+ **Debugging:** Trace the trigger before planning a repair. Use validation layers
140
+ according to actual invariants and risks, and keep diagnostic output redacted.
141
+ The waiting example accepts synchronous predicates only; async I/O needs an
142
+ appropriate async helper with cancellation or timeout. `/debug` remains a
143
+ diagnostic stage. After three unsuccessful repair attempts in the supplied
144
+ history, stop and discuss the architecture before attempting another fix.
145
+
146
+ **Implementation:** Apply the Iron Law to behavior changes according to the
147
+ spec's test decision: observe the intended failing test before production code.
148
+ Confirm that RED reflects missing behavior rather than broken setup, implement
149
+ the minimum change for GREEN, then refactor with tests passing. Preserve existing
150
+ user work; verify documentation or configuration without logic as the spec directs.
151
+
152
+ **Review:** Check spec compliance first, then code quality only after Stage 1
153
+ passes. Use the template alongside the canonical
154
+ [independent-review contract](../../.agents/skills/audit/reference/independent-review.md).
155
+ The configured gate still determines whether review runs, and its request,
156
+ immutable checkpoint, reviewer identity, and receipt requirements remain in force.
157
+ Open or fixed P0/P1 findings continue to block completion.
158
+
159
+ Example prompts (use `$debug` and `$implement` in Codex where appropriate):
160
+
161
+ ```text
162
+ /debug "This async test passes locally but times out in CI; inspect its waiting conditions"
163
+ /implement 085
164
+ /audit independent current
165
+ ```
166
+
167
+ Replace `085` with your active task ID. For the review prompt, ask the reviewer
168
+ to use `audit/two-stage-review-template.md` with the canonical receipt contract;
169
+ the template does not launch a reviewer or authorize a checkpoint commit itself.
170
+
171
+ ---
172
+
124
173
  ## 6. Web Dashboard & CLI Management
125
174
 
126
175
  ```bash
@@ -50,6 +50,11 @@ All development tasks (from small UI fixes to deep architectural features) execu
50
50
 
51
51
  ## 4. Pre-Flight Discovery, SA & Architectural Alignment
52
52
 
53
+ For debugging, TDD, and independent review, see the
54
+ [English JIT reference guides](USAGE.md#debugging-tdd--review-reference-guides).
55
+ Use them through `debug`, `implement`, and `audit`; they are bundled supporting
56
+ files, not additional commands or a separate plugin installation.
57
+
53
58
  Before committing to delivery, use specialized companion skills to refine complex requirements:
54
59
 
55
60
  ```text