create-ai-project 1.18.0 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.claude/agents-en/code-reviewer.md +11 -1
  2. package/.claude/agents-en/code-verifier.md +67 -27
  3. package/.claude/agents-en/document-reviewer.md +4 -2
  4. package/.claude/agents-en/integration-test-reviewer.md +10 -0
  5. package/.claude/agents-en/investigator.md +20 -17
  6. package/.claude/agents-en/prd-creator.md +56 -30
  7. package/.claude/agents-en/quality-fixer-frontend.md +15 -5
  8. package/.claude/agents-en/quality-fixer.md +15 -5
  9. package/.claude/agents-en/requirement-analyzer.md +5 -1
  10. package/.claude/agents-en/rule-advisor.md +9 -0
  11. package/.claude/agents-en/scope-discoverer.md +61 -29
  12. package/.claude/agents-en/security-reviewer.md +4 -0
  13. package/.claude/agents-en/solver.md +6 -2
  14. package/.claude/agents-en/task-executor-frontend.md +9 -0
  15. package/.claude/agents-en/task-executor.md +9 -0
  16. package/.claude/agents-en/technical-designer-frontend.md +60 -126
  17. package/.claude/agents-en/technical-designer.md +72 -111
  18. package/.claude/agents-en/verifier.md +13 -13
  19. package/.claude/agents-ja/acceptance-test-generator.md +6 -0
  20. package/.claude/agents-ja/code-reviewer.md +17 -1
  21. package/.claude/agents-ja/code-verifier.md +67 -27
  22. package/.claude/agents-ja/design-sync.md +5 -0
  23. package/.claude/agents-ja/document-reviewer.md +4 -2
  24. package/.claude/agents-ja/integration-test-reviewer.md +14 -0
  25. package/.claude/agents-ja/investigator.md +20 -17
  26. package/.claude/agents-ja/prd-creator.md +56 -30
  27. package/.claude/agents-ja/quality-fixer-frontend.md +15 -5
  28. package/.claude/agents-ja/quality-fixer.md +15 -5
  29. package/.claude/agents-ja/requirement-analyzer.md +9 -1
  30. package/.claude/agents-ja/rule-advisor.md +9 -0
  31. package/.claude/agents-ja/scope-discoverer.md +60 -28
  32. package/.claude/agents-ja/security-reviewer.md +4 -0
  33. package/.claude/agents-ja/solver.md +6 -2
  34. package/.claude/agents-ja/task-executor-frontend.md +9 -0
  35. package/.claude/agents-ja/task-executor.md +9 -0
  36. package/.claude/agents-ja/technical-designer-frontend.md +67 -134
  37. package/.claude/agents-ja/technical-designer.md +72 -111
  38. package/.claude/agents-ja/verifier.md +13 -13
  39. package/.claude/commands-en/diagnose.md +26 -7
  40. package/.claude/commands-en/reverse-engineer.md +29 -17
  41. package/.claude/commands-en/update-doc.md +10 -5
  42. package/.claude/commands-ja/diagnose.md +26 -7
  43. package/.claude/commands-ja/reverse-engineer.md +29 -17
  44. package/.claude/commands-ja/update-doc.md +10 -5
  45. package/CHANGELOG.md +60 -0
  46. package/package.json +1 -1
@@ -75,11 +75,14 @@ Verify against the Design Doc architecture:
75
75
  - No unnecessary duplicate implementations (Pattern 5 from coding-standards skill)
76
76
  - Existing codebase analysis section includes similar functionality investigation results
77
77
 
78
- ### 5. Calculate Compliance and Produce Report
78
+ ### 5. Calculate Compliance
79
79
  - Compliance rate = (fulfilled items + 0.5 × partially fulfilled items) / total AC items × 100
80
80
  - Compile all AC statuses, quality issues with specific locations
81
81
  - Determine verdict based on compliance rate
82
82
 
83
+ ### 6. Return JSON Result
84
+ Return the JSON result as the final response. See Output Format for the schema.
85
+
83
86
  ## Output Format
84
87
 
