codex-workflows 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 information is insufficient, do not speculate. Instead, list questions in an "Undetermined Items" section.
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: Do Not Include Implementation Phases
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
- - Skip independent scope discovery (Step 1)
187
- - Use provided scope data: Feature, Description, Related Files, Entry Points
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
- - Never document Unverified claims as facts
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 Process
218
- 1. **Investigation Phase** (skip if External Scope Provided)
219
- - Analyze all files of target feature
220
- - Understand expected behavior from test cases
221
- - Collect related documentation and comments
222
- - Fully grasp data flow and processing logic
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
- 2. **Specification Documentation**
225
- - Apply Confidence Gating to each claim
226
- - Accurately document specifications extracted from current implementation
227
- - Only describe specifications clearly readable from code
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
- 3. **Minimal Confirmation Items**
230
- - Only ask about truly undecidable important matters (maximum 3)
231
- - Only parts related to business decisions, not implementation details
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. **Boundary Validation**
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
- 6. **Saturation Check**
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
- 7. **PRD Unit Grouping** (execute only after steps 1-6 are fully complete)
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
- 8. **Return JSON Result**
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
@@ -106,7 +106,7 @@ Decompose tasks based on implementation strategy patterns determined in implemen
106
106
  - **Phase Completion Task Auto-generation (Required)**:
107
107
  - Based on "Phase X" notation in work plan, generate after each phase's final task
108
108
  - Filename: `{plan-name}-phase{number}-completion.md`
109
- - Content: Copy E2E verification procedures from Design Doc, all task completion checklist
109
+ - Content: All task completion checklist, list test skeleton file paths for verification
110
110
  - Criteria: Always generate if the plan contains the string "Phase"
111
111
 
112
112
  5. **Task Structuring**
@@ -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 Point Analysis【Important】
93
- Clarify integration points with existing components when adding new features or modifying existing ones:
94
-
95
- 1. **Identify and Document Integration Points**
96
- ```yaml
97
- ## Integration Point Map
98
- Integration Point 1:
99
- Existing Component: [Component Name/Hook Name]
100
- Integration Method: [Props passing/Context sharing/Custom Hook usage/etc]
101
- Impact Level: High (Data Flow Change) / Medium (Props Usage) / Low (Read-Only)
102
- Required Test Coverage: [Continuity Verification of Existing Components]
103
- ```
104
-
105
- 2. **Classification by Impact Level**
106
- - **High**: Modifying or extending existing data flow or state management
107
- - **Medium**: Using or updating existing component state/context
108
- - **Low**: Read-only operations, rendering additions, etc.
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
- ### Integration Boundary Contracts【Required】
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
- ## Document Output Format
238
-
239
- ### ADR Creation (Multiple Option Comparison Mode)
240
-
241
- **Basic Structure**:
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
- ## Options
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
- ### Normal Document Creation
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
- - [ ] **Component verification procedures for each phase** (required)
386
341
  - [ ] Response to requirements and design validity
387
- - [ ] Test strategy (React Testing Library) and error handling (Error Boundary)
388
- - [ ] Component hierarchy and data flow clearly expressed in diagrams
342
+ - [ ] Error handling strategy
343
+ - [ ] Acceptance criteria written in testable format: each criterion includes a measurable condition and expected outcome (verifiable by acceptance-test-generator)
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 Guidelines
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
- ### Research Method
385
+ Use current-year queries and cite sources in a `## References` section for create/update mode.
436
386
 
437
- **Required Research Timing**: New library introduction, performance optimization, accessibility design, React version upgrades
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