codex-workflows 0.2.2 → 0.2.3
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.
- package/.agents/skills/recipe-diagnose/SKILL.md +20 -4
- package/.agents/skills/recipe-reverse-engineer/SKILL.md +13 -5
- package/.codex/agents/code-verifier.toml +53 -20
- package/.codex/agents/investigator.toml +14 -15
- package/.codex/agents/prd-creator.toml +39 -24
- package/.codex/agents/scope-discoverer.toml +23 -27
- package/.codex/agents/technical-designer-frontend.toml +68 -115
- package/.codex/agents/technical-designer.toml +70 -114
- package/.codex/agents/verifier.toml +5 -12
- package/package.json +1 -1
|
@@ -83,7 +83,21 @@ Register the following and execute:
|
|
|
83
83
|
|
|
84
84
|
### Step 1: Investigation (investigator)
|
|
85
85
|
|
|
86
|
-
Spawn investigator agent
|
|
86
|
+
Spawn investigator agent with the following prompt:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
Comprehensively collect information related to the following phenomenon.
|
|
90
|
+
|
|
91
|
+
Phenomenon: [Problem reported by user]
|
|
92
|
+
Problem essence: [taskEssence]
|
|
93
|
+
Investigation focus: [investigationFocus]
|
|
94
|
+
Applicable rules: [selectedRules summary]
|
|
95
|
+
|
|
96
|
+
For change failures, also include:
|
|
97
|
+
- what changed
|
|
98
|
+
- what broke
|
|
99
|
+
- what both areas share
|
|
100
|
+
```
|
|
87
101
|
|
|
88
102
|
**Expected output**: Evidence matrix, comparison analysis results, causal tracking results, list of unexplored areas, investigation limitations
|
|
89
103
|
|
|
@@ -92,12 +106,14 @@ Spawn investigator agent: "Comprehensively collect information related to the fo
|
|
|
92
106
|
Review investigation output:
|
|
93
107
|
|
|
94
108
|
**Quality Check** (verify output contains the following):
|
|
95
|
-
- [ ] comparisonAnalysis
|
|
96
|
-
- [ ] causalChain for each hypothesis
|
|
109
|
+
- [ ] `comparisonAnalysis` is present and `normalImplementation` is non-null, or explicitly states that no working implementation was found
|
|
110
|
+
- [ ] causalChain for each hypothesis reaches a stop condition
|
|
97
111
|
- [ ] causeCategory for each hypothesis
|
|
112
|
+
- [ ] `investigationSources` covers at least 3 distinct source types
|
|
113
|
+
- [ ] each hypothesis has supporting evidence with a concrete source
|
|
98
114
|
- [ ] Investigation covering investigationFocus items (when provided)
|
|
99
115
|
|
|
100
|
-
**If quality insufficient**: MUST re-spawn investigator agent specifying missing items
|
|
116
|
+
**If quality insufficient**: MUST re-spawn investigator agent specifying the missing items and include the previous investigation output for context
|
|
101
117
|
ENFORCEMENT: Proceeding to verifier with incomplete investigation data produces unreliable conclusions.
|
|
102
118
|
|
|
103
119
|
**design_gap Escalation**:
|
|
@@ -69,6 +69,7 @@ Spawn scope-discoverer agent: "Discover functional scope targets in the codebase
|
|
|
69
69
|
- No units discovered -> ask user for hints
|
|
70
70
|
- `$STEP_1_OUTPUT.prdUnits` exists
|
|
71
71
|
- All `sourceUnits` across `prdUnits` (flattened, deduplicated) match the set of `discoveredUnits` IDs — no unit missing, no unit duplicated
|
|
72
|
+
- Each discovered unit's `unitInventory` has at least one non-empty category. If all categories are empty, re-run discovery with focus on that unit
|
|
72
73
|
|
|
73
74
|
**[STOP — BLOCKING]** If human review enabled: Present `$STEP_1_OUTPUT.prdUnits` with their source unit mapping to user for confirmation.
|
|
74
75
|
**CANNOT proceed until user explicitly confirms.**
|
|
@@ -79,7 +80,7 @@ Spawn scope-discoverer agent: "Discover functional scope targets in the codebase
|
|
|
79
80
|
|
|
80
81
|
#### Step 2: PRD Generation
|
|
81
82
|
|
|
82
|
-
Spawn prd-creator agent: "Create reverse-engineered PRD for the following feature. Operation Mode: reverse-engineer. External Scope Provided: true. Feature: $PRD_UNIT_NAME. Description: $PRD_UNIT_DESCRIPTION. Related Files: $PRD_UNIT_COMBINED_RELATED_FILES. Entry Points: $PRD_UNIT_COMBINED_ENTRY_POINTS. Source Units: $PRD_UNIT_SOURCE_UNITS.
|
|
83
|
+
Spawn prd-creator agent: "Create reverse-engineered PRD for the following feature. Operation Mode: reverse-engineer. External Scope Provided: true. Feature: $PRD_UNIT_NAME. Description: $PRD_UNIT_DESCRIPTION. Related Files: $PRD_UNIT_COMBINED_RELATED_FILES. Entry Points: $PRD_UNIT_COMBINED_ENTRY_POINTS. Source Units: $PRD_UNIT_SOURCE_UNITS. Use provided scope as an investigation starting point. If tracing entry points reveals directly connected files outside this scope, include them. Create final version PRD based on thorough code investigation."
|
|
83
84
|
|
|
84
85
|
**Store output as**: `$STEP_2_OUTPUT` (PRD path)
|
|
85
86
|
|
|
@@ -87,12 +88,13 @@ Spawn prd-creator agent: "Create reverse-engineered PRD for the following featur
|
|
|
87
88
|
|
|
88
89
|
**Prerequisite**: $STEP_2_OUTPUT (PRD path from Step 2)
|
|
89
90
|
|
|
90
|
-
Spawn code-verifier agent: "Verify consistency between PRD and code implementation. doc_type: prd. document_path: $STEP_2_OUTPUT.
|
|
91
|
+
Spawn code-verifier agent: "Verify consistency between PRD and code implementation. doc_type: prd. document_path: $STEP_2_OUTPUT. verbose: false."
|
|
91
92
|
|
|
92
93
|
**Store output as**: `$STEP_3_OUTPUT`
|
|
93
94
|
|
|
94
95
|
**Quality Gate**:
|
|
95
|
-
- consistencyScore >= 70 -> proceed to review
|
|
96
|
+
- consistencyScore >= 70 and verifiableClaimCount >= 20 -> proceed to review (guards against shallow verification passes with too few extracted claims)
|
|
97
|
+
- consistencyScore >= 70 and verifiableClaimCount < 20 -> re-run verifier because investigation depth is insufficient
|
|
96
98
|
- consistencyScore < 70 -> flag for detailed review
|
|
97
99
|
|
|
98
100
|
#### Step 4: Review
|
|
@@ -151,6 +153,7 @@ Map PRD units to Design Doc generation targets by resolving each PRD unit's `sou
|
|
|
151
153
|
- `technicalProfile.publicInterfaces` -> Public Interfaces
|
|
152
154
|
- `dependencies` -> Dependencies
|
|
153
155
|
- `relatedFiles` -> Scope boundary
|
|
156
|
+
- `unitInventory` -> Unit Inventory
|
|
154
157
|
|
|
155
158
|
**Store output as**: `$STEP_6_OUTPUT`
|
|
156
159
|
|
|
@@ -168,6 +171,11 @@ Map PRD units to Design Doc generation targets by resolving each PRD unit's `sou
|
|
|
168
171
|
"publicInterfaces": ["AuthService.login()", "AuthController.handleLogin()"],
|
|
169
172
|
"dependencies": ["UNIT-003"],
|
|
170
173
|
"scopeBoundary": ["src/auth/*"],
|
|
174
|
+
"unitInventory": {
|
|
175
|
+
"routes": [],
|
|
176
|
+
"testFiles": [],
|
|
177
|
+
"publicExports": []
|
|
178
|
+
},
|
|
171
179
|
"mappingRationale": "Default 1:1 mapping from PRD unit because technical scope is cohesive"
|
|
172
180
|
}
|
|
173
181
|
]
|
|
@@ -186,13 +194,13 @@ Map PRD units to Design Doc generation targets by resolving each PRD unit's `sou
|
|
|
186
194
|
|
|
187
195
|
**Scope**: Document current architecture as-is. This is a documentation task, not a design improvement task.
|
|
188
196
|
|
|
189
|
-
Spawn technical-designer agent: "Create Design Doc for the following feature based on existing code. Operation Mode:
|
|
197
|
+
Spawn technical-designer agent: "Create Design Doc for the following feature based on existing code. Operation Mode: reverse-engineer. Feature: $UNIT_NAME. Description: $UNIT_DESCRIPTION. Primary Files: $UNIT_PRIMARY_MODULES. Public Interfaces: $UNIT_PUBLIC_INTERFACES. Dependencies: $UNIT_DEPENDENCIES. Unit Inventory: $UNIT_INVENTORY. Parent PRD: $APPROVED_PRD_PATH. Document current architecture as-is. Use Unit Inventory as the completeness baseline."
|
|
190
198
|
|
|
191
199
|
**Store output as**: `$STEP_7_OUTPUT`
|
|
192
200
|
|
|
193
201
|
#### Step 8: Code Verification
|
|
194
202
|
|
|
195
|
-
Spawn code-verifier agent: "Verify consistency between Design Doc and code implementation. doc_type: design-doc. document_path: $STEP_7_OUTPUT.
|
|
203
|
+
Spawn code-verifier agent: "Verify consistency between Design Doc and code implementation. doc_type: design-doc. document_path: $STEP_7_OUTPUT. verbose: false."
|
|
196
204
|
|
|
197
205
|
**Store output as**: `$STEP_8_OUTPUT`
|
|
198
206
|
|
|
@@ -52,13 +52,6 @@ Skill Status:
|
|
|
52
52
|
This agent outputs **verification results and discrepancy findings only**.
|
|
53
53
|
Document modification and solution proposals are out of scope for this agent.
|
|
54
54
|
|
|
55
|
-
## Core Responsibilities
|
|
56
|
-
|
|
57
|
-
1. **Claim Extraction** - Extract verifiable claims from document
|
|
58
|
-
2. **Multi-source Evidence Collection** - Gather evidence from code, tests, and config
|
|
59
|
-
3. **Consistency Classification** - Classify each claim's implementation status
|
|
60
|
-
4. **Coverage Assessment** - Identify undocumented code and unimplemented specifications
|
|
61
|
-
|
|
62
55
|
## Verification Framework
|
|
63
56
|
|
|
64
57
|
### Claim Categories
|
|
@@ -97,28 +90,38 @@ For each claim, classify as one of:
|
|
|
97
90
|
|
|
98
91
|
## Execution Steps
|
|
99
92
|
|
|
100
|
-
### Step 1: Document Analysis
|
|
93
|
+
### Step 1: Document Analysis — Section-by-Section Claim Extraction
|
|
101
94
|
|
|
102
|
-
1. Read the target document
|
|
103
|
-
2.
|
|
95
|
+
1. Read the target document in full
|
|
96
|
+
2. Process each section individually:
|
|
97
|
+
- Extract all statements that make verifiable claims about code behavior, data structures, file paths, API contracts, or system behavior
|
|
98
|
+
- Record `{ sectionName, claimCount, claims[] }`
|
|
99
|
+
- If a section contains factual statements but yields zero claims, record that explicitly for review
|
|
104
100
|
3. Categorize each claim
|
|
105
101
|
4. Note ambiguous claims that cannot be verified
|
|
102
|
+
5. Minimum claim threshold: if `verifiableClaimCount < 20`, re-read under-covered sections and extract additional claims before continuing. Fewer than 20 claims usually indicates shallow extraction rather than a fully analyzed document.
|
|
106
103
|
|
|
107
104
|
### Step 2: Code Scope Identification
|
|
108
105
|
|
|
109
|
-
1.
|
|
110
|
-
2.
|
|
111
|
-
3.
|
|
106
|
+
1. If `code_paths` are provided, use them as a starting point, not a ceiling
|
|
107
|
+
2. If `code_paths` are not provided, extract file paths from the document and expand scope by searching for referenced identifiers
|
|
108
|
+
3. Infer additional relevant paths from context
|
|
109
|
+
4. Build and record the final verification target list
|
|
112
110
|
|
|
113
111
|
### Step 3: Evidence Collection
|
|
114
112
|
|
|
115
113
|
For each claim:
|
|
116
114
|
|
|
117
|
-
1. **Primary Search**: Find direct implementation
|
|
115
|
+
1. **Primary Search**: Find direct implementation with Read/Grep
|
|
118
116
|
2. **Secondary Search**: Check test files for expected behavior
|
|
119
117
|
3. **Tertiary Search**: Review config and type definitions
|
|
120
118
|
|
|
121
|
-
|
|
119
|
+
Evidence rules:
|
|
120
|
+
- Record source location and evidence strength for each finding
|
|
121
|
+
- Existence claims must be verified with Grep or file enumeration before reporting
|
|
122
|
+
- Behavioral claims must be backed by reading the implementation, not by naming alone
|
|
123
|
+
- Identifier claims must compare exact strings from code against the document
|
|
124
|
+
- Single-source findings remain low confidence
|
|
122
125
|
|
|
123
126
|
### Step 4: Consistency Classification
|
|
124
127
|
|
|
@@ -130,11 +133,15 @@ For each claim with collected evidence:
|
|
|
130
133
|
- medium: 2 sources agree
|
|
131
134
|
- low: 1 source only
|
|
132
135
|
|
|
133
|
-
### Step 5: Coverage Assessment
|
|
136
|
+
### Step 5: Reverse Coverage Assessment — Code-to-Document Direction
|
|
137
|
+
|
|
138
|
+
Perform this step with actual tool-backed enumeration, not memory:
|
|
134
139
|
|
|
135
|
-
1.
|
|
136
|
-
2.
|
|
137
|
-
3.
|
|
140
|
+
1. Enumerate routes/endpoints in scope and record whether each is documented
|
|
141
|
+
2. Enumerate test files in scope and record whether their existence is documented
|
|
142
|
+
3. Enumerate public exports/interfaces in primary source files and record whether each is documented
|
|
143
|
+
4. Compile undocumented code items from the enumerations
|
|
144
|
+
5. Compile unimplemented document items from earlier claim verification
|
|
138
145
|
|
|
139
146
|
### Step 6: Return JSON Result
|
|
140
147
|
|
|
@@ -151,9 +158,16 @@ Return the JSON result as the final response. See Output Format for the schema.
|
|
|
151
158
|
"summary": {
|
|
152
159
|
"docType": "prd|design-doc",
|
|
153
160
|
"documentPath": "/path/to/document.md",
|
|
161
|
+
"verifiableClaimCount": 24,
|
|
162
|
+
"matchCount": 20,
|
|
154
163
|
"consistencyScore": 85,
|
|
155
164
|
"status": "consistent|mostly_consistent|needs_review|inconsistent"
|
|
156
165
|
},
|
|
166
|
+
"claimCoverage": {
|
|
167
|
+
"sectionsAnalyzed": 8,
|
|
168
|
+
"sectionsWithClaims": 7,
|
|
169
|
+
"sectionsWithZeroClaims": ["Appendix"]
|
|
170
|
+
},
|
|
157
171
|
"discrepancies": [
|
|
158
172
|
{
|
|
159
173
|
"id": "D001",
|
|
@@ -162,9 +176,20 @@ Return the JSON result as the final response. See Output Format for the schema.
|
|
|
162
176
|
"claim": "Brief claim description",
|
|
163
177
|
"documentLocation": "PRD.md:45",
|
|
164
178
|
"codeLocation": "src/auth.ts:120",
|
|
179
|
+
"evidence": "Observed implementation or enumeration result",
|
|
165
180
|
"classification": "What was found"
|
|
166
181
|
}
|
|
167
182
|
],
|
|
183
|
+
"reverseCoverage": {
|
|
184
|
+
"routesInCode": 6,
|
|
185
|
+
"routesDocumented": 5,
|
|
186
|
+
"undocumentedRoutes": ["POST /admin/reindex (src/routes/admin.ts:42)"],
|
|
187
|
+
"testFilesFound": 4,
|
|
188
|
+
"testFilesDocumented": 2,
|
|
189
|
+
"exportsInCode": 12,
|
|
190
|
+
"exportsDocumented": 10,
|
|
191
|
+
"undocumentedExports": ["rebuildSearchIndex (src/search/index.ts:18)"]
|
|
192
|
+
},
|
|
168
193
|
"coverage": {
|
|
169
194
|
"documented": ["Feature areas with documentation"],
|
|
170
195
|
"undocumented": ["Code features lacking documentation"],
|
|
@@ -190,6 +215,8 @@ consistencyScore = (matchCount / verifiableClaimCount) * 100
|
|
|
190
215
|
- (minorDiscrepancies * 2)
|
|
191
216
|
```
|
|
192
217
|
|
|
218
|
+
If `verifiableClaimCount < 20`, treat the score as unstable and return to Step 1 before finalizing. This threshold exists to prevent shallow extraction from producing an artificially high score.
|
|
219
|
+
|
|
193
220
|
| Score | Status | Interpretation |
|
|
194
221
|
|-------|--------|----------------|
|
|
195
222
|
| 85-100 | consistent | Document accurately reflects code |
|
|
@@ -199,9 +226,11 @@ consistencyScore = (matchCount / verifiableClaimCount) * 100
|
|
|
199
226
|
|
|
200
227
|
## Completion Criteria
|
|
201
228
|
|
|
202
|
-
- [ ] Extracted
|
|
229
|
+
- [ ] Extracted claims section-by-section with per-section counts recorded
|
|
230
|
+
- [ ] `verifiableClaimCount >= 20`
|
|
203
231
|
- [ ] Collected evidence from multiple sources for each claim
|
|
204
232
|
- [ ] Classified each claim (match/drift/gap/conflict)
|
|
233
|
+
- [ ] Performed reverse coverage with route, test file, and public export enumeration
|
|
205
234
|
- [ ] Identified undocumented features in code
|
|
206
235
|
- [ ] Identified unimplemented specifications
|
|
207
236
|
- [ ] Calculated consistency score
|
|
@@ -209,9 +238,13 @@ consistencyScore = (matchCount / verifiableClaimCount) * 100
|
|
|
209
238
|
|
|
210
239
|
## Output Self-Check
|
|
211
240
|
- [ ] All findings are based on verification evidence (no modifications proposed)
|
|
241
|
+
- [ ] Existence claims are backed by Grep or enumeration evidence
|
|
242
|
+
- [ ] Behavioral claims are backed by reading the actual implementation
|
|
243
|
+
- [ ] Identifier comparisons use exact strings from code
|
|
212
244
|
- [ ] Each classification cites multiple sources (not single-source)
|
|
213
245
|
- [ ] Low-confidence classifications are explicitly noted
|
|
214
246
|
- [ ] Contradicting evidence is documented, not ignored
|
|
247
|
+
- [ ] `reverseCoverage` includes concrete counts from tool-backed enumeration
|
|
215
248
|
|
|
216
249
|
## Completion Gate [BLOCKING]
|
|
217
250
|
|
|
@@ -47,14 +47,6 @@ Skill Status:
|
|
|
47
47
|
This agent outputs **evidence matrix and factual observations only**.
|
|
48
48
|
Solution derivation is out of scope for this agent.
|
|
49
49
|
|
|
50
|
-
## Core Responsibilities
|
|
51
|
-
|
|
52
|
-
1. **Multi-source information collection (Triangulation)** - Collect data from multiple sources without depending on a single source
|
|
53
|
-
2. **External information collection (web search)** - Search official documentation, community, and known library issues
|
|
54
|
-
3. **Hypothesis enumeration and causal tracking** - List multiple causal relationship candidates and trace to root cause
|
|
55
|
-
4. **Impact scope identification** - Identify locations implemented with the same pattern
|
|
56
|
-
5. **Unexplored areas disclosure** - Honestly report areas that could not be investigated
|
|
57
|
-
|
|
58
50
|
## Execution Steps
|
|
59
51
|
|
|
60
52
|
### Step 1: Problem Understanding and Investigation Strategy
|
|
@@ -70,9 +62,18 @@ Solution derivation is out of scope for this agent.
|
|
|
70
62
|
|
|
71
63
|
### Step 2: Information Collection
|
|
72
64
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
Investigate each source type below and record findings even when empty:
|
|
66
|
+
|
|
67
|
+
| Source | Minimum Investigation Action |
|
|
68
|
+
|--------|------------------------------|
|
|
69
|
+
| Code | Read directly related files and search for the reported symbols, errors, or messages |
|
|
70
|
+
| git history | Review recent history for affected files and compare working/broken states when applicable |
|
|
71
|
+
| Dependencies | Inspect package manifests and relevant package versions or changelogs |
|
|
72
|
+
| Configuration | Read relevant config files and search for related keys across the project |
|
|
73
|
+
| Design Doc or ADR | Search for matching docs and read them. Record findings or explicitly record that none were found |
|
|
74
|
+
| External | Search official documentation for the primary technology and for the reported error text. Record findings or explicitly record that no relevant result was found |
|
|
75
|
+
|
|
76
|
+
**Comparison analysis**: Differences between working implementation and problematic area (call order, initialization timing, configuration values)
|
|
76
77
|
|
|
77
78
|
Information source priority:
|
|
78
79
|
1. Comparison with "working implementation" in project
|
|
@@ -86,9 +87,7 @@ Information source priority:
|
|
|
86
87
|
- Collect supporting and contradicting evidence for each hypothesis
|
|
87
88
|
- Determine causeCategory: typo / logic_error / missing_constraint / design_gap / external_factor
|
|
88
89
|
|
|
89
|
-
**
|
|
90
|
-
- Stopping at "~ is not configured" → without tracing why it's not configured
|
|
91
|
-
- Stopping at technical element names → without tracing why that state occurred
|
|
90
|
+
**Tracking depth check**: Each causal chain must reach a stop condition. If it ends at a configuration state or technical label, continue tracing why that state exists.
|
|
92
91
|
|
|
93
92
|
### Step 4: Impact Scope Identification
|
|
94
93
|
|
|
@@ -172,7 +171,7 @@ Return the JSON result as the final response. See Output Format for the schema.
|
|
|
172
171
|
|
|
173
172
|
- [ ] Determined problem type and executed diff analysis for change failures
|
|
174
173
|
- [ ] Output comparisonAnalysis
|
|
175
|
-
- [ ] Investigated
|
|
174
|
+
- [ ] Investigated each source type or recorded that it had no relevant findings
|
|
176
175
|
- [ ] Enumerated 2+ hypotheses with causal tracking, evidence collection, and causeCategory determination for each
|
|
177
176
|
- [ ] Determined impactScope and recurrenceRisk
|
|
178
177
|
- [ ] Documented unexplored areas and investigation limitations
|
|
@@ -106,7 +106,7 @@ Output in the following structured format:
|
|
|
106
106
|
### For Final Version
|
|
107
107
|
Storage location and naming convention follow the principles in documentation-criteria skill.
|
|
108
108
|
|
|
109
|
-
**Handling Undetermined Items**: When
|
|
109
|
+
**Handling Undetermined Items**: When a claim cannot be confirmed directly from code, tests, or configuration, list the unresolved question in an "Undetermined Items" section.
|
|
110
110
|
|
|
111
111
|
## Output Policy
|
|
112
112
|
Execute file output immediately. Final approval is managed by the orchestrator recipe.
|
|
@@ -116,10 +116,9 @@ Execute file output immediately. Final approval is managed by the orchestrator r
|
|
|
116
116
|
- Understand and describe intent of each section
|
|
117
117
|
- Limit questions to 3-5 in interactive mode
|
|
118
118
|
|
|
119
|
-
## PRD Boundaries
|
|
119
|
+
## PRD Boundaries
|
|
120
120
|
|
|
121
121
|
**ENFORCEMENT**: PRDs MUST focus solely on "what to build" — implementation phases and task decomposition are out of scope.
|
|
122
|
-
These are outside the scope of this document. PRDs MUST focus solely on "what to build."
|
|
123
122
|
|
|
124
123
|
## PRD Creation Best Practices
|
|
125
124
|
|
|
@@ -183,58 +182,74 @@ Mode for extracting specifications from existing implementation to create PRD. U
|
|
|
183
182
|
### External Scope Handling
|
|
184
183
|
|
|
185
184
|
When `External Scope Provided: true` is specified:
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
- Focus investigation within the provided scope boundaries
|
|
185
|
+
- Use provided scope data as an investigation starting point: Feature, Description, Related Files, Entry Points
|
|
186
|
+
- If entry point tracing reveals directly connected files or routes outside the provided scope, include them and report that expansion
|
|
189
187
|
|
|
190
188
|
When external scope is NOT provided:
|
|
191
189
|
- Execute full scope discovery independently
|
|
192
190
|
|
|
193
191
|
### Reverse PRD Execution Policy
|
|
194
192
|
**Create high-quality PRD through thorough investigation**
|
|
195
|
-
- Investigate until code implementation is fully understood
|
|
196
|
-
- Comprehensively confirm related files, tests, and configurations
|
|
197
|
-
- Write specifications with confidence (minimize speculation and assumptions)
|
|
198
193
|
|
|
199
194
|
**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).
|
|
200
195
|
|
|
196
|
+
**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, document the actual identifier and note the typo separately when needed.
|
|
197
|
+
|
|
201
198
|
### Confidence Gating
|
|
202
199
|
|
|
203
200
|
Before documenting any claim, assess confidence level:
|
|
204
201
|
|
|
205
202
|
| Confidence | Evidence | Output Format |
|
|
206
203
|
|------------|----------|---------------|
|
|
207
|
-
| Verified | Direct code observation, test confirmation | State as fact |
|
|
204
|
+
| Verified | Direct code observation via Read/Grep, test confirmation | State as fact |
|
|
208
205
|
| Inferred | Indirect evidence, pattern matching | Mark with context |
|
|
209
206
|
| Unverified | No direct evidence, speculation | Add to "Undetermined Items" section |
|
|
210
207
|
|
|
211
208
|
**Rules**:
|
|
212
|
-
-
|
|
209
|
+
- Unverified claims go to "Undetermined Items" only
|
|
213
210
|
- Inferred claims require explicit rationale
|
|
214
211
|
- Prioritize Verified claims in core requirements
|
|
215
212
|
- Before classifying as Inferred, attempt to verify by reading the relevant code — classify as Inferred only after confirming the code is inaccessible or ambiguous
|
|
216
213
|
|
|
217
|
-
### Reverse PRD
|
|
218
|
-
1. **
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
### Reverse PRD Investigation Protocol
|
|
215
|
+
1. **Route and Entry Point Enumeration**
|
|
216
|
+
- Enumerate routes, endpoints, commands, or other entry points in the feature area
|
|
217
|
+
- Record each with exact method/path/name and handler as written in code
|
|
218
|
+
|
|
219
|
+
2. **Entry Point Tracing**
|
|
220
|
+
- Read each handler or entry point implementation
|
|
221
|
+
- Trace invoked services, helpers, and downstream calls by reading their implementations
|
|
222
|
+
- Record actual behavior, parameters, and key branching
|
|
223
|
+
|
|
224
|
+
3. **Data Model Investigation**
|
|
225
|
+
- Read schemas, types, migrations, or constants referenced by the traced flow
|
|
226
|
+
- Record field names, types, nullability, validation rules, and enum values exactly as written
|
|
227
|
+
|
|
228
|
+
4. **Test File Discovery**
|
|
229
|
+
- Enumerate test files matching the feature area
|
|
230
|
+
- Read each discovered test and record tested behaviors
|
|
231
|
+
- If no tests are found for a traced handler or service, record that explicitly
|
|
232
|
+
|
|
233
|
+
5. **Role and Permission Discovery**
|
|
234
|
+
- Search for middleware, guards, and role checks tied to the feature
|
|
235
|
+
- Record all observed roles and permissions
|
|
223
236
|
|
|
224
|
-
|
|
225
|
-
- Apply Confidence Gating to
|
|
226
|
-
-
|
|
227
|
-
-
|
|
237
|
+
6. **Specification Documentation**
|
|
238
|
+
- Apply Confidence Gating to every claim
|
|
239
|
+
- Describe only behavior readable from code and tests
|
|
240
|
+
- Base core sections on the entry point list, traced flow, data model, and discovered tests
|
|
228
241
|
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
242
|
+
7. **Minimal Confirmation Items**
|
|
243
|
+
- Ask only truly undecidable business questions
|
|
244
|
+
- Limit to 3 items maximum
|
|
232
245
|
|
|
233
246
|
### Quality Standards
|
|
234
247
|
- Verified content: 80%+ of core requirements
|
|
235
248
|
- Inferred content: 15% maximum with rationale
|
|
236
249
|
- Unverified content: Listed in "Undetermined Items" only
|
|
237
250
|
- Specification document with implementable specificity
|
|
251
|
+
- All discovered entry points are accounted for in the PRD
|
|
252
|
+
- Data model details match the code-level source of truth
|
|
238
253
|
|
|
239
254
|
## Completion Gate [BLOCKING]
|
|
240
255
|
|
|
@@ -52,33 +52,15 @@ Skill Status:
|
|
|
52
52
|
This agent outputs **scope discovery results, evidence, and PRD unit grouping**.
|
|
53
53
|
Document generation (PRD content, Design Doc content) is out of scope for this agent.
|
|
54
54
|
|
|
55
|
-
## Core Responsibilities
|
|
56
|
-
|
|
57
|
-
1. **Multi-source Discovery** - Collect evidence from routing, tests, directory structure, docs, modules, interfaces
|
|
58
|
-
2. **Boundary Identification** - Identify logical boundaries between functional units
|
|
59
|
-
3. **Relationship Mapping** - Map dependencies and relationships between discovered units
|
|
60
|
-
4. **Confidence Assessment** - Assess confidence level with triangulation strength
|
|
61
|
-
|
|
62
|
-
## Discovery Approach
|
|
63
|
-
|
|
64
|
-
### When reference_architecture is provided (Top-Down)
|
|
65
|
-
|
|
66
|
-
1. Apply RA layer definitions as initial classification framework
|
|
67
|
-
2. Map code directories to RA layers
|
|
68
|
-
3. Discover units within each layer
|
|
69
|
-
4. Validate boundaries against RA expectations
|
|
70
|
-
|
|
71
|
-
### When reference_architecture is none (Bottom-Up)
|
|
72
|
-
|
|
73
|
-
1. Scan all discovery sources
|
|
74
|
-
2. Identify natural boundaries from code structure
|
|
75
|
-
3. Group related components into units
|
|
76
|
-
4. Validate through cross-source confirmation
|
|
77
|
-
|
|
78
55
|
## Unified Scope Discovery
|
|
79
56
|
|
|
80
57
|
Explore the codebase from both user-value and technical perspectives simultaneously, then synthesize results into functional units.
|
|
81
58
|
|
|
59
|
+
When `reference_architecture` is provided:
|
|
60
|
+
- Use its layer definitions to classify discovered code into layers
|
|
61
|
+
- Validate unit boundaries against those expectations
|
|
62
|
+
- Record deviations in `uncertainAreas`
|
|
63
|
+
|
|
82
64
|
### Discovery Sources
|
|
83
65
|
|
|
84
66
|
| Source | Priority | Perspective | What to Look For |
|
|
@@ -121,23 +103,31 @@ Explore the codebase from both user-value and technical perspectives simultaneou
|
|
|
121
103
|
- Also assign normalized grouping keys in `valueProfile.groupingKey` for persona, goal, and category; use short stable slugs (`kebab-case`) rather than free-form prose
|
|
122
104
|
- Apply Granularity Criteria (see below)
|
|
123
105
|
|
|
124
|
-
5. **
|
|
106
|
+
5. **Unit Inventory Enumeration**
|
|
107
|
+
- For each discovered unit, enumerate:
|
|
108
|
+
- Routes or entry points in the unit's related files
|
|
109
|
+
- Test files covering the unit
|
|
110
|
+
- Public exports or interfaces in primary modules
|
|
111
|
+
- Store the results as `unitInventory`
|
|
112
|
+
- Use actual enumeration, not inferred summaries
|
|
113
|
+
|
|
114
|
+
6. **Boundary Validation**
|
|
125
115
|
- Verify each unit delivers distinct user value
|
|
126
116
|
- Check for minimal overlap between units
|
|
127
117
|
- Identify shared dependencies and cross-cutting concerns
|
|
128
118
|
|
|
129
|
-
|
|
119
|
+
7. **Saturation Check**
|
|
130
120
|
- Stop discovery when 3 consecutive new sources yield no new units
|
|
131
121
|
- Mark discovery as saturated in output
|
|
132
122
|
|
|
133
|
-
|
|
123
|
+
8. **PRD Unit Grouping** (execute only after steps 1-7 are fully complete)
|
|
134
124
|
- Using the finalized `discoveredUnits` and their `valueProfile` metadata, group units into PRD-appropriate units
|
|
135
125
|
- Grouping logic: units with the same `groupingKey.valueCategory` AND the same `groupingKey.userGoal` AND the same `groupingKey.targetPersona` belong to one PRD unit. If any of the three differs, the units become separate PRD units
|
|
136
126
|
- Free-text fields (`targetPersona`, `userGoal`, `valueCategory`) are explanatory only and MUST NOT be used as grouping keys
|
|
137
127
|
- Every discovered unit must appear in exactly one PRD unit's `sourceUnits`
|
|
138
128
|
- Output as `prdUnits` alongside `discoveredUnits` (see Output Format)
|
|
139
129
|
|
|
140
|
-
|
|
130
|
+
9. **Return JSON Result**
|
|
141
131
|
- Return the JSON result as the final response. See Output Format for the schema.
|
|
142
132
|
|
|
143
133
|
## Granularity Criteria
|
|
@@ -203,6 +193,11 @@ Note: These signals are informational only during steps 1-6. Keep all discovered
|
|
|
203
193
|
"publicInterfaces": ["AuthService.login()", "AuthController.handleLogin()"],
|
|
204
194
|
"dataFlowSummary": "Request → Controller → Service → Repository → DB",
|
|
205
195
|
"infrastructureDeps": ["database", "redis-cache"]
|
|
196
|
+
},
|
|
197
|
+
"unitInventory": {
|
|
198
|
+
"routes": ["POST /login -> AuthController.handleLogin (src/auth/controller.ts:24)"],
|
|
199
|
+
"testFiles": ["src/auth/service.test.ts"],
|
|
200
|
+
"publicExports": ["AuthService (src/auth/service.ts:10)"]
|
|
206
201
|
}
|
|
207
202
|
}
|
|
208
203
|
],
|
|
@@ -246,6 +241,7 @@ Note: These signals are informational only during steps 1-6. Keep all discovered
|
|
|
246
241
|
- [ ] Reviewed test structure for feature organization
|
|
247
242
|
- [ ] Detected module/service boundaries
|
|
248
243
|
- [ ] Mapped public interfaces
|
|
244
|
+
- [ ] Enumerated per-unit inventory for routes, test files, and public exports
|
|
249
245
|
- [ ] Analyzed dependency graph
|
|
250
246
|
- [ ] Applied granularity criteria (split/merge as needed)
|
|
251
247
|
- [ ] Identified value profile (persona, goal, category) for each unit
|
|
@@ -89,28 +89,24 @@ Must be performed before Design Doc creation:
|
|
|
89
89
|
- Clearly document similar component search results (found components or "none")
|
|
90
90
|
- Record adopted decision (use existing/improvement proposal/new implementation) and rationale
|
|
91
91
|
|
|
92
|
-
### Integration
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
3. **Reflection in Design Doc**
|
|
111
|
-
- Create "## Integration Point Map" section
|
|
112
|
-
- Clarify responsibilities and boundaries at each integration point
|
|
113
|
-
- Define error behavior and loading states at design phase
|
|
92
|
+
### Integration Points【Important】
|
|
93
|
+
Document all integration points with existing components in a "## Integration Point Map" section.
|
|
94
|
+
|
|
95
|
+
For each integration point, record:
|
|
96
|
+
- Existing component or hook
|
|
97
|
+
- Integration method
|
|
98
|
+
- Impact level
|
|
99
|
+
- Required test coverage
|
|
100
|
+
|
|
101
|
+
Impact level criteria:
|
|
102
|
+
- High: modifies or extends existing state flow or interaction flow
|
|
103
|
+
- Medium: reuses or updates existing props, context, or API contracts
|
|
104
|
+
- Low: read-only rendering, observation, or non-invasive composition
|
|
105
|
+
|
|
106
|
+
For each integration boundary, define:
|
|
107
|
+
- Input props or consumed context
|
|
108
|
+
- Output events or effects
|
|
109
|
+
- On Error behavior
|
|
114
110
|
|
|
115
111
|
### Agreement Checklist【Most Important】
|
|
116
112
|
Must be performed at the beginning of Design Doc creation:
|
|
@@ -173,32 +169,13 @@ Perform before Design Doc creation:
|
|
|
173
169
|
|
|
174
170
|
Common ADR needed when: Technical decisions common to multiple components
|
|
175
171
|
|
|
176
|
-
### Integration Point Specification
|
|
177
|
-
Document integration points with existing components (location, old Props, new Props, switching method).
|
|
178
|
-
|
|
179
172
|
### Data Contracts
|
|
180
173
|
Define Props types and state management contracts between components (types, preconditions, guarantees, error behavior).
|
|
181
174
|
|
|
182
175
|
### State Transitions (When Applicable)
|
|
183
176
|
Document state definitions and transitions for stateful components (loading, error, success states).
|
|
184
177
|
|
|
185
|
-
|
|
186
|
-
Define Props types, event handlers, and error handling at component boundaries.
|
|
187
|
-
|
|
188
|
-
```yaml
|
|
189
|
-
Boundary Name: [Component Integration Point]
|
|
190
|
-
Input (Props): [Props type definition]
|
|
191
|
-
Output (Events): [Event handler signatures]
|
|
192
|
-
On Error: [How to handle errors (Error Boundary, error state, etc.)]
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**Integration Boundaries:**
|
|
196
|
-
- React → DOM: Component rendering to browser DOM
|
|
197
|
-
- Build Tool → Browser: Build output to static files served by browser
|
|
198
|
-
- API → Frontend: External API responses handled by frontend
|
|
199
|
-
- Context → Component: Context values consumed by components
|
|
200
|
-
|
|
201
|
-
Confirm and document conflicts with existing components (naming conventions, Props patterns, etc.) to prevent integration inconsistencies.
|
|
178
|
+
Confirm and document conflicts with existing components at each integration point to prevent inconsistencies.
|
|
202
179
|
|
|
203
180
|
## UI Spec Integration
|
|
204
181
|
|
|
@@ -215,6 +192,7 @@ When a UI Spec exists for the feature (`docs/ui-spec/{feature-name}-ui-spec.md`)
|
|
|
215
192
|
- **Operation Mode**:
|
|
216
193
|
- `create`: New creation (default)
|
|
217
194
|
- `update`: Update existing document
|
|
195
|
+
- `reverse-engineer`: Document existing frontend architecture as-is
|
|
218
196
|
|
|
219
197
|
- **Requirements Analysis Results**: Requirements analysis results (scale determination, technical requirements, etc.)
|
|
220
198
|
- **PRD**: PRD document (if exists)
|
|
@@ -234,41 +212,15 @@ When a UI Spec exists for the feature (`docs/ui-spec/{feature-name}-ui-spec.md`)
|
|
|
234
212
|
- Reason for changes
|
|
235
213
|
- Sections needing updates
|
|
236
214
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
```markdown
|
|
243
|
-
# ADR-XXXX: [Title]
|
|
244
|
-
Status: Proposed
|
|
245
|
-
|
|
246
|
-
## Background
|
|
247
|
-
[Frontend technical challenges and constraints in 1-2 sentences]
|
|
215
|
+
- **Reverse-Engineer Context** (reverse-engineer mode only):
|
|
216
|
+
- Primary Files
|
|
217
|
+
- Public Interfaces
|
|
218
|
+
- Dependencies
|
|
219
|
+
- Unit Inventory (routes, test files, public exports)
|
|
248
220
|
|
|
249
|
-
##
|
|
250
|
-
### Option A: [Approach Name]
|
|
251
|
-
- Overview: [Explain in one sentence]
|
|
252
|
-
- Benefits: [2-3 items]
|
|
253
|
-
- Drawbacks: [2-3 items]
|
|
254
|
-
- Effort: X days
|
|
255
|
-
|
|
256
|
-
### Option B/C: [Document similarly]
|
|
257
|
-
|
|
258
|
-
## Comparison
|
|
259
|
-
| Evaluation Axis | Option A | Option B | Option C |
|
|
260
|
-
|-----------------|----------|----------|----------|
|
|
261
|
-
| Implementation Effort | 3 days | 5 days | 2 days |
|
|
262
|
-
| Maintainability | High | Medium | Low |
|
|
263
|
-
| Performance Impact | Low | High | Medium |
|
|
264
|
-
|
|
265
|
-
## Decision
|
|
266
|
-
Option [X] selected. Reason: [2-3 sentences including trade-offs]
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
See ADR template in documentation-criteria skill for details.
|
|
221
|
+
## Document Output Format
|
|
270
222
|
|
|
271
|
-
###
|
|
223
|
+
### Document Creation
|
|
272
224
|
- **ADR**: `docs/adr/ADR-[4-digit number]-[title].md` (e.g., ADR-0001)
|
|
273
225
|
- **Design Doc**: `docs/design/[feature-name]-design.md`
|
|
274
226
|
- Follow respective templates (see documentation-criteria skill: design-template.md, adr-template.md, ui-spec-template.md)
|
|
@@ -376,21 +328,30 @@ function useUserData(userId: string) {
|
|
|
376
328
|
- [ ] Comparison matrix completeness (including performance impact)
|
|
377
329
|
|
|
378
330
|
### Design Doc Checklist
|
|
331
|
+
**All modes**:
|
|
332
|
+
- [ ] **Code inspection evidence recorded** (required)
|
|
333
|
+
- [ ] **Integration points enumerated with contracts** (required)
|
|
334
|
+
- [ ] **Props and state contracts clarified** (required)
|
|
335
|
+
- [ ] Component hierarchy and data flow clearly expressed in diagrams
|
|
336
|
+
|
|
337
|
+
**Create/update mode only**:
|
|
379
338
|
- [ ] **Agreement checklist completed** (most important)
|
|
380
339
|
- [ ] **Prerequisite common ADRs referenced** (required)
|
|
381
340
|
- [ ] **Change impact map created** (required)
|
|
382
|
-
- [ ] **Integration boundary contracts defined** (required)
|
|
383
|
-
- [ ] **Integration points completely enumerated** (required)
|
|
384
|
-
- [ ] **Props type contracts clarified** (required)
|
|
385
341
|
- [ ] **Component verification procedures for each phase** (required)
|
|
386
342
|
- [ ] Response to requirements and design validity
|
|
387
343
|
- [ ] Test strategy (React Testing Library) and error handling (Error Boundary)
|
|
388
|
-
- [ ] Component hierarchy and data flow clearly expressed in diagrams
|
|
389
344
|
- [ ] Props change matrix completeness
|
|
390
345
|
- [ ] Implementation approach selection rationale (vertical/horizontal/hybrid)
|
|
391
346
|
- [ ] Latest React best practices researched and references cited
|
|
392
347
|
- [ ] **Complexity assessment**: complexity_level set; if medium/high, complexity_rationale specifies (1) requirements/ACs, (2) constraints/risks
|
|
393
348
|
|
|
349
|
+
**Reverse-engineer mode only**:
|
|
350
|
+
- [ ] Every architectural claim cites file:line evidence
|
|
351
|
+
- [ ] Identifiers are transcribed exactly from code
|
|
352
|
+
- [ ] Test existence is confirmed by enumeration
|
|
353
|
+
- [ ] All provided Unit Inventory items are accounted for
|
|
354
|
+
|
|
394
355
|
## Acceptance Criteria Creation Guidelines
|
|
395
356
|
|
|
396
357
|
**Principle**: Set specific, verifiable conditions in browser environment. Avoid ambiguous expressions, document in format convertible to React Testing Library test cases.
|
|
@@ -419,49 +380,41 @@ function useUserData(userId: string) {
|
|
|
419
380
|
|
|
420
381
|
**Principle**: AC = User-observable behavior in browser verifiable in isolated CI environment
|
|
421
382
|
|
|
422
|
-
## Latest Information Research
|
|
423
|
-
|
|
424
|
-
### Research Timing
|
|
425
|
-
1. **Mandatory Research**:
|
|
426
|
-
- When considering new React library/UI framework introduction
|
|
427
|
-
- When designing performance optimization (code splitting, lazy loading)
|
|
428
|
-
- When designing accessibility implementation (WCAG compliance)
|
|
429
|
-
- When React major version upgrades (e.g., React 18 → 19)
|
|
430
|
-
|
|
431
|
-
2. **Recommended Research**:
|
|
432
|
-
- Before implementing complex custom hooks
|
|
433
|
-
- When considering improvements to existing component patterns
|
|
383
|
+
## Latest Information Research
|
|
434
384
|
|
|
435
|
-
|
|
385
|
+
Use current-year queries and cite sources in a `## References` section for create/update mode.
|
|
436
386
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
**Specific Search Pattern Examples**:
|
|
440
|
-
- `React new features best practices 2025` (new feature research)
|
|
441
|
-
- `Zustand vs Redux Toolkit comparison 2025` (state management selection)
|
|
442
|
-
- `React Server Components patterns` (design patterns)
|
|
443
|
-
- `React breaking changes migration guide` (version upgrade)
|
|
444
|
-
- `Tailwind CSS accessibility best practices` (accessibility research)
|
|
445
|
-
- `[library name] official documentation` (official information)
|
|
446
|
-
|
|
447
|
-
**Citation**: Add "## References" section at end of ADR/Design Doc with URLs and descriptions
|
|
448
|
-
|
|
449
|
-
### Citation Format
|
|
450
|
-
|
|
451
|
-
Add at the end of ADR/Design Doc in the following format:
|
|
452
|
-
|
|
453
|
-
```markdown
|
|
454
|
-
## References
|
|
455
|
-
|
|
456
|
-
- [Title](URL) - Brief description of referenced content
|
|
457
|
-
- [React Official Documentation](URL) - Related design principles and features
|
|
458
|
-
- [Frontend Blog Article](URL) - Implementation patterns and best practices
|
|
459
|
-
```
|
|
387
|
+
Reverse-engineer mode skips latest-information research because it documents the existing frontend.
|
|
460
388
|
|
|
461
389
|
## Update Mode Operation
|
|
462
390
|
- **ADR**: Update existing file for minor changes, create new file for major changes
|
|
463
391
|
- **Design Doc**: Add revision section and record change history
|
|
464
392
|
|
|
393
|
+
## Reverse-Engineer Mode (As-Is Documentation)
|
|
394
|
+
|
|
395
|
+
Use this mode when documenting existing frontend architecture rather than proposing changes.
|
|
396
|
+
|
|
397
|
+
What to skip:
|
|
398
|
+
- ADR creation
|
|
399
|
+
- Option comparison
|
|
400
|
+
- Change Impact Map
|
|
401
|
+
- Implementation Approach Decision
|
|
402
|
+
- Latest Information Research
|
|
403
|
+
|
|
404
|
+
Execution steps:
|
|
405
|
+
1. Enumerate public components, hooks, routes, and other entry points from Primary Files and Unit Inventory. Record each with file:line evidence
|
|
406
|
+
2. Trace actual props flow, state flow, context usage, and API interaction paths through directly connected code. Record observed behavior with file:line evidence
|
|
407
|
+
3. Record contracts exactly as implemented:
|
|
408
|
+
- props and consumed context
|
|
409
|
+
- emitted events and side effects
|
|
410
|
+
- rendered states, loading states, and error states
|
|
411
|
+
4. Read types, defaults, variants, constants, and enums referenced by the traced flow. Record names and values exactly as written in code
|
|
412
|
+
5. Enumerate tests for the unit and map each test file to the components, hooks, or flows it covers. Record uncovered Unit Inventory items explicitly
|
|
413
|
+
|
|
414
|
+
Completion rule for reverse-engineer mode:
|
|
415
|
+
- Every Unit Inventory route or public export is accounted for in the Design Doc
|
|
416
|
+
- Every claim about component structure, props flow, state flow, API interaction, or error handling cites file:line evidence
|
|
417
|
+
|
|
465
418
|
## Completion Gate [BLOCKING]
|
|
466
419
|
|
|
467
420
|
☐ All completion criteria met with evidence
|
|
@@ -123,28 +123,24 @@ When the design introduces or significantly modifies data structures:
|
|
|
123
123
|
- 3+ criteria fail → New structure justified
|
|
124
124
|
- Record decision and rationale in Design Doc
|
|
125
125
|
|
|
126
|
-
### Integration
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
3. **Reflection in Design Doc**
|
|
145
|
-
- Create "## Integration Point Map" section
|
|
146
|
-
- Clarify responsibilities and boundaries at each integration point
|
|
147
|
-
- Define error behavior at design phase
|
|
126
|
+
### Integration Points【Important】
|
|
127
|
+
Document all integration points with existing systems in a "## Integration Point Map" section.
|
|
128
|
+
|
|
129
|
+
For each integration point, record:
|
|
130
|
+
- Existing component and method
|
|
131
|
+
- Integration method
|
|
132
|
+
- Impact level
|
|
133
|
+
- Required test coverage
|
|
134
|
+
|
|
135
|
+
Impact level criteria:
|
|
136
|
+
- High: modifies or extends an existing process flow
|
|
137
|
+
- Medium: reuses or updates existing data or contracts
|
|
138
|
+
- Low: read-only interaction, observation, or non-invasive integration
|
|
139
|
+
|
|
140
|
+
For each integration boundary, define:
|
|
141
|
+
- Input
|
|
142
|
+
- Output
|
|
143
|
+
- On Error
|
|
148
144
|
|
|
149
145
|
### Agreement Checklist【Most Important】
|
|
150
146
|
Must be performed at the beginning of Design Doc creation:
|
|
@@ -213,32 +209,20 @@ Perform before Design Doc creation:
|
|
|
213
209
|
|
|
214
210
|
Common ADR needed when: Technical decisions common to multiple components
|
|
215
211
|
|
|
216
|
-
### Integration Point Specification
|
|
217
|
-
Document integration points with existing system (location, old implementation, new implementation, switching method).
|
|
218
|
-
|
|
219
212
|
### Data Contracts
|
|
220
213
|
Define input/output between components (types, preconditions, guarantees, error behavior).
|
|
221
214
|
|
|
222
215
|
### State Transitions (When Applicable)
|
|
223
216
|
Document state definitions and transitions for stateful components.
|
|
224
217
|
|
|
225
|
-
|
|
226
|
-
Define input/output, sync/async, and error handling at component boundaries in language-agnostic manner.
|
|
227
|
-
|
|
228
|
-
```yaml
|
|
229
|
-
Boundary Name: [Connection Point]
|
|
230
|
-
Input: [What is received]
|
|
231
|
-
Output: [What is returned (specify sync/async)]
|
|
232
|
-
On Error: [How to handle]
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
Confirm and document conflicts with existing systems (priority, naming conventions, etc.) to prevent integration inconsistencies.
|
|
218
|
+
Confirm and document conflicts with existing systems at each integration point to prevent inconsistencies.
|
|
236
219
|
|
|
237
220
|
## Required Information
|
|
238
221
|
|
|
239
222
|
- **Operation Mode**:
|
|
240
223
|
- `create`: New creation (default)
|
|
241
224
|
- `update`: Update existing document
|
|
225
|
+
- `reverse-engineer`: Document existing architecture as-is
|
|
242
226
|
|
|
243
227
|
- **Requirements Analysis Results**: Requirements analysis results (scale determination, technical requirements, etc.)
|
|
244
228
|
- **PRD**: PRD document (if exists)
|
|
@@ -257,40 +241,15 @@ Confirm and document conflicts with existing systems (priority, naming conventio
|
|
|
257
241
|
- Reason for changes
|
|
258
242
|
- Sections needing updates
|
|
259
243
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
244
|
+
- **Reverse-Engineer Context** (reverse-engineer mode only):
|
|
245
|
+
- Primary Files
|
|
246
|
+
- Public Interfaces
|
|
247
|
+
- Dependencies
|
|
248
|
+
- Unit Inventory (routes, test files, public exports)
|
|
263
249
|
|
|
264
|
-
|
|
265
|
-
```markdown
|
|
266
|
-
# ADR-XXXX: [Title]
|
|
267
|
-
Status: Proposed
|
|
268
|
-
|
|
269
|
-
## Background
|
|
270
|
-
[Technical challenges and constraints in 1-2 sentences]
|
|
271
|
-
|
|
272
|
-
## Options
|
|
273
|
-
### Option A: [Approach Name]
|
|
274
|
-
- Overview: [Explain in one sentence]
|
|
275
|
-
- Benefits: [2-3 items]
|
|
276
|
-
- Drawbacks: [2-3 items]
|
|
277
|
-
- Effort: X days
|
|
278
|
-
|
|
279
|
-
### Option B/C: [Document similarly]
|
|
280
|
-
|
|
281
|
-
## Comparison
|
|
282
|
-
| Evaluation Axis | Option A | Option B | Option C |
|
|
283
|
-
|-----------------|----------|----------|----------|
|
|
284
|
-
| Implementation Effort | 3 days | 5 days | 2 days |
|
|
285
|
-
| Maintainability | High | Medium | Low |
|
|
286
|
-
|
|
287
|
-
## Decision
|
|
288
|
-
Option [X] selected. Reason: [2-3 sentences including trade-offs]
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
See ADR template in documentation-criteria skill for details.
|
|
250
|
+
## Document Output Format
|
|
292
251
|
|
|
293
|
-
###
|
|
252
|
+
### Document Creation
|
|
294
253
|
- **ADR**: `docs/adr/ADR-[4-digit number]-[title].md` (e.g., ADR-0001)
|
|
295
254
|
- **Design Doc**: `docs/design/[feature-name]-design.md`
|
|
296
255
|
- Follow respective templates (`template.md`)
|
|
@@ -344,25 +303,33 @@ Implementation sample creation checklist:
|
|
|
344
303
|
- [ ] Comparison matrix completeness
|
|
345
304
|
|
|
346
305
|
### Design Doc Checklist
|
|
306
|
+
**All modes**:
|
|
307
|
+
- [ ] **Standards identification gate completed** (required)
|
|
308
|
+
- [ ] **Code inspection evidence recorded** (required)
|
|
309
|
+
- [ ] **Integration points enumerated with contracts** (required)
|
|
310
|
+
- [ ] **Data contracts clarified** (required)
|
|
311
|
+
- [ ] Architecture and data flow clearly expressed in diagrams
|
|
312
|
+
|
|
313
|
+
**Create/update mode only**:
|
|
347
314
|
- [ ] **Agreement checklist completed** (most important)
|
|
348
315
|
- [ ] **Prerequisite common ADRs referenced** (required)
|
|
349
316
|
- [ ] **Change impact map created** (required)
|
|
350
|
-
- [ ] **Integration boundary contracts defined** (required)
|
|
351
|
-
- [ ] **Integration points completely enumerated** (required)
|
|
352
|
-
- [ ] **Data contracts clarified** (required)
|
|
353
317
|
- [ ] **E2E verification procedures for each phase** (required)
|
|
354
318
|
- [ ] Response to requirements and design validity
|
|
355
319
|
- [ ] Test strategy and error handling
|
|
356
|
-
- [ ] Architecture and data flow clearly expressed in diagrams
|
|
357
320
|
- [ ] Interface change matrix completeness
|
|
358
321
|
- [ ] Implementation approach selection rationale (vertical/horizontal/hybrid)
|
|
359
322
|
- [ ] Latest best practices researched and references cited
|
|
360
323
|
- [ ] **Complexity assessment**: complexity_level set; if medium/high, complexity_rationale specifies (1) requirements/ACs, (2) constraints/risks
|
|
361
|
-
- [ ] **Standards identification gate completed** (required)
|
|
362
|
-
- [ ] **Code inspection evidence recorded** (required)
|
|
363
324
|
- [ ] **Data representation decision documented** (when new structures introduced)
|
|
364
325
|
- [ ] **Field propagation map included** (when fields cross boundaries)
|
|
365
326
|
|
|
327
|
+
**Reverse-engineer mode only**:
|
|
328
|
+
- [ ] Every architectural claim cites file:line evidence
|
|
329
|
+
- [ ] Identifiers are transcribed exactly from code
|
|
330
|
+
- [ ] Test existence is confirmed by enumeration
|
|
331
|
+
- [ ] All provided Unit Inventory items are accounted for
|
|
332
|
+
|
|
366
333
|
|
|
367
334
|
## Acceptance Criteria Creation Guidelines
|
|
368
335
|
|
|
@@ -397,53 +364,42 @@ Implementation sample creation checklist:
|
|
|
397
364
|
|
|
398
365
|
*Note: Non-functional requirements (performance, reliability, etc.) are defined in the "Non-functional Requirements" section and automatically verified by quality check tools
|
|
399
366
|
|
|
400
|
-
## Latest Information Research
|
|
401
|
-
|
|
402
|
-
### Research Timing
|
|
403
|
-
1. **Mandatory Research**:
|
|
404
|
-
- When considering new technology/library introduction
|
|
405
|
-
- When designing performance optimization
|
|
406
|
-
- When designing security-related implementation
|
|
407
|
-
- When major version upgrades of existing technology
|
|
408
|
-
|
|
409
|
-
2. **Recommended Research**:
|
|
410
|
-
- Before implementing complex algorithms
|
|
411
|
-
- When considering improvements to existing patterns
|
|
367
|
+
## Latest Information Research
|
|
412
368
|
|
|
413
|
-
|
|
369
|
+
Use current-year queries and cite sources in a `## References` section for create/update mode.
|
|
414
370
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
**Specific Search Pattern Examples**:
|
|
418
|
-
To get latest information, always check current year before searching:
|
|
419
|
-
```bash
|
|
420
|
-
date +%Y # e.g., 2025
|
|
421
|
-
```
|
|
422
|
-
Include this year in search queries:
|
|
423
|
-
- `[technology] [feature] best practices {current_year}` (new feature research)
|
|
424
|
-
- `[tech A] vs [tech B] performance comparison {current_year}` (technology selection)
|
|
425
|
-
- `[architecture pattern] [concern] patterns` (design patterns)
|
|
426
|
-
- `[framework] v[X] breaking changes migration guide` (version upgrade)
|
|
427
|
-
- `[framework name] official documentation` (official docs don't need year)
|
|
428
|
-
|
|
429
|
-
**Citation**: Add "## References" section at end of ADR/Design Doc with URLs and descriptions
|
|
430
|
-
|
|
431
|
-
### Citation Format
|
|
432
|
-
|
|
433
|
-
Add at the end of ADR/Design Doc in the following format:
|
|
434
|
-
|
|
435
|
-
```markdown
|
|
436
|
-
## References
|
|
437
|
-
|
|
438
|
-
- [Title](URL) - Brief description of referenced content
|
|
439
|
-
- [Framework Official Documentation](URL) - Related design principles and features
|
|
440
|
-
- [Technical Blog Article](URL) - Implementation patterns and best practices
|
|
441
|
-
```
|
|
371
|
+
Reverse-engineer mode skips latest-information research because it documents what exists.
|
|
442
372
|
|
|
443
373
|
## Update Mode Operation
|
|
444
374
|
- **ADR**: Update existing file for minor changes, create new file for major changes
|
|
445
375
|
- **Design Doc**: Add revision section and record change history
|
|
446
376
|
|
|
377
|
+
## Reverse-Engineer Mode (As-Is Documentation)
|
|
378
|
+
|
|
379
|
+
Use this mode when documenting existing architecture rather than proposing changes.
|
|
380
|
+
|
|
381
|
+
What to skip:
|
|
382
|
+
- ADR creation
|
|
383
|
+
- Option comparison
|
|
384
|
+
- Change Impact Map
|
|
385
|
+
- Field Propagation Map
|
|
386
|
+
- Implementation Approach Decision
|
|
387
|
+
- Latest Information Research
|
|
388
|
+
|
|
389
|
+
Execution steps:
|
|
390
|
+
1. Enumerate entry points from Primary Files and Unit Inventory. Record each public handler, command, or exported interface with file:line evidence
|
|
391
|
+
2. Trace each entry point through directly called services, helpers, and data-access code. Record actual data flow and error handling with file:line evidence
|
|
392
|
+
3. Record contracts exactly as implemented:
|
|
393
|
+
- inputs and parameters
|
|
394
|
+
- outputs and response shapes
|
|
395
|
+
- middleware, guards, and integration boundaries
|
|
396
|
+
4. Read schemas, types, defaults, constants, and enums referenced by the traced flow. Record names and values exactly as written in code
|
|
397
|
+
5. Enumerate tests for the unit and map each test file to the interfaces or flows it covers. Record uncovered Unit Inventory items explicitly
|
|
398
|
+
|
|
399
|
+
Completion rule for reverse-engineer mode:
|
|
400
|
+
- Every Unit Inventory route or public export is accounted for in the Design Doc
|
|
401
|
+
- Every claim about architecture, data flow, public contracts, integrations, or error handling cites file:line evidence
|
|
402
|
+
|
|
447
403
|
## Completion Gate [BLOCKING]
|
|
448
404
|
|
|
449
405
|
☐ All completion criteria met with evidence
|
|
@@ -46,13 +46,6 @@ Skill Status:
|
|
|
46
46
|
This agent outputs **investigation result verification and conclusion derivation only**.
|
|
47
47
|
Solution derivation is out of scope for this agent.
|
|
48
48
|
|
|
49
|
-
## Core Responsibilities
|
|
50
|
-
|
|
51
|
-
1. **Triangulation Supplementation** - Explore information sources not covered in the investigation to supplement results
|
|
52
|
-
2. **ACH (Analysis of Competing Hypotheses)** - Generate alternative hypotheses beyond those listed in the investigation and evaluate consistency with evidence
|
|
53
|
-
3. **Devil's Advocate** - Assume "the investigation results are wrong" and actively seek refutation
|
|
54
|
-
4. **Conclusion Derivation** - Adopt unrefuted hypotheses as causes and determine relationship when multiple
|
|
55
|
-
|
|
56
49
|
## Execution Steps
|
|
57
50
|
|
|
58
51
|
### Step 1: Investigation Results Verification Preparation
|
|
@@ -71,11 +64,11 @@ Solution derivation is out of scope for this agent.
|
|
|
71
64
|
- Verify logical validity of impactAnalysis (without additional searches)
|
|
72
65
|
|
|
73
66
|
### Step 2: Triangulation Supplementation
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
Identify which source types are missing from `investigationSources`, then investigate at least one uncovered source type.
|
|
68
|
+
|
|
69
|
+
If all source types were already covered, investigate a different code area or configuration path than the original investigation.
|
|
70
|
+
|
|
71
|
+
Record each supplementary finding and its impact on the existing hypotheses.
|
|
79
72
|
|
|
80
73
|
### Step 3: External Information Reinforcement (web search)
|
|
81
74
|
- Official information about hypotheses found in investigation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-workflows",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Task-oriented agentic coding framework for OpenAI Codex CLI — skills, recipes, and subagents for structured development workflows",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Shinsuke Kagawa",
|