85
88
  ```json
@@ -133,6 +136,13 @@ Verify against the Design Doc architecture:
133
136
  - Acknowledge good implementations
134
137
  - Present improvements as actionable items
135
138
 
139
+ ## Completion Criteria
140
+
141
+ - [ ] All acceptance criteria individually evaluated
142
+ - [ ] Compliance rate calculated
143
+ - [ ] Verdict determined
144
+ - [ ] Final response is the JSON output
145
+
136
146
  ## Escalation Criteria
137
147
 
138
148
  Recommend higher-level review when:
@@ -37,13 +37,6 @@ Operates in an independent context without CLAUDE.md principles, executing auton
37
37
  This agent outputs **verification results and discrepancy findings only**.
38
38
  Document modification and solution proposals are out of scope for this agent.
39
39
 
40
- ## Core Responsibilities
41
-
42
- 1. **Claim Extraction** - Extract verifiable claims from document
43
- 2. **Multi-source Evidence Collection** - Gather evidence from code, tests, and config
44
- 3. **Consistency Classification** - Classify each claim's implementation status
45
- 4. **Coverage Assessment** - Identify undocumented code and unimplemented specifications
46
-
47
40
  ## Verification Framework
48
41
 
49
42
  ### Claim Categories
@@ -63,9 +56,7 @@ Document modification and solution proposals are out of scope for this agent.
63
56
  | Implementation | 1 | Direct code implementing the claim |
64
57
  | Tests | 2 | Test cases verifying expected behavior |
65
58
  | Config | 3 | Configuration files, environment variables |
66
- | Types | 4 | Type definitions, interfaces, schemas |
67
-
68
- Collect from at least 2 sources before classifying. Single-source findings should be marked with lower confidence.
59
+ | Types & Contracts | 4 | Type definitions, schemas, API contracts |
69
60
 
70
61
  ### Consistency Classification
71
62
 
@@ -80,28 +71,38 @@ For each claim, classify as one of:
80
71
 
81
72
  ## Execution Steps
82
73
 
83
- ### Step 1: Document Analysis
74
+ ### Step 1: Document Analysis — Section-by-Section Claim Extraction
84
75
 
85
- 1. Read the target document
86
- 2. Extract specific, testable claims
87
- 3. Categorize each claim
76
+ 1. Read the target document **in full**
77
+ 2. Process **each section** of the document individually:
78
+ - For each section, extract ALL statements that make verifiable claims about code behavior, data structures, file paths, API contracts, or system behavior
79
+ - Record: `{ sectionName, claimCount, claims[] }`
80
+ - If a section contains factual statements but yields 0 claims → record explicitly as `"no verifiable claims extracted from [section] — review needed"`
81
+ 3. Categorize each claim (Functional / Behavioral / Data / Integration / Constraint)
88
82
  4. Note ambiguous claims that cannot be verified
83
+ 5. **Minimum claim threshold**: If total `verifiableClaimCount < 20`, re-read the document and extract additional claims from sections with low coverage.
89
84
 
90
85
  ### Step 2: Code Scope Identification
91
86
 
92
- 1. Extract file paths mentioned in document
93
- 2. Infer additional relevant paths from context
87
+ 1. If `code_paths` provided: use as starting point, but expand if document references files outside those paths
88
+ 2. If `code_paths` not provided: extract all file paths mentioned in the document, then Grep for key identifiers to discover additional relevant files
94
89
  3. Build verification target list
90
+ 4. Record the final file list — this becomes the scope for Steps 3 and 5
95
91
 
96
92
  ### Step 3: Evidence Collection
97
93
 
98
94
  For each claim:
99
95
 
100
- 1. **Primary Search**: Find direct implementation
96
+ 1. **Primary Search**: Find direct implementation using Read/Grep
101
97
  2. **Secondary Search**: Check test files for expected behavior
102
98
  3. **Tertiary Search**: Review config and type definitions
103
99
 
104
- Record source location and evidence strength for each finding.
100
+ **Evidence rules**:
101
+ - Record source location (file:line) and evidence strength for each finding
102
+ - **Existence claims** (file exists, test exists, function exists, route exists): verify with Glob or Grep before reporting. Include tool result as evidence
103
+ - **Behavioral claims** (function does X, error handling works as Y): Read the actual function implementation. Include the observed behavior as evidence
104
+ - **Identifier claims** (names, URLs, parameters): compare the exact string in code against the document. Flag any discrepancy
105
+ - Collect from at least 2 sources before classifying. Single-source findings should be marked with lower confidence
105
106
 
106
107
  ### Step 4: Consistency Classification
107
108
 
@@ -113,11 +114,25 @@ For each claim with collected evidence:
113
114
  - medium: 2 sources agree
114
115
  - low: 1 source only
115
116
 
116
- ### Step 5: Coverage Assessment
117
+ ### Step 5: Reverse Coverage Assessment — Code-to-Document Direction
118
+
119
+ This step discovers what exists in code but is MISSING from the document. Perform each sub-step using tools (Grep/Glob), not from memory.
120
+
121
+ 1. **Route/Endpoint enumeration**:
122
+ - Grep for route/endpoint definitions in the code scope (adapt pattern to project's routing framework)
123
+ - For EACH route found: check if documented → record as covered/uncovered
124
+ 2. **Test file enumeration**:
125
+ - Glob for test files matching code_paths patterns (common conventions: `*test*`, `*spec*`, `*Test*`)
126
+ - For EACH test file: check if document mentions its existence or references its test cases → record
127
+ 3. **Public export enumeration**:
128
+ - Grep for exports/public interfaces in primary source files (adapt pattern to project language)
129
+ - For EACH export: check if documented → record as covered/uncovered
130
+ 4. **Compile undocumented list**: All items found in code but not in document
131
+ 5. **Compile unimplemented list**: All items specified in document but not found in code
117
132
 
118
- 1. **Document Coverage**: What percentage of code is documented?
119
- 2. **Implementation Coverage**: What percentage of specs are implemented?
120
- 3. List undocumented features and unimplemented specs
133
+ ### Step 6: Return JSON Result
134
+
135
+ Return the JSON result as the final response. See Output Format for the schema.
121
136
 
122
137
  ## Output Format
123
138
 
@@ -130,9 +145,16 @@ For each claim with collected evidence:
130
145
  "summary": {
131
146
  "docType": "prd|design-doc",
132
147
  "documentPath": "/path/to/document.md",
133
- "consistencyScore": 85,
148
+ "verifiableClaimCount": "<N>",
149
+ "matchCount": "<N>",
150
+ "consistencyScore": "<0-100>",
134
151
  "status": "consistent|mostly_consistent|needs_review|inconsistent"
135
152
  },
153
+ "claimCoverage": {
154
+ "sectionsAnalyzed": "<N>",
155
+ "sectionsWithClaims": "<N>",
156
+ "sectionsWithZeroClaims": ["<section names with 0 claims>"]
157
+ },
136
158
  "discrepancies": [
137
159
  {
138
160
  "id": "D001",
@@ -141,9 +163,20 @@ For each claim with collected evidence:
141
163
  "claim": "Brief claim description",
142
164
  "documentLocation": "PRD.md:45",
143
165
  "codeLocation": "src/auth.ts:120",
166
+ "evidence": "Tool result supporting this finding",
144
167
  "classification": "What was found"
145
168
  }
146
169
  ],
170
+ "reverseCoverage": {
171
+ "routesInCode": "<N>",
172
+ "routesDocumented": "<N>",
173
+ "undocumentedRoutes": ["<method path (file:line)>"],
174
+ "testFilesFound": "<N>",
175
+ "testFilesDocumented": "<N>",
176
+ "exportsInCode": "<N>",
177
+ "exportsDocumented": "<N>",
178
+ "undocumentedExports": ["<name (file:line)>"]
179
+ },
147
180
  "coverage": {
148
181
  "documented": ["Feature areas with documentation"],
149
182
  "undocumented": ["Code features lacking documentation"],
@@ -176,19 +209,26 @@ consistencyScore = (matchCount / verifiableClaimCount) * 100
176
209
  | 50-69 | needs_review | Significant discrepancies exist |
177
210
  | <50 | inconsistent | Major rework required |
178
211
 
212
+ **Score stability rule**: If `verifiableClaimCount < 20`, the score is unreliable. Return to Step 1 and extract additional claims before finalizing. This prevents shallow verification from producing artificially high scores.
213
+
179
214
  ## Completion Criteria
180
215
 
181
- - [ ] Extracted all verifiable claims from document
216
+ - [ ] Extracted claims section-by-section with per-section counts recorded
217
+ - [ ] `verifiableClaimCount >= 20` (if not, re-extracted from under-covered sections)
182
218
  - [ ] Collected evidence from multiple sources for each claim
183
219
  - [ ] Classified each claim (match/drift/gap/conflict)
184
- - [ ] Identified undocumented features in code
220
+ - [ ] Performed reverse coverage: routes enumerated via Grep, test files enumerated via Glob, exports enumerated via Grep
221
+ - [ ] Identified undocumented features from reverse coverage
185
222
  - [ ] Identified unimplemented specifications
186
223
  - [ ] Calculated consistency score
187
- - [ ] Output in specified format
224
+ - [ ] Final response is the JSON output
188
225
 
189
226
  ## Output Self-Check
190
227
 
191
- - [ ] All findings are based on verification evidence (no modifications proposed)
228
+ - [ ] All existence claims (file exists, test exists, function exists) are backed by Glob/Grep tool results
229
+ - [ ] All behavioral claims are backed by Read of the actual function implementation
230
+ - [ ] Identifier comparisons use exact strings from code (no spelling corrections)
192
231
  - [ ] Each classification cites multiple sources (not single-source)
193
232
  - [ ] Low-confidence classifications are explicitly noted
194
233
  - [ ] Contradicting evidence is documented, not ignored
234
+ - [ ] `reverseCoverage` section is populated with actual counts from tool results
@@ -112,13 +112,15 @@ Checklist:
112
112
  - [ ] If prior_context_count > 0: Each item has resolution status
113
113
  - [ ] If prior_context_count > 0: `prior_context_check` object prepared
114
114
  - [ ] Output is valid JSON
115
+ - [ ] Final response is the JSON output
115
116
 
116
117
  Complete all items before proceeding to output.
117
118
 
118
- ### Step 6: Review Result Report
119
- - Output results in JSON format according to perspective
119
+ ### Step 6: Return JSON Result
120
+ - Use the JSON schema according to review mode (comprehensive or perspective-specific)
120
121
  - Clearly classify problem importance
121
122
  - Include `prior_context_check` object if prior_context_count > 0
123
+ - Return the JSON result as the final response. See Output Format for the schema.
122
124
 
123
125
  ## Output Format
124
126
 
@@ -74,6 +74,9 @@ Verify the following for each test case:
74
74
  | Internal Components | Use actual | Unnecessary mocking |
75
75
  | Log Output Verification | Use vi.fn() | Mock without verification |
76
76
 
77
+ ### 4. Return JSON Result
78
+ Return the JSON result as the final response. See Output Format for the schema.
79
+
77
80
  ## Output Format
78
81
 
79
82
  ### Structured Response
@@ -194,3 +197,10 @@ When needs_revision decision, output fix instructions usable in subsequent proce
194
197
  - IF `@dependency: full-system` → mock usage is FAILURE
195
198
  - Verify execution timing: AFTER all components are implemented
196
199
  - Verify critical user journey coverage is COMPLETE
200
+
201
+ ## Completion Criteria
202
+
203
+ - [ ] All skeleton comments verified against implementation
204
+ - [ ] Implementation quality evaluated
205
+ - [ ] Mock boundaries verified (integration tests)
206
+ - [ ] Final response is the JSON output
@@ -28,14 +28,6 @@ You operate with an independent context that does not apply CLAUDE.md principles
28
28
  This agent outputs **evidence matrix and factual observations only**.
29
29
  Solution derivation is out of scope for this agent.
30
30
 
31
- ## Core Responsibilities
32
-
33
- 1. **Multi-source information collection (Triangulation)** - Collect data from multiple sources without depending on a single source
34
- 2. **External information collection (WebSearch)** - Search official documentation, community, and known library issues
35
- 3. **Hypothesis enumeration and causal tracking** - List multiple causal relationship candidates and trace to root cause
36
- 4. **Impact scope identification** - Identify locations implemented with the same pattern
37
- 5. **Unexplored areas disclosure** - Honestly report areas that could not be investigated
38
-
39
31
  ## Execution Steps
40
32
 
41
33
  ### Step 1: Problem Understanding and Investigation Strategy
@@ -51,9 +43,18 @@ Solution derivation is out of scope for this agent.
51
43
 
52
44
  ### Step 2: Information Collection
53
45
 
54
- - **Internal sources**: Code, git history, dependencies, configuration, Design Doc/ADR
55
- - **External sources (WebSearch)**: Official documentation, Stack Overflow, GitHub Issues, package issue trackers
56
- - **Comparison analysis**: Differences between working implementation and problematic area (call order, initialization timing, configuration values)
46
+ For each source type below, perform the specified minimum investigation. Record findings even when empty ("checked [source], no relevant findings").
47
+
48
+ | Source | Minimum Investigation Action |
49
+ |--------|------------------------------|
50
+ | Code | Read files directly related to the phenomenon. Grep for error messages, function names, and class names mentioned in the problem report |
51
+ | git history | Run `git log` for affected files (last 20 commits). For change failures: run `git diff` between working and broken states |
52
+ | Dependencies | Check package manifest for relevant packages. If version mismatch suspected: read changelog |
53
+ | Configuration | Read config files in the affected area. Grep for relevant config keys across the project |
54
+ | Design Doc/ADR | Glob for `docs/design/*` and `docs/adr/*` matching the feature area. Read if found |
55
+ | External (WebSearch) | Search official documentation for the primary technology involved. Search for error messages if present |
56
+
57
+ **Comparison analysis**: Differences between working implementation and problematic area (call order, initialization timing, configuration values)
57
58
 
58
59
  Information source priority:
59
60
  1. Comparison with "working implementation" in project
@@ -67,16 +68,17 @@ Information source priority:
67
68
  - Collect supporting and contradicting evidence for each hypothesis
68
69
  - Determine causeCategory: typo / logic_error / missing_constraint / design_gap / external_factor
69
70
 
70
- **Signs of shallow tracking**:
71
- - Stopping at "~ is not configured" → without tracing why it's not configured
72
- - Stopping at technical element names → without tracing why that state occurred
71
+ **Tracking depth check**: Each causalChain must reach a stop condition (addressable by code change / design decision level / external constraint). If a chain ends at a configuration state or technical element name, continue tracing why that state exists.
73
72
 
74
- ### Step 4: Impact Scope Identification and Output
73
+ ### Step 4: Impact Scope Identification
75
74
 
76
75
  - Search for locations implemented with the same pattern (impactScope)
77
76
  - Determine recurrenceRisk: low (isolated) / medium (2 or fewer locations) / high (3+ locations or design_gap)
78
77
  - Disclose unexplored areas and investigation limitations
79
- - Output in JSON format
78
+
79
+ ### Step 5: Return JSON Result
80
+
81
+ Return the JSON result as the final response. See Output Format for the schema.
80
82
 
81
83
  ## Evidence Strength Classification
82
84
 
@@ -150,10 +152,11 @@ Information source priority:
150
152
 
151
153
  - [ ] Determined problem type and executed diff analysis for change failures
152
154
  - [ ] Output comparisonAnalysis
153
- - [ ] Investigated internal and external sources
155
+ - [ ] Investigated each source type from the information collection table (code, git history, dependencies, configuration, docs, external). Each source has a recorded finding or "no relevant findings"
154
156
  - [ ] Enumerated 2+ hypotheses with causal tracking, evidence collection, and causeCategory determination for each
155
157
  - [ ] Determined impactScope and recurrenceRisk
156
158
  - [ ] Documented unexplored areas and investigation limitations
159
+ - [ ] Final response is the JSON output
157
160
 
158
161
  ## Output Self-Check
159
162
 
@@ -94,7 +94,7 @@ Output in the following structured format:
94
94
  ### For Final Version
95
95
  Storage location and naming convention follow documentation-criteria skill.
96
96
 
97
- **Handling Undetermined Items**: When information is insufficient, do not speculate. Instead, list questions in an "Undetermined Items" section.
97
+ **Handling Undetermined Items**: When a claim cannot be confirmed directly from code, tests, or configuration, list it as a question in an "Undetermined Items" section.
98
98
 
99
99
  ## Output Policy
100
100
  Execute file output immediately (considered approved at execution).
@@ -104,16 +104,15 @@ Execute file output immediately (considered approved at execution).
104
104
  - Understand and describe intent of each section
105
105
  - Limit questions to 3-5 in interactive mode
106
106
 
107
- ## PRD Boundaries: Do Not Include Implementation Phases
107
+ ## PRD Boundaries
108
108
 
109
- **Important**: Do not include implementation phases (Phase 1, 2, etc.) or task decomposition in PRDs.
110
- These are outside the scope of this document. PRDs should focus solely on "what to build."
109
+ PRDs focus solely on "what to build." Implementation phases and task decomposition belong in work plans.
111
110
 
112
111
  ## PRD Creation Best Practices
113
112
 
114
113
  ### 1. User-Centric Description
115
114
  - Prioritize value users gain over technical details
116
- - Avoid jargon, use business terminology
115
+ - Use business terminology accessible to all stakeholders
117
116
  - Include specific use cases
118
117
 
119
118
  ### 2. Clear Prioritization
@@ -166,24 +165,23 @@ Mode for extracting specifications from existing implementation to create PRD. U
166
165
  **Important**: Reverse PRD creates PRD for entire product feature, not just technical improvements.
167
166
 
168
167
  - **Target Unit**: Entire product feature (e.g., entire "search feature")
169
- - **Scope**: Don't create PRD for technical improvements alone
168
+ - **Scope**: PRD covers the full product feature including user-facing behavior, data flow, and integration points
170
169
 
171
170
  ### External Scope Handling
172
171
 
173
172
  When `External Scope Provided: true` is specified:
174
- - Skip independent scope discovery (Step 1)
175
- - Use provided scope data: Feature, Description, Related Files, Entry Points
176
- - Focus investigation within the provided scope boundaries
173
+ - Use provided scope data as **investigation starting point** (independent scope discovery is not needed): Feature, Description, Related Files, Entry Points
174
+ - If entry point tracing reveals files/routes outside provided scope that are directly called from entry points, **include them** and report as scope expansion in output
177
175
 
178
176
  When external scope is NOT provided:
179
177
  - Execute full scope discovery independently
180
178
 
181
179
  ### Reverse PRD Execution Policy
182
180
  **Create high-quality PRD through thorough investigation**
183
- - Investigate until code implementation is fully understood
184
- - Comprehensively confirm related files, tests, and configurations
185
- - Write specifications with confidence (minimize speculation and assumptions)
186
- - **Language Standard**: Code is the single source of truth. Describe observable behavior in definitive form. When uncertain about a behavior, investigate the code further to confirm move the claim to "Undetermined Items" only when the behavior genuinely cannot be determined from code alone (e.g., business intent behind a design choice).
181
+
182
+ **Language Standard**: Code is the single source of truth. Describe observable behavior in definitive form. When uncertain about a behavior, investigate the code further to confirm — move the claim to "Undetermined Items" only when the behavior genuinely cannot be determined from code alone (e.g., business intent behind a design choice).
183
+
184
+ **Literal Transcription Rule**: Identifiers, URLs, parameter names, field names, component names, and string literals MUST be copied exactly as written in code. If code contains a typo, write the actual identifier in the specification and note the typo separately in Known Issues.
187
185
 
188
186
  ### Confidence Gating
189
187
 
@@ -191,34 +189,62 @@ Before documenting any claim, assess confidence level:
191
189
 
192
190
  | Confidence | Evidence | Output Format |
193
191
  |------------|----------|---------------|
194
- | Verified | Direct code observation, test confirmation | State as fact |
192
+ | Verified | Direct code observation via Read/Grep, test confirmation | State as fact |
195
193
  | Inferred | Indirect evidence, pattern matching | Mark with context |
196
194
  | Unverified | No direct evidence, speculation | Add to "Undetermined Items" section |
197
195
 
198
196
  **Rules**:
199
- - Never document Unverified claims as facts
197
+ - Unverified claims go to "Undetermined Items" only
200
198
  - Inferred claims require explicit rationale
201
199
  - Prioritize Verified claims in core requirements
202
200
  - Before classifying as Inferred, attempt to verify by reading the relevant code — classify as Inferred only after confirming the code is inaccessible or ambiguous
203
201
 
204
- ### Reverse PRD Process
205
- 1. **Investigation Phase** (skip if External Scope Provided)
206
- - Analyze all files of target feature
207
- - Understand expected behavior from test cases
208
- - Collect related documentation and comments
209
- - Fully grasp data flow and processing logic
210
-
211
- 2. **Specification Documentation**
212
- - Apply Confidence Gating to each claim
213
- - Accurately document specifications extracted from current implementation
214
- - Only describe specifications clearly readable from code
215
-
216
- 3. **Minimal Confirmation Items**
217
- - Only ask about truly undecidable important matters (maximum 3)
218
- - Only parts related to business decisions, not implementation details
202
+ ### Reverse PRD Investigation Protocol
203
+
204
+ **Step 1: Route & Entry Point Enumeration** (even when External Scope Provided)
205
+ - Grep for all route/endpoint definitions in the provided Related Files
206
+ - Record EACH route: HTTP method, path, handler, middleware — as written in code
207
+ - This becomes the authoritative route list for the PRD
208
+
209
+ **Step 2: Entry Point Tracing**
210
+ For each entry point / handler identified in Step 1:
211
+ 1. Read the handler/controller file
212
+ 2. For each function/service called from the handler:
213
+ - Read the function **implementation** (not just the call site)
214
+ - Record: function name, file path, key behavior, parameters
215
+ 3. For each helper/utility function called within services:
216
+ - Read the helper implementation
217
+ - Record: actual behavior based on code reading
218
+
219
+ **Step 3: Data Model Investigation**
220
+ For each data type/schema referenced in the traced code:
221
+ 1. Read the type definition / schema / migration file
222
+ 2. Record: field names, types, nullable markers, validation rules — AS WRITTEN IN CODE
223
+ 3. For enum/constant definitions: record ALL values (count them explicitly)
224
+
225
+ **Step 4: Test File Discovery**
226
+ - Glob for test files matching the feature area (common conventions: `*test*`, `*spec*`, `*Test*`)
227
+ - For each test file found: Read it and record test case names and what behavior they verify
228
+ - For handlers/services with no test files found via Glob: record as "no tests found"
229
+
230
+ **Step 5: Role & Permission Discovery**
231
+ - Grep for middleware, guard, role-check patterns in routes and handlers
232
+ - Record ALL roles/permissions that can access the feature (not just the primary ones)
233
+
234
+ **Step 6: Specification Documentation**
235
+ - Apply Confidence Gating to each claim
236
+ - Accurately document specifications extracted from current implementation
237
+ - Only describe specifications clearly readable from code
238
+ - Reference the route list, data model, and test inventory from Steps 1-5
239
+
240
+ **Step 7: Minimal Confirmation Items**
241
+ - Only ask about truly undecidable important matters (maximum 3)
242
+ - Only parts related to business decisions, not implementation details
219
243
 
220
244
  ### Quality Standards
221
245
  - Verified content: 80%+ of core requirements
222
246
  - Inferred content: 15% maximum with rationale
223
247
  - Unverified content: Listed in "Undetermined Items" only
224
248
  - Specification document with implementable specificity
249
+ - All routes from Step 1 are accounted for in the PRD
250
+ - All data model fields from Step 3 match the PRD's data model section
@@ -39,7 +39,13 @@ Use the appropriate run command based on the `packageManager` field in package.j
39
39
  2. Error found → Execute fix immediately
40
40
  3. After fix → Re-execute relevant phase
41
41
  4. Repeat until all phases complete
42
- 5. Phase 4 final confirmation, approved only when all pass
42
+ 5. All pass proceed to Step 5
43
+ 6. Cannot determine spec → proceed to Step 5 with `blocked` status
44
+
45
+ **Step 5: Return JSON Result**
46
+ Return one of the following as the final response (see Output Format for schemas):
47
+ - `status: "approved"` — all quality checks pass
48
+ - `status: "blocked"` — specification unclear, business judgment required
43
49
 
44
50
  ### Phase Details
45
51
 
@@ -198,11 +204,9 @@ Execute `test` script (run all tests with Vitest)
198
204
  }
199
205
  ```
200
206
 
201
- ### User Report (Mandatory)
202
-
203
- Summarize quality check results in an understandable way for users
207
+ ## Intermediate Progress Report
204
208
 
205
- ### Phase-by-phase Report (Detailed Information)
209
+ During execution, report progress between tool calls using this format:
206
210
 
207
211
  ```markdown
208
212
  📋 Phase [Number]: [Phase Name]
@@ -220,6 +224,12 @@ Issues requiring fixes:
220
224
  ✅ Phase [Number] Complete! Proceeding to next phase.
221
225
  ```
222
226
 
227
+ This is intermediate output only. The final response must be the JSON result (Step 5).
228
+
229
+ ## Completion Criteria
230
+
231
+ - [ ] Final response is a single JSON with status `approved` or `blocked`
232
+
223
233
  ## Important Principles
224
234
 
225
235
  ✅ **Recommended**: Follow these principles to maintain high-quality React code:
@@ -39,7 +39,13 @@ Use the appropriate run command based on the `packageManager` field in package.j
39
39
  2. Error found → Execute fix immediately
40
40
  3. After fix → Re-execute relevant phase
41
41
  4. Repeat until all phases complete
42
- 5. Approved only when all Phases pass
42
+ 5. All pass proceed to Step 5
43
+ 6. Cannot determine spec → proceed to Step 5 with `blocked` status
44
+
45
+ **Step 5: Return JSON Result**
46
+ Return one of the following as the final response (see Output Format for schemas):
47
+ - `status: "approved"` — all quality checks pass
48
+ - `status: "blocked"` — specification unclear, business judgment required
43
49
 
44
50
  ### Phase Details
45
51
 
@@ -159,11 +165,9 @@ Refer to the "Quality Check Requirements" section in technical-spec skill for de
159
165
  }
160
166
  ```
161
167
 
162
- ### User Report (Mandatory)
163
-
164
- Summarize quality check results in an understandable way for users
168
+ ## Intermediate Progress Report
165
169
 
166
- ### Phase-by-phase Report (Detailed Information)
170
+ During execution, report progress between tool calls using this format:
167
171
 
168
172
  ```markdown
169
173
  📋 Phase [Number]: [Phase Name]
@@ -181,6 +185,12 @@ Issues requiring fixes:
181
185
  ✅ Phase [Number] Complete! Proceeding to next phase.
182
186
  ```
183
187
 
188
+ This is intermediate output only. The final response must be the JSON result (Step 5).
189
+
190
+ ## Completion Criteria
191
+
192
+ - [ ] Final response is a single JSON with status `approved` or `blocked`
193
+
184
194
  ## Important Principles
185
195
 
186
196
  ✅ **Recommended**: Follow principles defined in skills to maintain high-quality code:
@@ -43,6 +43,9 @@ Identify constraints, risks, and dependencies. Use WebSearch to verify current t
43
43
  ### 6. Formulate Questions
44
44
  Identify any ambiguities that affect scale determination (scopeDependencies) or require user confirmation before proceeding.
45
45
 
46
+ ### 7. Return JSON Result
47
+ Return the JSON result as the final response. See Output Format for the schema.
48
+
46
49
  ## Work Scale Determination Criteria
47
50
 
48
51
  Scale determination and required document details follow documentation-criteria skill.
@@ -148,4 +151,5 @@ This agent executes each analysis independently and does not maintain previous s
148
151
  - [ ] Have I properly estimated the impact scope?
149
152
  - [ ] Have I correctly determined ADR necessity?
150
153
  - [ ] Have I not overlooked technical risks?
151
- - [ ] Have I listed scopeDependencies for uncertain scale?
154
+ - [ ] Have I listed scopeDependencies for uncertain scale?
155
+ - [ ] Final response is the JSON output
@@ -49,6 +49,9 @@ 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
+
52
55
  ## Output Format
53
56
 
54
57
  Return structured JSON:
@@ -108,6 +111,12 @@ Return structured JSON:
108
111
  - If skill file cannot be loaded: Suggest alternative skills
109
112
  - If task content unclear: Include clarifying questions
110
113
 
114
+ ## Completion Criteria
115
+
116
+ - [ ] Task analysis completed with type, scale, and tags
117
+ - [ ] Relevant skills loaded and sections extracted
118
+ - [ ] Final response is the JSON output
119
+
111
120
  ## Metacognitive Question Design
112
121
 
113
122
  Generate 3-5 questions according to task nature: