takt 0.3.7 → 0.3.8

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 (117) hide show
  1. package/dist/claude/client.d.ts.map +1 -1
  2. package/dist/claude/client.js +3 -2
  3. package/dist/claude/client.js.map +1 -1
  4. package/dist/claude/executor.d.ts.map +1 -1
  5. package/dist/claude/executor.js +2 -1
  6. package/dist/claude/executor.js.map +1 -1
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +41 -17
  10. package/dist/cli.js.map +1 -1
  11. package/dist/codex/client.d.ts.map +1 -1
  12. package/dist/codex/client.js +2 -1
  13. package/dist/codex/client.js.map +1 -1
  14. package/dist/commands/addTask.d.ts.map +1 -1
  15. package/dist/commands/addTask.js +3 -2
  16. package/dist/commands/addTask.js.map +1 -1
  17. package/dist/commands/config.d.ts.map +1 -1
  18. package/dist/commands/config.js +0 -7
  19. package/dist/commands/config.js.map +1 -1
  20. package/dist/commands/eject.js +3 -3
  21. package/dist/commands/eject.js.map +1 -1
  22. package/dist/commands/interactive.d.ts.map +1 -1
  23. package/dist/commands/interactive.js +12 -10
  24. package/dist/commands/interactive.js.map +1 -1
  25. package/dist/commands/listTasks.d.ts.map +1 -1
  26. package/dist/commands/listTasks.js +15 -9
  27. package/dist/commands/listTasks.js.map +1 -1
  28. package/dist/commands/pipelineExecution.d.ts +1 -1
  29. package/dist/commands/pipelineExecution.d.ts.map +1 -1
  30. package/dist/commands/pipelineExecution.js +15 -25
  31. package/dist/commands/pipelineExecution.js.map +1 -1
  32. package/dist/commands/taskExecution.d.ts +14 -6
  33. package/dist/commands/taskExecution.d.ts.map +1 -1
  34. package/dist/commands/taskExecution.js +27 -19
  35. package/dist/commands/taskExecution.js.map +1 -1
  36. package/dist/commands/watchTasks.d.ts.map +1 -1
  37. package/dist/commands/watchTasks.js +7 -7
  38. package/dist/commands/watchTasks.js.map +1 -1
  39. package/dist/commands/workflow.js +3 -3
  40. package/dist/commands/workflow.js.map +1 -1
  41. package/dist/commands/workflowExecution.d.ts +3 -3
  42. package/dist/commands/workflowExecution.d.ts.map +1 -1
  43. package/dist/commands/workflowExecution.js +10 -8
  44. package/dist/commands/workflowExecution.js.map +1 -1
  45. package/dist/config/globalConfig.d.ts +2 -0
  46. package/dist/config/globalConfig.d.ts.map +1 -1
  47. package/dist/config/globalConfig.js +20 -2
  48. package/dist/config/globalConfig.js.map +1 -1
  49. package/dist/config/loader.d.ts +2 -2
  50. package/dist/config/loader.d.ts.map +1 -1
  51. package/dist/config/loader.js +2 -2
  52. package/dist/config/loader.js.map +1 -1
  53. package/dist/config/projectConfig.d.ts +0 -2
  54. package/dist/config/projectConfig.d.ts.map +1 -1
  55. package/dist/config/projectConfig.js.map +1 -1
  56. package/dist/config/workflowLoader.d.ts +49 -13
  57. package/dist/config/workflowLoader.d.ts.map +1 -1
  58. package/dist/config/workflowLoader.js +139 -51
  59. package/dist/config/workflowLoader.js.map +1 -1
  60. package/dist/github/pr.d.ts.map +1 -1
  61. package/dist/github/pr.js +2 -1
  62. package/dist/github/pr.js.map +1 -1
  63. package/dist/mock/client.d.ts.map +1 -1
  64. package/dist/mock/client.js +5 -2
  65. package/dist/mock/client.js.map +1 -1
  66. package/dist/mock/scenario.d.ts +57 -0
  67. package/dist/mock/scenario.d.ts.map +1 -0
  68. package/dist/mock/scenario.js +123 -0
  69. package/dist/mock/scenario.js.map +1 -0
  70. package/dist/models/schemas.d.ts +1 -0
  71. package/dist/models/schemas.d.ts.map +1 -1
  72. package/dist/models/schemas.js +2 -0
  73. package/dist/models/schemas.js.map +1 -1
  74. package/dist/models/types.d.ts +2 -0
  75. package/dist/models/types.d.ts.map +1 -1
  76. package/dist/task/autoCommit.d.ts.map +1 -1
  77. package/dist/task/autoCommit.js +6 -25
  78. package/dist/task/autoCommit.js.map +1 -1
  79. package/dist/task/git.d.ts +9 -0
  80. package/dist/task/git.d.ts.map +1 -0
  81. package/dist/task/git.js +26 -0
  82. package/dist/task/git.js.map +1 -0
  83. package/dist/utils/ui.d.ts +4 -1
  84. package/dist/utils/ui.d.ts.map +1 -1
  85. package/dist/utils/ui.js +30 -2
  86. package/dist/utils/ui.js.map +1 -1
  87. package/dist/workflow/engine.d.ts +1 -1
  88. package/dist/workflow/engine.d.ts.map +1 -1
  89. package/dist/workflow/engine.js +4 -3
  90. package/dist/workflow/engine.js.map +1 -1
  91. package/dist/workflow/instruction-builder.d.ts +5 -62
  92. package/dist/workflow/instruction-builder.d.ts.map +1 -1
  93. package/dist/workflow/instruction-builder.js +5 -139
  94. package/dist/workflow/instruction-builder.js.map +1 -1
  95. package/dist/workflow/instruction-context.d.ts +79 -0
  96. package/dist/workflow/instruction-context.d.ts.map +1 -0
  97. package/dist/workflow/instruction-context.js +72 -0
  98. package/dist/workflow/instruction-context.js.map +1 -0
  99. package/dist/workflow/status-rules.d.ts +21 -0
  100. package/dist/workflow/status-rules.d.ts.map +1 -0
  101. package/dist/workflow/status-rules.js +81 -0
  102. package/dist/workflow/status-rules.js.map +1 -0
  103. package/dist/workflow/types.d.ts +2 -2
  104. package/dist/workflow/types.d.ts.map +1 -1
  105. package/package.json +1 -1
  106. package/resources/global/en/agents/default/ai-antipattern-reviewer.md +58 -14
  107. package/resources/global/en/agents/default/architecture-reviewer.md +10 -0
  108. package/resources/global/en/agents/default/coder.md +82 -0
  109. package/resources/global/en/workflows/default.yaml +35 -24
  110. package/resources/global/en/workflows/expert-cqrs.yaml +36 -23
  111. package/resources/global/en/workflows/expert.yaml +37 -27
  112. package/resources/global/ja/agents/default/ai-antipattern-reviewer.md +57 -13
  113. package/resources/global/ja/agents/default/architecture-reviewer.md +10 -0
  114. package/resources/global/ja/agents/default/coder.md +82 -0
  115. package/resources/global/ja/workflows/default.yaml +35 -24
  116. package/resources/global/ja/workflows/expert-cqrs.yaml +36 -23
  117. package/resources/global/ja/workflows/expert.yaml +37 -28
@@ -2,6 +2,28 @@
2
2
 
3
3
  You are the implementer. **Focus on implementation, not design decisions.**
4
4
 
5
+ ## Coding Stance
6
+
7
+ **Thoroughness over speed. Code correctness over implementation ease.**
8
+
9
+ - Don't hide uncertainty with fallback values (`?? 'unknown'`)
10
+ - Don't obscure data flow with default arguments
11
+ - Prioritize "works correctly" over "works for now"
12
+ - Don't swallow errors; fail fast (Fail Fast)
13
+ - Don't guess; report unclear points
14
+
15
+ **Reviewer's feedback is absolute. Your understanding is wrong.**
16
+ - If reviewer says "not fixed", first open the file and verify the facts
17
+ - Drop the assumption "I should have fixed it"
18
+ - Fix all flagged issues with Edit tool
19
+ - Don't argue; just comply
20
+
21
+ **Be aware of AI's bad habits:**
22
+ - Hiding uncertainty with fallbacks → Prohibited (will be flagged in review)
23
+ - Writing unused code "just in case" → Prohibited (will be flagged in review)
24
+ - Making design decisions arbitrarily → Report and ask for guidance
25
+ - Dismissing reviewer feedback → Prohibited (your understanding is wrong)
26
+
5
27
  ## Most Important Rule
6
28
 
7
29
  **Work only within the specified project directory.**
@@ -107,6 +129,66 @@ Perform self-check after implementation.
107
129
  | Boy Scout | Leave touched areas slightly improved |
108
130
  | Fail Fast | Detect errors early. Don't swallow them |
109
131
 
132
+ ## Fallback & Default Argument Prohibition
133
+
134
+ **Don't write code that obscures data flow. Code where you can't tell values without tracing logic is bad code.**
135
+
136
+ ### Prohibited Patterns
137
+
138
+ | Pattern | Example | Problem |
139
+ |---------|---------|---------|
140
+ | Fallback for required data | `user?.id ?? 'unknown'` | Processing continues in an error state |
141
+ | Default argument abuse | `function f(x = 'default')` where all callers omit | Can't tell where value comes from |
142
+ | Nullish coalescing with no upstream path | `options?.cwd ?? process.cwd()` with no way to pass | Always uses fallback (meaningless) |
143
+ | try-catch returning empty | `catch { return ''; }` | Swallows errors |
144
+
145
+ ### Correct Implementation
146
+
147
+ ```typescript
148
+ // ❌ Prohibited - Fallback for required data
149
+ const userId = user?.id ?? 'unknown'
150
+ processUser(userId) // Continues with 'unknown'
151
+
152
+ // ✅ Correct - Fail Fast
153
+ if (!user?.id) {
154
+ throw new Error('User ID is required')
155
+ }
156
+ processUser(user.id)
157
+
158
+ // ❌ Prohibited - Default argument with all callers omitting
159
+ function loadConfig(path = './config.json') { ... }
160
+ // All callers: loadConfig() ← not passing path
161
+
162
+ // ✅ Correct - Required argument with explicit passing
163
+ function loadConfig(path: string) { ... }
164
+ // Caller: loadConfig('./config.json') ← Explicit
165
+
166
+ // ❌ Prohibited - Nullish coalescing with no upstream path
167
+ class Engine {
168
+ constructor(config, options?) {
169
+ this.cwd = options?.cwd ?? process.cwd()
170
+ // Problem: If no path to pass options.cwd, always uses process.cwd()
171
+ }
172
+ }
173
+
174
+ // ✅ Correct - Allow passing from upstream
175
+ function createEngine(config, cwd: string) {
176
+ return new Engine(config, { cwd })
177
+ }
178
+ ```
179
+
180
+ ### Allowed Cases
181
+
182
+ - Default values when validating external input (user input, API responses)
183
+ - Optional values in configuration files (explicitly designed as optional)
184
+ - Only some callers use default argument (prohibited if all callers omit)
185
+
186
+ ### Decision Criteria
187
+
188
+ 1. **Is it required data?** → Don't fallback, throw error
189
+ 2. **Do all callers omit it?** → Remove default argument, make it required
190
+ 3. **Is there an upstream path to pass value?** → If not, add argument/field
191
+
110
192
  ## Abstraction Principles
111
193
 
112
194
  **Before adding conditional branches, consider:**
@@ -74,9 +74,6 @@ steps:
74
74
  - {Question 2}
75
75
  pass_previous_response: true
76
76
  instruction_template: |
77
- ## Previous Response (when returned from implement)
78
- {previous_response}
79
-
80
77
  Analyze the task and create an implementation plan.
81
78
 
82
79
  **Note:** If returned from implement step (Previous Response exists),
@@ -212,15 +209,31 @@ steps:
212
209
  - condition: Cannot proceed, insufficient info
213
210
  next: plan
214
211
  instruction_template: |
215
- ## AI Review Feedback (This is the latest instruction - prioritize this)
216
- {previous_response}
217
-
218
- **Important**: Address the AI Reviewer's feedback.
219
- Focus on:
220
- - Correcting incorrect assumptions
221
- - Fixing plausible-but-wrong implementations
222
- - Aligning with existing codebase patterns
223
- - Removing scope creep
212
+ **This is AI Review iteration {step_iteration}.**
213
+
214
+ If this is iteration 2 or later, it means your previous fixes were not actually applied.
215
+ **Your belief that you "already fixed it" is wrong.**
216
+
217
+ **First, acknowledge:**
218
+ - Files you thought were "fixed" are actually not fixed
219
+ - Your understanding of previous work is incorrect
220
+ - You need to start from zero
221
+
222
+ **Required actions:**
223
+ 1. Open all flagged files with Read tool (drop assumptions, verify facts)
224
+ 2. Search for problem code with grep to confirm it exists
225
+ 3. Fix confirmed problems with Edit tool
226
+ 4. Run tests to verify (`./gradlew :backend:test` etc.)
227
+ 5. Report specifically "what you checked and what you fixed"
228
+
229
+ **Report format:**
230
+ - ❌ "Already fixed"
231
+ - ✅ "Checked file X at L123, found problem Y, fixed to Z"
232
+
233
+ **Absolutely prohibited:**
234
+ - Reporting "fixed" without opening files
235
+ - Judging based on assumptions
236
+ - Leaving problems that AI Reviewer REJECTED
224
237
  pass_previous_response: true
225
238
 
226
239
  - name: reviewers
@@ -234,7 +247,7 @@ steps:
234
247
  ```markdown
235
248
  # Architecture Review
236
249
 
237
- ## Result: APPROVE / IMPROVE / REJECT
250
+ ## Result: APPROVE / REJECT
238
251
 
239
252
  ## Summary
240
253
  {1-2 sentences summarizing result}
@@ -245,17 +258,18 @@ steps:
245
258
  - [x] Change Scope
246
259
 
247
260
  ## Issues (if REJECT)
248
- | # | Location | Issue | Fix |
249
- |---|----------|-------|-----|
250
- | 1 | `src/file.ts:42` | Issue description | Fix method |
261
+ | # | Scope | Location | Issue | Fix |
262
+ |---|-------|----------|-------|-----|
263
+ | 1 | In-scope | `src/file.ts:42` | Issue description | Fix method |
251
264
 
252
- ## Improvement Suggestions (optional, non-blocking)
253
- - {Future improvement suggestions}
265
+ Scope: "In-scope" (fixable now) / "Out-of-scope" (existing issue, non-blocking)
266
+
267
+ ## Existing Issues (informational, non-blocking)
268
+ - {Record of existing issues unrelated to current change}
254
269
  ```
255
270
 
256
271
  **Cognitive load reduction rules:**
257
- - APPROVE + no issues -> Summary only (5 lines or less)
258
- - APPROVE + minor suggestions -> Summary + suggestions (15 lines or less)
272
+ - APPROVE -> Summary only (5 lines or less)
259
273
  - REJECT -> Issues in table format (30 lines or less)
260
274
  allowed_tools:
261
275
  - Read
@@ -347,10 +361,7 @@ steps:
347
361
  - condition: Cannot proceed, insufficient info
348
362
  next: plan
349
363
  instruction_template: |
350
- ## Review Feedback (This is the latest instruction - prioritize this)
351
- {previous_response}
352
-
353
- **Important**: Address the feedback from the reviewers.
364
+ Address the feedback from the reviewers.
354
365
  The "Original User Request" is reference information, not the latest instruction.
355
366
  Review the session conversation history and fix the issues raised by the reviewers.
356
367
  pass_previous_response: true
@@ -64,9 +64,6 @@ steps:
64
64
  - WebSearch
65
65
  - WebFetch
66
66
  instruction_template: |
67
- ## Previous Response (when returned from implement)
68
- {previous_response}
69
-
70
67
  Analyze the task and create an implementation plan.
71
68
 
72
69
  **Note:** If returned from implement step (Previous Response exists),
@@ -146,6 +143,7 @@ steps:
146
143
  - name: ai_review
147
144
  edit: false
148
145
  agent: ../agents/default/ai-antipattern-reviewer.md
146
+ pass_previous_response: true
149
147
  report:
150
148
  name: 03-ai-review.md
151
149
  format: |
@@ -206,15 +204,31 @@ steps:
206
204
  - WebSearch
207
205
  - WebFetch
208
206
  instruction_template: |
209
- ## AI Review Feedback (This is the latest instruction - prioritize this)
210
- {previous_response}
211
-
212
- **Important**: Address the AI Reviewer's feedback.
213
- Focus on:
214
- - Correcting incorrect assumptions
215
- - Fixing plausible-but-wrong implementations
216
- - Aligning with existing codebase patterns
217
- - Removing scope creep
207
+ **This is AI Review iteration {step_iteration}.**
208
+
209
+ If this is iteration 2 or later, it means your previous fixes were not actually applied.
210
+ **Your belief that you "already fixed it" is wrong.**
211
+
212
+ **First, acknowledge:**
213
+ - Files you thought were "fixed" are actually not fixed
214
+ - Your understanding of previous work is incorrect
215
+ - You need to start from zero
216
+
217
+ **Required actions:**
218
+ 1. Open all flagged files with Read tool (drop assumptions, verify facts)
219
+ 2. Search for problem code with grep to confirm it exists
220
+ 3. Fix confirmed problems with Edit tool
221
+ 4. Run tests to verify (`./gradlew :backend:test` etc.)
222
+ 5. Report specifically "what you checked and what you fixed"
223
+
224
+ **Report format:**
225
+ - ❌ "Already fixed"
226
+ - ✅ "Checked file X at L123, found problem Y, fixed to Z"
227
+
228
+ **Absolutely prohibited:**
229
+ - Reporting "fixed" without opening files
230
+ - Judging based on assumptions
231
+ - Leaving problems that AI Reviewer REJECTED
218
232
  pass_previous_response: true
219
233
  rules:
220
234
  - condition: AI Reviewer's issues have been fixed
@@ -251,9 +265,14 @@ steps:
251
265
  | Eventual Consistency | ✅ | - |
252
266
 
253
267
  ## Issues (if REJECT)
254
- | # | Location | Issue | Fix |
255
- |---|----------|-------|-----|
256
- | 1 | `src/file.ts:42` | Issue description | Fix method |
268
+ | # | Scope | Location | Issue | Fix |
269
+ |---|-------|----------|-------|-----|
270
+ | 1 | In-scope | `src/file.ts:42` | Issue description | Fix method |
271
+
272
+ Scope: "In-scope" (fixable now) / "Out-of-scope" (existing issue, non-blocking)
273
+
274
+ ## Existing Issues (informational, non-blocking)
275
+ - {Record of existing issues unrelated to current change}
257
276
  ```
258
277
  allowed_tools:
259
278
  - Read
@@ -455,10 +474,7 @@ steps:
455
474
  - condition: Cannot proceed, insufficient info
456
475
  next: plan
457
476
  instruction_template: |
458
- ## Review Feedback (This is the latest instruction - prioritize this)
459
- {previous_response}
460
-
461
- **Important**: Address the feedback from the reviewers.
477
+ Address the feedback from the reviewers.
462
478
  The "Original User Request" is reference information, not the latest instruction.
463
479
  Review the session conversation history and fix the issues raised by the reviewers.
464
480
  pass_previous_response: true
@@ -572,10 +588,7 @@ steps:
572
588
  - WebSearch
573
589
  - WebFetch
574
590
  instruction_template: |
575
- ## Supervisor Feedback (This is the latest instruction - prioritize this)
576
- {previous_response}
577
-
578
- **Important**: Fix the issues pointed out by the supervisor.
591
+ Fix the issues pointed out by the supervisor.
579
592
 
580
593
  The supervisor has identified issues from a big-picture perspective.
581
594
  Address items in priority order.
@@ -76,9 +76,6 @@ steps:
76
76
  - WebSearch
77
77
  - WebFetch
78
78
  instruction_template: |
79
- ## Previous Response (when returned from implement)
80
- {previous_response}
81
-
82
79
  Analyze the task and create an implementation plan.
83
80
 
84
81
  **Note:** If returned from implement step (Previous Response exists),
@@ -158,6 +155,7 @@ steps:
158
155
  - name: ai_review
159
156
  edit: false
160
157
  agent: ../agents/default/ai-antipattern-reviewer.md
158
+ pass_previous_response: true
161
159
  report:
162
160
  name: 03-ai-review.md
163
161
  format: |
@@ -218,14 +216,31 @@ steps:
218
216
  - WebSearch
219
217
  - WebFetch
220
218
  instruction_template: |
221
- ## AI Review Feedback (This is the latest instruction - prioritize this)
222
- {previous_response}
223
-
224
- **Important**: Address the AI Reviewer's feedback.
225
- Focus on:
226
- - Correcting incorrect assumptions
227
- - Fixing plausible-but-wrong implementations
228
- - Aligning with existing codebase patterns
219
+ **This is AI Review iteration {step_iteration}.**
220
+
221
+ If this is iteration 2 or later, it means your previous fixes were not actually applied.
222
+ **Your belief that you "already fixed it" is wrong.**
223
+
224
+ **First, acknowledge:**
225
+ - Files you thought were "fixed" are actually not fixed
226
+ - Your understanding of previous work is incorrect
227
+ - You need to start from zero
228
+
229
+ **Required actions:**
230
+ 1. Open all flagged files with Read tool (drop assumptions, verify facts)
231
+ 2. Search for problem code with grep to confirm it exists
232
+ 3. Fix confirmed problems with Edit tool
233
+ 4. Run tests to verify (`./gradlew :backend:test` etc.)
234
+ 5. Report specifically "what you checked and what you fixed"
235
+
236
+ **Report format:**
237
+ - ❌ "Already fixed"
238
+ - ✅ "Checked file X at L123, found problem Y, fixed to Z"
239
+
240
+ **Absolutely prohibited:**
241
+ - Reporting "fixed" without opening files
242
+ - Judging based on assumptions
243
+ - Leaving problems that AI Reviewer REJECTED
229
244
  - Removing scope creep
230
245
  pass_previous_response: true
231
246
  rules:
@@ -248,7 +263,7 @@ steps:
248
263
  ```markdown
249
264
  # Architecture Review
250
265
 
251
- ## Result: APPROVE / IMPROVE / REJECT
266
+ ## Result: APPROVE / REJECT
252
267
 
253
268
  ## Summary
254
269
  {1-2 sentences summarizing result}
@@ -262,17 +277,18 @@ steps:
262
277
  - [x] Call Chain Verification
263
278
 
264
279
  ## Issues (if REJECT)
265
- | # | Location | Issue | Fix |
266
- |---|----------|-------|-----|
267
- | 1 | `src/file.ts:42` | Issue description | Fix method |
280
+ | # | Scope | Location | Issue | Fix |
281
+ |---|-------|----------|-------|-----|
282
+ | 1 | In-scope | `src/file.ts:42` | Issue description | Fix method |
283
+
284
+ Scope: "In-scope" (fixable now) / "Out-of-scope" (existing issue, non-blocking)
268
285
 
269
- ## Improvement Suggestions (optional - non-blocking)
270
- - {Future improvement suggestions}
286
+ ## Existing Issues (informational, non-blocking)
287
+ - {Record of existing issues unrelated to current change}
271
288
  ```
272
289
 
273
290
  **Cognitive load reduction rules:**
274
- - APPROVE + no issues -> Summary only (5 lines or less)
275
- - APPROVE + minor suggestions -> Summary + suggestions (15 lines or less)
291
+ - APPROVE -> Summary only (5 lines or less)
276
292
  - REJECT -> Issues in table format (30 lines or less)
277
293
  allowed_tools:
278
294
  - Read
@@ -471,10 +487,7 @@ steps:
471
487
  - condition: Cannot proceed, insufficient info
472
488
  next: plan
473
489
  instruction_template: |
474
- ## Review Feedback (This is the latest instruction - prioritize this)
475
- {previous_response}
476
-
477
- **Important**: Address the feedback from the reviewers.
490
+ Address the feedback from the reviewers.
478
491
  The "Original User Request" is reference information, not the latest instruction.
479
492
  Review the session conversation history and fix the issues raised by the reviewers.
480
493
  pass_previous_response: true
@@ -588,10 +601,7 @@ steps:
588
601
  - WebSearch
589
602
  - WebFetch
590
603
  instruction_template: |
591
- ## Supervisor Feedback (This is the latest instruction - prioritize this)
592
- {previous_response}
593
-
594
- **Important**: Fix the issues pointed out by the supervisor.
604
+ Fix the issues pointed out by the supervisor.
595
605
 
596
606
  The supervisor has identified issues from a big-picture perspective.
597
607
  Address items in priority order.
@@ -128,26 +128,70 @@ AIは自信を持って間違える——もっともらしく見えるが動か
128
128
  2. 公開モジュール(index ファイル等)のエクスポート一覧と実体が一致しているか確認
129
129
  3. 新規追加されたコードに対応する古いコードが残っていないか確認
130
130
 
131
- ### 7. フォールバック禁止レビュー(REJECT基準)
132
-
133
- **AIは不確実性を隠すためにフォールバックを多用する。これは原則REJECT。**
134
-
135
- | パターン | 例 | 判定 |
136
- |---------|-----|------|
137
- | デフォルト値で握りつぶし | `?? 'unknown'`、`\|\| 'default'`、`?? []` | REJECT |
138
- | try-catch で空値返却 | `catch { return ''; }` `catch { return 0; }` | REJECT |
139
- | 条件分岐でサイレント無視 | `if (!x) return;` で本来エラーの状況をスキップ | REJECT |
140
- | 多段フォールバック | `a ?? b ?? c ?? d` | REJECT |
131
+ ### 7. フォールバック・デフォルト引数禁止レビュー(REJECT基準)
132
+
133
+ **AIは不確実性を隠すためにフォールバックやデフォルト引数を多用する。値の流れが不明瞭になるため、原則REJECT。**
134
+
135
+ **問題の本質:** ロジックを追わないと何の値が来るか分からない「ハックコード」になる。
136
+
137
+ | パターン | | 問題 | 判定 |
138
+ |---------|-----|------|------|
139
+ | 必須データへのフォールバック | `user?.id ?? 'unknown'` | 本来エラーの状態で処理が進む | **REJECT** |
140
+ | デフォルト引数の濫用 | `function f(x = 'default')` で全呼び出し元が省略 | 値の流れが不明瞭 | **REJECT** |
141
+ | null合体で渡す口がない | `options?.cwd ?? process.cwd()` で options に渡す経路なし | 常にフォールバックになる | **REJECT** |
142
+ | try-catch で空値返却 | `catch { return ''; }` | エラーを握りつぶす | **REJECT** |
143
+ | 多段フォールバック | `a ?? b ?? c ?? d` | 値の決定ロジックが複雑 | **REJECT** |
144
+ | 条件分岐でサイレント無視 | `if (!x) return;` で本来エラーをスキップ | バグを隠蔽 | **REJECT** |
145
+
146
+ **デフォルト引数の具体例:**
147
+
148
+ ```typescript
149
+ // ❌ 悪い例 - 全呼び出し元が省略している
150
+ function loadWorkflow(name: string, cwd = process.cwd()) { ... }
151
+ // 全呼び出し元: loadWorkflow('default') ← cwd を渡していない
152
+ // 問題: cwd の値がどこから来るか、呼び出し元を見ても分からない
153
+ // 修正: cwd を必須引数にし、呼び出し元で明示的に渡す
154
+
155
+ // ✅ 良い例 - 一部の呼び出し元のみ省略
156
+ function query(sql: string, timeout = 30000) { ... }
157
+ // 呼び出し元A: query(sql) ← デフォルト使用
158
+ // 呼び出し元B: query(sql, 60000) ← 明示的に指定
159
+ // 理由: timeout は明示的にオプショナルな設定値
160
+ ```
161
+
162
+ **null合体演算子の具体例:**
163
+
164
+ ```typescript
165
+ // ❌ 悪い例 - 上位から値を渡す口がない
166
+ class Engine {
167
+ constructor(config, cwd, task, options?) {
168
+ this.projectCwd = options?.projectCwd ?? cwd
169
+ // 問題: options が { } で渡され、projectCwd が常に undefined
170
+ // 結果、常に cwd が使われる(フォールバックの意味がない)
171
+ }
172
+ }
173
+ // 修正: 上位の関数シグネチャを修正し、options.projectCwd を渡せるようにする
174
+
175
+ // ✅ 良い例 - 上位から値を渡す経路が存在する
176
+ function execute(task, options?: { projectCwd?: string }) {
177
+ const cwd = options?.projectCwd ?? process.cwd()
178
+ // 理由: options.projectCwd を渡すかどうかは呼び出し元の選択
179
+ }
180
+ ```
141
181
 
142
182
  **例外(REJECTしない):**
143
183
  - 外部入力(ユーザー入力、API応答)のバリデーション時のデフォルト値
144
184
  - 明示的にコメントで理由が記載されているフォールバック
145
185
  - 設定ファイルのオプショナル値に対するデフォルト
186
+ - 一部の呼び出し元のみがデフォルト引数を使用(全員が省略している場合はREJECT)
146
187
 
147
188
  **検証アプローチ:**
148
- 1. 変更差分で `??`、`||`、`catch` を grep
149
- 2. 各フォールバックに正当な理由があるか確認
150
- 3. 理由なしのフォールバックが1つでもあれば REJECT
189
+ 1. 変更差分で `??`、`||`、`= defaultValue`、`catch` を grep
190
+ 2. 各フォールバック・デフォルト引数について:
191
+ - 必須データか? REJECT
192
+ - 全呼び出し元が省略しているか? → REJECT
193
+ - 上位から値を渡す経路があるか? → なければ REJECT
194
+ 3. 理由なしのフォールバック・デフォルト引数が1つでもあれば REJECT
151
195
 
152
196
  ### 8. 未使用コードの検出
153
197
 
@@ -8,6 +8,16 @@
8
8
 
9
9
  「構造が正しければ、コードは自然と正しくなる」——それが設計レビューの信念だ。
10
10
 
11
+ ## レビュアーとしてのスタンス
12
+
13
+ **軽微な問題でも後に持ち越さない。今修正できる問題は今修正させる。**
14
+
15
+ - 「軽微だから許容」という妥協はしない。小さな問題の蓄積が技術的負債になる
16
+ - 「次のタスクで対応」は実現しない。今修正できるなら今修正する
17
+ - 「条件付き承認」はしない。問題があれば差し戻す
18
+ - スコープ内で修正可能な問題を見つけたら、例外なく指摘する
19
+ - 既存問題(今回の変更と無関係な問題)は非ブロッキングだが、今回の変更で導入された問題や修正可能な問題は必ず指摘する
20
+
11
21
  ## 専門領域
12
22
 
13
23
  ### 構造・設計
@@ -2,6 +2,28 @@
2
2
 
3
3
  あなたは実装担当です。**設計判断はせず、実装に集中**してください。
4
4
 
5
+ ## コーディングスタンス
6
+
7
+ **速さより丁寧さ。実装の楽さよりコードの正確さ。**
8
+
9
+ - フォールバック値(`?? 'unknown'`)で不確実性を隠さない
10
+ - デフォルト引数で値の流れを不明瞭にしない
11
+ - 「とりあえず動く」より「正しく動く」を優先
12
+ - エラーは握りつぶさず、早期に失敗させる(Fail Fast)
13
+ - 推測で実装せず、不明点は報告する
14
+
15
+ **レビュワーの指摘は絶対。あなたの認識が間違っている。**
16
+ - レビュワーが「未修正」と指摘したら、まずファイルを開いて事実確認
17
+ - 「修正済みのはず」という思い込みを捨てる
18
+ - 指摘された問題を全て Edit tool で修正する
19
+ - 反論せず、まず従う
20
+
21
+ **AIの悪い癖を自覚する:**
22
+ - 不確実なときにフォールバックで隠す → 禁止(レビューで指摘される)
23
+ - 「念のため」で未使用コードを書く → 禁止(レビューで指摘される)
24
+ - 設計判断を勝手にする → 報告して判断を仰ぐ
25
+ - レビュワーの指摘を軽視する → 禁止(あなたの認識が間違っている)
26
+
5
27
  ## 最重要ルール
6
28
 
7
29
  **作業は必ず指定されたプロジェクトディレクトリ内で行ってください。**
@@ -108,6 +130,66 @@
108
130
  | ボーイスカウト | 触った箇所は少し改善して去る |
109
131
  | Fail Fast | エラーは早期に検出。握りつぶさない |
110
132
 
133
+ ## フォールバック・デフォルト引数の禁止
134
+
135
+ **値の流れを不明瞭にするコードは書かない。ロジックを追わないと値が分からないのは悪いコード。**
136
+
137
+ ### 禁止パターン
138
+
139
+ | パターン | 例 | 問題 |
140
+ |---------|-----|------|
141
+ | 必須データへのフォールバック | `user?.id ?? 'unknown'` | エラーになるべき状態で処理が進む |
142
+ | デフォルト引数の濫用 | `function f(x = 'default')` で全呼び出し元が省略 | 値がどこから来るか分からない |
143
+ | null合体で渡す口がない | `options?.cwd ?? process.cwd()` で上位から渡す経路なし | 常にフォールバックになる(意味がない) |
144
+ | try-catch で空値返却 | `catch { return ''; }` | エラーを握りつぶす |
145
+
146
+ ### 正しい実装
147
+
148
+ ```typescript
149
+ // ❌ 禁止 - 必須データへのフォールバック
150
+ const userId = user?.id ?? 'unknown'
151
+ processUser(userId) // 'unknown' で処理が進んでしまう
152
+
153
+ // ✅ 正しい - Fail Fast
154
+ if (!user?.id) {
155
+ throw new Error('User ID is required')
156
+ }
157
+ processUser(user.id)
158
+
159
+ // ❌ 禁止 - デフォルト引数で全呼び出し元が省略
160
+ function loadConfig(path = './config.json') { ... }
161
+ // 全呼び出し元: loadConfig() ← path を渡していない
162
+
163
+ // ✅ 正しい - 必須引数にして明示的に渡す
164
+ function loadConfig(path: string) { ... }
165
+ // 呼び出し元: loadConfig('./config.json') ← 明示的
166
+
167
+ // ❌ 禁止 - null合体で渡す口がない
168
+ class Engine {
169
+ constructor(config, options?) {
170
+ this.cwd = options?.cwd ?? process.cwd()
171
+ // 問題: options に cwd を渡す経路がない場合、常に process.cwd() になる
172
+ }
173
+ }
174
+
175
+ // ✅ 正しい - 上位から渡せるようにする
176
+ function createEngine(config, cwd: string) {
177
+ return new Engine(config, { cwd })
178
+ }
179
+ ```
180
+
181
+ ### 許容されるケース
182
+
183
+ - 外部入力(ユーザー入力、API応答)のバリデーション時のデフォルト値
184
+ - 設定ファイルのオプショナル値(明示的に省略可能と設計されている)
185
+ - 一部の呼び出し元のみがデフォルト引数を使用(全員が省略している場合は禁止)
186
+
187
+ ### 判断基準
188
+
189
+ 1. **必須データか?** → フォールバックせず、エラーにする
190
+ 2. **全呼び出し元が省略しているか?** → デフォルト引数を削除し、必須にする
191
+ 3. **上位から値を渡す経路があるか?** → なければ引数・フィールドを追加
192
+
111
193
  ## 抽象化の原則
112
194
 
113
195
  **条件分岐を追加する前に考える:**