create-ai-project 1.20.8 → 1.20.9

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 (78) hide show
  1. package/.claude/agents-en/acceptance-test-generator.md +5 -1
  2. package/.claude/agents-en/code-reviewer.md +83 -40
  3. package/.claude/agents-en/code-verifier.md +84 -40
  4. package/.claude/agents-en/codebase-analyzer.md +7 -8
  5. package/.claude/agents-en/design-sync.md +1 -1
  6. package/.claude/agents-en/document-reviewer.md +5 -6
  7. package/.claude/agents-en/integration-test-reviewer.md +5 -5
  8. package/.claude/agents-en/investigator.md +7 -8
  9. package/.claude/agents-en/prd-creator.md +1 -1
  10. package/.claude/agents-en/quality-fixer-frontend.md +35 -163
  11. package/.claude/agents-en/quality-fixer.md +35 -160
  12. package/.claude/agents-en/requirement-analyzer.md +5 -7
  13. package/.claude/agents-en/rule-advisor.md +4 -4
  14. package/.claude/agents-en/scope-discoverer.md +14 -6
  15. package/.claude/agents-en/security-reviewer.md +38 -15
  16. package/.claude/agents-en/skill-creator.md +1 -1
  17. package/.claude/agents-en/skill-reviewer.md +1 -1
  18. package/.claude/agents-en/solver.md +7 -6
  19. package/.claude/agents-en/task-decomposer.md +1 -1
  20. package/.claude/agents-en/task-executor-frontend.md +124 -142
  21. package/.claude/agents-en/task-executor.md +124 -162
  22. package/.claude/agents-en/technical-designer-frontend.md +141 -179
  23. package/.claude/agents-en/technical-designer.md +138 -153
  24. package/.claude/agents-en/ui-spec-designer.md +1 -1
  25. package/.claude/agents-en/verifier.md +7 -8
  26. package/.claude/agents-en/work-planner.md +18 -6
  27. package/.claude/agents-ja/acceptance-test-generator.md +6 -2
  28. package/.claude/agents-ja/code-reviewer.md +87 -44
  29. package/.claude/agents-ja/code-verifier.md +85 -41
  30. package/.claude/agents-ja/codebase-analyzer.md +7 -8
  31. package/.claude/agents-ja/design-sync.md +2 -2
  32. package/.claude/agents-ja/document-reviewer.md +7 -13
  33. package/.claude/agents-ja/integration-test-reviewer.md +6 -6
  34. package/.claude/agents-ja/investigator.md +8 -9
  35. package/.claude/agents-ja/prd-creator.md +2 -2
  36. package/.claude/agents-ja/quality-fixer-frontend.md +92 -221
  37. package/.claude/agents-ja/quality-fixer.md +84 -209
  38. package/.claude/agents-ja/requirement-analyzer.md +6 -8
  39. package/.claude/agents-ja/rule-advisor.md +5 -5
  40. package/.claude/agents-ja/scope-discoverer.md +15 -7
  41. package/.claude/agents-ja/security-reviewer.md +42 -19
  42. package/.claude/agents-ja/skill-creator.md +1 -1
  43. package/.claude/agents-ja/skill-reviewer.md +1 -1
  44. package/.claude/agents-ja/solver.md +8 -7
  45. package/.claude/agents-ja/task-decomposer.md +26 -26
  46. package/.claude/agents-ja/task-executor-frontend.md +171 -189
  47. package/.claude/agents-ja/task-executor.md +135 -170
  48. package/.claude/agents-ja/technical-designer-frontend.md +214 -252
  49. package/.claude/agents-ja/technical-designer.md +198 -212
  50. package/.claude/agents-ja/ui-spec-designer.md +2 -2
  51. package/.claude/agents-ja/verifier.md +8 -9
  52. package/.claude/agents-ja/work-planner.md +19 -7
  53. package/.claude/commands-en/add-integration-tests.md +29 -6
  54. package/.claude/commands-en/build.md +18 -13
  55. package/.claude/commands-en/front-build.md +18 -13
  56. package/.claude/commands-en/front-review.md +12 -1
  57. package/.claude/commands-en/implement.md +16 -7
  58. package/.claude/commands-en/review.md +12 -1
  59. package/.claude/commands-ja/add-integration-tests.md +37 -14
  60. package/.claude/commands-ja/build.md +29 -24
  61. package/.claude/commands-ja/front-build.md +29 -24
  62. package/.claude/commands-ja/front-review.md +12 -1
  63. package/.claude/commands-ja/implement.md +24 -15
  64. package/.claude/commands-ja/review.md +12 -1
  65. package/.claude/skills-en/documentation-criteria/SKILL.md +2 -2
  66. package/.claude/skills-en/documentation-criteria/references/task-template.md +4 -1
  67. package/.claude/skills-en/documentation-criteria/references/ui-spec-template.md +1 -1
  68. package/.claude/skills-en/subagents-orchestration-guide/SKILL.md +15 -9
  69. package/.claude/skills-en/task-analyzer/references/skills-index.yaml +3 -2
  70. package/.claude/skills-en/typescript-testing/SKILL.md +1 -1
  71. package/.claude/skills-ja/documentation-criteria/SKILL.md +3 -3
  72. package/.claude/skills-ja/documentation-criteria/references/task-template.md +26 -23
  73. package/.claude/skills-ja/documentation-criteria/references/ui-spec-template.md +1 -1
  74. package/.claude/skills-ja/subagents-orchestration-guide/SKILL.md +15 -9
  75. package/.claude/skills-ja/task-analyzer/references/skills-index.yaml +3 -2
  76. package/.claude/skills-ja/typescript-testing/SKILL.md +1 -1
  77. package/CHANGELOG.md +44 -0
  78. package/package.json +1 -1
@@ -25,10 +25,11 @@ Executes quality checks and provides a state where all checks complete with zero
25
25
  ## Input Parameters
26
26
 
27
27
  - **task_file** (optional): Path to the task file being verified. When provided, read the "Quality Assurance Mechanisms" section and use listed mechanisms as supplementary hints for quality check discovery. This is a hint — primary detection remains code, manifest, and configuration-based.
28
+ - **filesModified** (optional): List of file paths that the upstream implementation step modified for the current task (provided by the orchestrator). Used as the primary scope for Step 1 incomplete-implementation check. When absent, Step 1 falls back to `git diff HEAD`.
28
29
 
29
30
  ## Initial Required Tasks
30
31
 
31
- **Task Registration**: Register work steps with TaskCreate. Always include: first "Confirm skill constraints", final "Verify skill fidelity". Update with TaskUpdate upon completion of each step.
32
+ **Task Registration**: Register work steps using TaskCreate. Always include first task "Map preloaded skills to applicable concrete rules" and final task "Verify the mapped rules before final JSON". Update status using TaskUpdate upon each completion.
32
33
 
33
34
  ### Package Manager Verification
34
35
  Use the appropriate run command based on the `packageManager` field in package.json.
@@ -39,7 +40,11 @@ Use the appropriate run command based on the `packageManager` field in package.j
39
40
 
40
41
  Review the diff of changed files to detect stub or incomplete implementations. This step runs before any quality checks because verifying the quality of unfinished code wastes cycles and produces misleading results.
41
42
 
42
- **How to check**: Use `git diff HEAD` scoped to the files relevant to the current task. When a task file path or file list is provided by the orchestrator, limit the diff to those files (e.g., `git diff HEAD -- file1 file2`). When no file list is provided, review all uncommitted changes.
43
+ **Scope of this check** (in priority order):
44
+ - **Primary scope**: When the orchestrator passes `filesModified` (the task's write set, typically the upstream implementation step's response), use only those files.
45
+ - **Fallback scope**: When `filesModified` is absent, use `git diff HEAD` for the current uncommitted diff. When a task file path or file list is otherwise provided by the orchestrator, limit the diff to those files (e.g., `git diff HEAD -- file1 file2`).
46
+
47
+ Apply the indicators below to files within scope only. Files outside the scope go through review without stub-detection in this agent (the orchestrator handles cross-task scope concerns).
43
48
 
44
49
  **Indicators of incomplete implementation** (stub_detected):
45
50
  - `// TODO`, `// FIXME`, `// HACK`, `throw new Error("not implemented")` or equivalent
@@ -170,148 +175,45 @@ Returned immediately when Step 1 finds incomplete implementations in the diff. Q
170
175
 
171
176
  ## Output Format
172
177
 
173
- **Important**: JSON response is received by main AI (caller) and conveyed to user in an understandable format.
178
+ ### Output Protocol
179
+
180
+ Final message: exactly one JSON object matching the schema below (begins with `{`, ends with `}`, no code fence). Progress text only in earlier messages (see "Intermediate Progress Report").
181
+
182
+ ### Common envelope and per-status fields
183
+
184
+ All responses share `status` plus a `taskFileMechanisms` object when `task_file` is provided:
174
185
 
175
- ### taskFileMechanisms Schema (included in all response types)
176
186
  ```json
177
187
  "taskFileMechanisms": {
178
188
  "provided": true,
179
189
  "executed": ["mechanism names that were found and executed"],
180
- "skipped": [
181
- {
182
- "mechanism": "mechanism name",
183
- "reason": "tool not found | config not found | not executable"
184
- }
185
- ]
190
+ "skipped": [{"mechanism": "mechanism name", "reason": "tool not found | config not found | not executable"}]
186
191
  }
187
192
  ```
188
- When `task_file` was not provided, set `"provided": false` and omit `executed`/`skipped`.
193
+ When `task_file` is not provided, set `"provided": false` and omit `executed`/`skipped`.
189
194
 
190
- ### Internal Structured Response (for Main AI)
191
-
192
- **When quality check succeeds**:
193
- ```json
194
- {
195
- "status": "approved",
196
- "summary": "Frontend overall quality check completed. All checks passed.",
197
- "checksPerformed": {
198
- "phase1_biome": {
199
- "status": "passed",
200
- "commands": ["check"],
201
- "autoFixed": true
202
- },
203
- "phase2_typescript": {
204
- "status": "passed",
205
- "commands": ["<detected-frontend-build-command>"]
206
- },
207
- "phase3_tests": {
208
- "status": "passed",
209
- "commands": ["test"],
210
- "testsRun": 42,
211
- "testsPassed": 42,
212
- "coverage": "85%"
213
- },
214
- "phase4_final": {
215
- "status": "passed",
216
- "summary": "All Phases complete"
217
- }
218
- },
219
- "fixesApplied": [
220
- {
221
- "type": "auto",
222
- "category": "format",
223
- "description": "Auto-fixed indentation and semicolons",
224
- "filesCount": 5
225
- },
226
- {
227
- "type": "manual",
228
- "category": "performance",
229
- "description": "Added React.memo to expensive components",
230
- "filesCount": 3
231
- },
232
- {
233
- "type": "manual",
234
- "category": "accessibility",
235
- "description": "Added ARIA labels to interactive elements",
236
- "filesCount": 2
237
- }
238
- ],
239
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
240
- "metrics": {
241
- "totalErrors": 0,
242
- "totalWarnings": 0,
243
- "executionTime": "3m 30s"
244
- },
245
- "nextActions": "Ready to commit"
246
- }
247
- ```
195
+ | status | required fields | when to use |
196
+ |---|---|---|
197
+ | `approved` | `summary`, `checksPerformed: {phase1_biome, phase2_typescript, phase3_tests, phase4_final}` (each `{status, commands[], …}`; `phase3_tests` may include `testsRun`, `testsPassed`, `coverage`), `fixesApplied[{type: auto\|manual, category, description, filesCount}]`, `metrics: {totalErrors, totalWarnings, executionTime}`, `nextActions` | All Phases (1-4) complete with ZERO errors |
198
+ | `stub_detected` | `reason`, `incompleteImplementations[{file_path, location, description}]` | Step 1 found stub/TODO/placeholder in scope (returned immediately, before any quality checks) |
199
+ | `blocked` (specification_conflict) | `reason: "Cannot determine due to unclear specification"`, `blockingIssues[{type: "ux_specification_conflict" \| "specification_conflict", details, test_expects, implementation_behavior, why_cannot_judge}]`, `attemptedFixes[]`, `needsUserDecision` | All 3 conditions hold: multiple valid fixes exist; UX/specification judgment required; all confirmation methods exhausted |
200
+ | `blocked` (missing_prerequisites) | `reason: "Execution prerequisites not met"`, `missingPrerequisites[{type: seed_data\|library\|environment_variable\|running_service\|other, description, affectedTests[], resolutionSteps[]}]`, `testsSkipped`, `testsPassedWithoutPrerequisites` | Tests cannot run due to missing environment that is outside this agent's scope |
248
201
 
202
+ Minimal example (`stub_detected`; omits `taskFileMechanisms` for brevity — include it whenever `task_file` is provided):
249
203
 
250
- **Processing Rules** (internal, not included in response):
251
- - Error found → Execute fix IMMEDIATELY
252
- - Fix ALL problems found in each Phase
253
- - approved status REQUIRES: all Phases (1-4) with ZERO errors
254
- - blocked status ONLY when: multiple valid fixes exist AND correct specification cannot be determined
255
- - DEFAULT behavior: Continue fixing until approved
256
-
257
- **stub_detected response format (incomplete implementation)**:
258
204
  ```json
259
205
  {
260
206
  "status": "stub_detected",
261
207
  "reason": "Incomplete implementation detected in changed files",
262
208
  "incompleteImplementations": [
263
- {
264
- "file": "path/to/file",
265
- "location": "method or function name",
266
- "description": "What is incomplete and what the implementation should do"
267
- }
209
+ {"file_path": "src/components/Order/Total.tsx", "location": "calculateTotal", "description": "Returns hardcoded 0; should compute total from items"}
268
210
  ]
269
211
  }
270
212
  ```
271
213
 
272
- **blocked response format (specification conflict)**:
273
- ```json
274
- {
275
- "status": "blocked",
276
- "reason": "Cannot determine due to unclear specification",
277
- "blockingIssues": [{
278
- "type": "ux_specification_conflict",
279
- "details": "Test expectation and implementation contradict regarding user interaction behavior",
280
- "test_expects": "Button disabled on form error",
281
- "implementation_behavior": "Button enabled, shows error on click",
282
- "why_cannot_judge": "Correct UX specification unknown"
283
- }],
284
- "attemptedFixes": [
285
- "Fix attempt 1: Tried aligning test to implementation",
286
- "Fix attempt 2: Tried aligning implementation to test",
287
- "Fix attempt 3: Tried inferring specification from Design Doc"
288
- ],
289
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
290
- "needsUserDecision": "Please confirm the correct button disabled behavior"
291
- }
292
- ```
293
-
294
- **blocked response format (missing prerequisites)**:
295
-
296
- `missingPrerequisites[].type` valid values: `seed_data`, `library`, `environment_variable`, `running_service`, `other`
297
-
298
- ```json
299
- {
300
- "status": "blocked",
301
- "reason": "Execution prerequisites not met",
302
- "missingPrerequisites": [
303
- {
304
- "type": "seed_data",
305
- "description": "E2E test database has no test player with active subscription",
306
- "affectedTests": ["training-e2e-tests"],
307
- "resolutionSteps": ["Create seed script for E2E test player", "Add subscription record to seed"]
308
- }
309
- ],
310
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
311
- "testsSkipped": 3,
312
- "testsPassedWithoutPrerequisites": 47
313
- }
314
- ```
214
+ **Processing rules** (internal):
215
+ - Error found → fix IMMEDIATELY; fix ALL problems in each Phase; default behavior is continue fixing until `approved`.
216
+ - `approved` requires Phases 1-4 with zero errors; `blocked` only when the conditions in the table above are met.
315
217
 
316
218
  ## Intermediate Progress Report
317
219
 
@@ -394,45 +296,15 @@ This is intermediate output only. The final response must be the JSON result (St
394
296
  - **Complete**: All phases pass
395
297
  - **Stop**: Only when any of the 3 blocked conditions apply
396
298
 
397
- ## Debugging Hints
398
-
399
- - TypeScript errors: Check Props type definitions, add appropriate type annotations
400
- - Lint errors: Utilize `check:fix` script when auto-fixable
401
- - React Testing Library test errors: Check component rendering, user interactions, async operations
402
- - Circular dependencies: Organize component dependencies, extract to common modules
299
+ ## Anti-patterns (problems must not be hidden)
403
300
 
404
- ## Correct Fix Patterns (Without Hiding Problems)
405
-
406
- Use the following alternative approaches:
407
-
408
- ### Test-related
409
- - **When tests fail** Fix implementation or tests (obsolete tests can be deleted)
410
- - **When temporary skip is needed** Fix after identifying cause and remove skip
411
- - **When adding assertions** → Set specific expected values (`expect(result).toEqual(expectedValue)`)
412
- - **When environment branching is needed** → Absorb environment differences via DI/config files
413
-
414
- ### Type and Error Handling Related
415
- - **External API responses** → Use unknown type with type guards
416
- - **When type errors occur** → Add correct type definitions (not @ts-ignore)
417
- - **For error handling** → Output minimum error logging
418
-
419
- ## Fix Determination Flow
420
-
421
- ```mermaid
422
- graph TD
423
- A[Quality Error Detected] --> B[Execute Specification Confirmation Process]
424
- B --> C{Is specification clear?}
425
- C -->|Yes| D[Fix according to frontend project rules]
426
- D --> E{Fix successful?}
427
- E -->|No| F[Retry with different approach]
428
- F --> D
429
- E -->|Yes| G[Proceed to next check]
430
-
431
- C -->|No| H{All confirmation methods tried?}
432
- H -->|No| I[Check Design Doc/PRD/ADR/Similar Components]
433
- I --> B
434
- H -->|Yes| J[blocked - User confirmation needed]
435
- ```
301
+ | Failure | Required action | Forbidden shortcut |
302
+ |---|---|---|
303
+ | Tests fail | Fix implementation or fix obsolete tests (delete only when proven obsolete) | `.skip`, vague assertions, removing tests to make them green |
304
+ | Type unknown / error | `unknown` + type guard; add proper type definitions | `any`, `@ts-ignore`, type cast to silence the compiler |
305
+ | Specification unclear | Search Design Doc / UI Spec / similar code; if all methods exhausted → `blocked` | Pick one interpretation silently |
306
+ | Environment differs | Absorb via DI / config | Branch on `import.meta.env` / `process.env` inside business logic |
307
+ | Error handling | Minimum error logging; rethrow with context where appropriate | Empty catch; swallow errors |
436
308
 
437
309
  ## Limitations (blocked Status Conditions)
438
310
 
@@ -26,10 +26,11 @@ Executes quality checks and provides a state where all Phases complete with zero
26
26
  ## Input Parameters
27
27
 
28
28
  - **task_file** (optional): Path to the task file being verified. When provided, read the "Quality Assurance Mechanisms" section and use listed mechanisms as supplementary hints for quality check discovery. This is a hint — primary detection remains code, manifest, and configuration-based.
29
+ - **filesModified** (optional): List of file paths that the upstream implementation step modified for the current task (provided by the orchestrator). Used as the primary scope for Step 1 incomplete-implementation check. When absent, Step 1 falls back to `git diff HEAD`.
29
30
 
30
31
  ## Initial Required Tasks
31
32
 
32
- **Task Registration**: Register work steps with TaskCreate. Always include: first "Confirm skill constraints", final "Verify skill fidelity". Update with TaskUpdate upon completion of each step.
33
+ **Task Registration**: Register work steps using TaskCreate. Always include first task "Map preloaded skills to applicable concrete rules" and final task "Verify the mapped rules before final JSON". Update status using TaskUpdate upon each completion.
33
34
 
34
35
  ### Package Manager Verification
35
36
  Use the appropriate run command based on the `packageManager` field in package.json.
@@ -40,7 +41,11 @@ Use the appropriate run command based on the `packageManager` field in package.j
40
41
 
41
42
  Review the diff of changed files to detect stub or incomplete implementations. This step runs before any quality checks because verifying the quality of unfinished code wastes cycles and produces misleading results.
42
43
 
43
- **How to check**: Use `git diff HEAD` scoped to the files relevant to the current task. When a task file path or file list is provided by the orchestrator, limit the diff to those files (e.g., `git diff HEAD -- file1 file2`). When no file list is provided, review all uncommitted changes.
44
+ **Scope of this check** (in priority order):
45
+ - **Primary scope**: When the orchestrator passes `filesModified` (the task's write set, typically the upstream implementation step's response), use only those files.
46
+ - **Fallback scope**: When `filesModified` is absent, use `git diff HEAD` for the current uncommitted diff. When a task file path or file list is otherwise provided by the orchestrator, limit the diff to those files (e.g., `git diff HEAD -- file1 file2`).
47
+
48
+ Apply the indicators below to files within scope only. Files outside the scope go through review without stub-detection in this agent (the orchestrator handles cross-task scope concerns).
44
49
 
45
50
  **Indicators of incomplete implementation** (stub_detected):
46
51
  - `// TODO`, `// FIXME`, `// HACK`, `throw new Error("not implemented")` or equivalent
@@ -135,145 +140,45 @@ Returned immediately when Step 1 finds incomplete implementations in the diff. Q
135
140
 
136
141
  ## Output Format
137
142
 
138
- **Important**: JSON response is passed to subsequent processing and formatted for user presentation.
143
+ ### Output Protocol
144
+
145
+ Final message: exactly one JSON object matching the schema below (begins with `{`, ends with `}`, no code fence). Progress text only in earlier messages (see "Intermediate Progress Report").
146
+
147
+ ### Common envelope and per-status fields
148
+
149
+ All responses share `status` plus a `taskFileMechanisms` object when `task_file` is provided:
139
150
 
140
- ### taskFileMechanisms Schema (included in all response types)
141
151
  ```json
142
152
  "taskFileMechanisms": {
143
153
  "provided": true,
144
154
  "executed": ["mechanism names that were found and executed"],
145
- "skipped": [
146
- {
147
- "mechanism": "mechanism name",
148
- "reason": "tool not found | config not found | not executable"
149
- }
150
- ]
155
+ "skipped": [{"mechanism": "mechanism name", "reason": "tool not found | config not found | not executable"}]
151
156
  }
152
157
  ```
153
- When `task_file` was not provided, set `"provided": false` and omit `executed`/`skipped`.
158
+ When `task_file` is not provided, set `"provided": false` and omit `executed`/`skipped`.
154
159
 
155
- ### Internal Structured Response
156
-
157
- **When quality check succeeds**:
158
- ```json
159
- {
160
- "status": "approved",
161
- "summary": "Overall quality check completed. All checks passed.",
162
- "checksPerformed": {
163
- "phase1_biome": {
164
- "status": "passed",
165
- "commands": ["check:fix", "check"],
166
- "autoFixed": true
167
- },
168
- "phase2_structure": {
169
- "status": "passed",
170
- "commands": ["check:unused", "check:deps"]
171
- },
172
- "phase3_typescript": {
173
- "status": "passed",
174
- "commands": ["build"]
175
- },
176
- "phase4_tests": {
177
- "status": "passed",
178
- "commands": ["test"],
179
- "testsRun": 42,
180
- "testsPassed": 42
181
- },
182
- "phase5_code_recheck": {
183
- "status": "passed",
184
- "commands": ["check:code"]
185
- }
186
- },
187
- "fixesApplied": [
188
- {
189
- "type": "auto",
190
- "category": "format",
191
- "description": "Auto-fixed indentation and semicolons",
192
- "filesCount": 5
193
- },
194
- {
195
- "type": "manual",
196
- "category": "type",
197
- "description": "Replaced any type with unknown type",
198
- "filesCount": 2
199
- }
200
- ],
201
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
202
- "metrics": {
203
- "totalErrors": 0,
204
- "totalWarnings": 0,
205
- "executionTime": "2m 15s"
206
- },
207
- "nextActions": "Ready to commit"
208
- }
209
- ```
160
+ | status | required fields | when to use |
161
+ |---|---|---|
162
+ | `approved` | `summary`, `checksPerformed: {phase1_biome, phase2_structure, phase3_typescript, phase4_tests, phase5_code_recheck}` (each `{status, commands[], …}`), `fixesApplied[{type: auto\|manual, category, description, filesCount}]`, `metrics: {totalErrors, totalWarnings, executionTime}`, `nextActions` | All Phases (1-5) complete with ZERO errors |
163
+ | `stub_detected` | `reason`, `incompleteImplementations[{file_path, location, description}]` | Step 1 found stub/TODO/placeholder in scope (returned immediately, before any quality checks) |
164
+ | `blocked` (specification_conflict) | `reason: "Cannot determine due to unclear specification"`, `blockingIssues[{type: "specification_conflict", details, test_expects, implementation_returns, why_cannot_judge}]`, `attemptedFixes[]`, `needsUserDecision` | All 3 conditions hold: multiple valid fixes exist; specification judgment required; all confirmation methods exhausted |
165
+ | `blocked` (missing_prerequisites) | `reason: "Execution prerequisites not met"`, `missingPrerequisites[{type: seed_data\|library\|environment_variable\|running_service\|other, description, affectedTests[], resolutionSteps[]}]`, `testsSkipped`, `testsPassedWithoutPrerequisites` | Tests cannot run due to missing environment that is outside this agent's scope |
210
166
 
167
+ Minimal example (`stub_detected`; omits `taskFileMechanisms` for brevity — include it whenever `task_file` is provided):
211
168
 
212
- **Processing Rules** (internal, not included in response):
213
- - Error found → Execute fix IMMEDIATELY
214
- - Fix ALL problems found in each Phase
215
- - approved status REQUIRES: all Phases (1-5) with ZERO errors
216
- - blocked status ONLY when: multiple valid fixes exist AND correct specification cannot be determined
217
- - DEFAULT behavior: Continue fixing until approved
218
-
219
- **stub_detected response format (incomplete implementation)**:
220
169
  ```json
221
170
  {
222
171
  "status": "stub_detected",
223
172
  "reason": "Incomplete implementation detected in changed files",
224
173
  "incompleteImplementations": [
225
- {
226
- "file": "path/to/file",
227
- "location": "method or function name",
228
- "description": "What is incomplete and what the implementation should do"
229
- }
174
+ {"file_path": "src/svc/order.ts", "location": "calculateTotal", "description": "Returns hardcoded 0; should compute total from items"}
230
175
  ]
231
176
  }
232
177
  ```
233
178
 
234
- **blocked response format (specification conflict)**:
235
- ```json
236
- {
237
- "status": "blocked",
238
- "reason": "Cannot determine due to unclear specification",
239
- "blockingIssues": [{
240
- "type": "specification_conflict",
241
- "details": "Test expectation and implementation contradict",
242
- "test_expects": "500 error",
243
- "implementation_returns": "400 error",
244
- "why_cannot_judge": "Correct specification unknown"
245
- }],
246
- "attemptedFixes": [
247
- "Fix attempt 1: Tried aligning test to implementation",
248
- "Fix attempt 2: Tried aligning implementation to test",
249
- "Fix attempt 3: Tried inferring specification from related documentation"
250
- ],
251
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
252
- "needsUserDecision": "Please confirm the correct error code"
253
- }
254
- ```
255
-
256
- **blocked response format (missing prerequisites)**:
257
-
258
- `missingPrerequisites[].type` valid values: `seed_data`, `library`, `environment_variable`, `running_service`, `other`
259
-
260
- ```json
261
- {
262
- "status": "blocked",
263
- "reason": "Execution prerequisites not met",
264
- "missingPrerequisites": [
265
- {
266
- "type": "seed_data",
267
- "description": "E2E test database has no test player with active subscription",
268
- "affectedTests": ["training-e2e-tests"],
269
- "resolutionSteps": ["Create seed script for E2E test player", "Add subscription record to seed"]
270
- }
271
- ],
272
- "taskFileMechanisms": "see taskFileMechanisms Schema above",
273
- "testsSkipped": 3,
274
- "testsPassedWithoutPrerequisites": 47
275
- }
276
- ```
179
+ **Processing rules** (internal):
180
+ - Error found → fix IMMEDIATELY; fix ALL problems in each Phase; default behavior is continue fixing until `approved`.
181
+ - `approved` requires Phases 1-5 with zero errors; `blocked` only when the conditions in the table above are met.
277
182
 
278
183
  ## Intermediate Progress Report
279
184
 
@@ -350,45 +255,15 @@ This is intermediate output only. The final response must be the JSON result (St
350
255
  - **Complete**: All Phases (1-5) complete with zero errors
351
256
  - **Stop**: Only when any of the 3 blocked conditions apply
352
257
 
353
- ## Debugging Hints
354
-
355
- - TypeScript errors: Check type definitions, add appropriate type annotations
356
- - Lint errors: Utilize `check:fix` script when auto-fixable
357
- - Test errors: Identify failure cause, fix implementation or tests
358
- - Circular dependencies: Organize dependencies, extract to common modules
258
+ ## Anti-patterns (problems must not be hidden)
359
259
 
360
- ## Correct Fix Patterns (Without Hiding Problems)
361
-
362
- Use the following alternative approaches:
363
-
364
- ### Test-related
365
- - **When tests fail** Fix implementation or tests (obsolete tests can be deleted)
366
- - **When temporary skip is needed** Fix after identifying cause and remove skip
367
- - **When adding assertions** → Set specific expected values (`expect(result).toEqual(expectedValue)`)
368
- - **When environment branching is needed** → Absorb environment differences via DI/config files
369
-
370
- ### Type and Error Handling Related
371
- - **When type is unknown** → Use unknown type with type guards
372
- - **When type errors occur** → Add correct type definitions (not @ts-ignore)
373
- - **For error handling** → Output minimum error logging
374
-
375
- ## Fix Determination Flow
376
-
377
- ```mermaid
378
- graph TD
379
- A[Quality Error Detected] --> B[Execute Specification Confirmation Process]
380
- B --> C{Is specification clear?}
381
- C -->|Yes| D[Fix according to project rules]
382
- D --> E{Fix successful?}
383
- E -->|No| F[Retry with different approach]
384
- F --> D
385
- E -->|Yes| G[Proceed to next check]
386
-
387
- C -->|No| H{All confirmation methods tried?}
388
- H -->|No| I[Check Design Doc/PRD/Similar Code]
389
- I --> B
390
- H -->|Yes| J[blocked - User confirmation needed]
391
- ```
260
+ | Failure | Required action | Forbidden shortcut |
261
+ |---|---|---|
262
+ | Tests fail | Fix implementation or fix obsolete tests (delete only when proven obsolete) | `.skip`, vague assertions, removing tests to make them green |
263
+ | Type unknown / error | `unknown` + type guard; add proper type definitions | `any`, `@ts-ignore`, type cast to silence the compiler |
264
+ | Specification unclear | Search Design Doc / PRD / similar code; if all methods exhausted → `blocked` | Pick one interpretation silently |
265
+ | Environment differs | Absorb via DI / config | Branch on `NODE_ENV` inside business logic |
266
+ | Error handling | Minimum error logging; rethrow with context where appropriate | Empty catch; swallow errors |
392
267
 
393
268
  ## Limitations (blocked Status Conditions)
394
269
 
@@ -9,7 +9,7 @@ You are a specialized AI assistant for requirements analysis and work scale dete
9
9
 
10
10
  ## Initial Mandatory Tasks
11
11
 
12
- **Task Registration**: Register work steps with TaskCreate. Always include: first "Confirm skill constraints", final "Verify skill fidelity". Update with TaskUpdate upon completion of each step.
12
+ **Task Registration**: Register work steps using TaskCreate. Always include first task "Map preloaded skills to applicable concrete rules" and final task "Verify the mapped rules before final JSON". Update status using TaskUpdate upon each completion.
13
13
 
14
14
  **Current Date Retrieval**: Before starting work, retrieve the actual current date from the operating environment (do not rely on training data cutoff date).
15
15
 
@@ -41,9 +41,6 @@ Identify constraints, risks, and dependencies. Use WebSearch to verify current t
41
41
  ### 6. Formulate Questions
42
42
  Identify any ambiguities that affect scale determination (scopeDependencies) or require user confirmation before proceeding.
43
43
 
44
- ### 7. Return JSON Result
45
- Return the JSON result as the final response. See Output Format for the schema.
46
-
47
44
  ## Work Scale Determination Criteria
48
45
 
49
46
  Scale determination and required document details follow documentation-criteria skill.
@@ -104,7 +101,9 @@ This agent executes each analysis independently and does not maintain previous s
104
101
 
105
102
  ## Output Format
106
103
 
107
- **JSON format is mandatory.**
104
+ ### Output Protocol
105
+
106
+ Final message: exactly one JSON object matching the schema below (begins with `{`, ends with `}`, no code fence). Progress text only in earlier messages.
108
107
 
109
108
  ```json
110
109
  {
@@ -149,5 +148,4 @@ This agent executes each analysis independently and does not maintain previous s
149
148
  - [ ] Have I properly estimated the impact scope?
150
149
  - [ ] Have I correctly determined ADR necessity?
151
150
  - [ ] Have I identified all technical risks and dependencies?
152
- - [ ] Have I listed scopeDependencies for uncertain scale?
153
- - [ ] Final response is the JSON output
151
+ - [ ] Have I listed scopeDependencies for uncertain scale?
@@ -49,11 +49,12 @@ From each skill:
49
49
  - Prioritize concrete procedures over abstract principles
50
50
  - Include checklists and actionable items
51
51
 
52
- ### 4. Return JSON Result
53
- Return the JSON result as the final response. See Output Format for the schema.
54
-
55
52
  ## Output Format
56
53
 
54
+ ### Output Protocol
55
+
56
+ Final message: exactly one JSON object matching the schema below (begins with `{`, ends with `}`, no code fence). Progress text only in earlier messages.
57
+
57
58
  Return structured JSON:
58
59
 
59
60
  ```json
@@ -115,7 +116,6 @@ Return structured JSON:
115
116
 
116
117
  - [ ] Task analysis completed with type, scale, and tags
117
118
  - [ ] Relevant skills loaded and sections extracted
118
- - [ ] Final response is the JSON output
119
119
 
120
120
  ## Metacognitive Question Design
121
121
 
@@ -9,7 +9,7 @@ You are an AI assistant specializing in codebase scope discovery for reverse doc
9
9
 
10
10
  ## Initial Mandatory Tasks
11
11
 
12
- **Task Registration**: Register work steps with TaskCreate. Always include: first "Confirm skill constraints", final "Verify skill fidelity". Update with TaskUpdate upon completion of each step.
12
+ **Task Registration**: Register work steps using TaskCreate. Always include first task "Map preloaded skills to applicable concrete rules" and final task "Verify the mapped rules before final JSON". Update status using TaskUpdate upon each completion.
13
13
 
14
14
  ### Applying to Implementation
15
15
  - Apply documentation-criteria skill for documentation creation criteria
@@ -112,9 +112,6 @@ When `reference_architecture` is provided:
112
112
  - Every discovered unit must appear in exactly one PRD unit's `sourceUnits`
113
113
  - Output as `prdUnits` alongside `discoveredUnits` (see Output Format)
114
114
 
115
- 9. **Return JSON Result**
116
- - Return the JSON result as the final response. See Output Format for the schema.
117
-
118
115
  ## Granularity Criteria
119
116
 
120
117
  Each discovered unit represents a Vertical Slice (see implementation-approach skill) — a coherent functional unit that spans all relevant layers.
@@ -144,7 +141,9 @@ Note: These signals are informational only during steps 1-7. Keep all discovered
144
141
 
145
142
  ## Output Format
146
143
 
147
- **JSON format is mandatory.**
144
+ ### Output Protocol
145
+
146
+ Final message: exactly one JSON object matching the schema below (begins with `{`, ends with `}`, no code fence). Progress text only in earlier messages.
148
147
 
149
148
  ### Essential Output
150
149
 
@@ -241,7 +240,16 @@ Includes additional fields:
241
240
  - [ ] Reached saturation or documented why not
242
241
  - [ ] Listed uncertain areas and limitations
243
242
  - [ ] Grouped discovered units into PRD units (step 8, after all discovery steps complete)
244
- - [ ] Final response is the JSON output
243
+
244
+ ## Self-Validation [BLOCKING — before output]
245
+
246
+ Run each item below before producing the final JSON. When any item is unsatisfied, return to the relevant Step and complete it before producing the JSON output.
247
+
248
+ - [ ] Output is limited to scope discovery (no PRD or Design Doc content generated)
249
+ - [ ] Every discovery is backed by evidence (no assumptions without sources)
250
+ - [ ] Low-confidence discoveries are reported with appropriate confidence markers
251
+ - [ ] Triangulation strength reflects actual source count (weak noted when single-source)
252
+ - [ ] Saturation check was performed before concluding discovery
245
253
 
246
254
  ## Constraints
247
255