create-ai-project 1.13.1 → 1.14.0
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/.claude/agents-en/code-verifier.md +192 -0
- package/.claude/agents-en/document-reviewer.md +146 -35
- package/.claude/agents-en/prd-creator.md +37 -14
- package/.claude/agents-en/scope-discoverer.md +229 -0
- package/.claude/agents-ja/code-verifier.md +192 -0
- package/.claude/agents-ja/document-reviewer.md +158 -43
- package/.claude/agents-ja/prd-creator.md +45 -15
- package/.claude/agents-ja/scope-discoverer.md +229 -0
- package/.claude/commands-en/reverse-engineer.md +301 -0
- package/.claude/commands-ja/reverse-engineer.md +301 -0
- package/README.ja.md +28 -1
- package/README.md +27 -1
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reverse-engineer
|
|
3
|
+
description: Generate PRD and Design Docs from existing codebase through discovery, generation, verification, and review workflow
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
**Command Context**: Reverse engineering workflow to create documentation from existing code
|
|
7
|
+
|
|
8
|
+
Target: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
**TodoWrite**: Register phases first, then steps within each phase as you enter it.
|
|
11
|
+
|
|
12
|
+
## Step 0: Initial Configuration
|
|
13
|
+
|
|
14
|
+
### 0.1 Scope Confirmation
|
|
15
|
+
|
|
16
|
+
Use AskUserQuestion to confirm:
|
|
17
|
+
1. **Target path**: Which directory/module to document
|
|
18
|
+
2. **Depth**: PRD only, or PRD + Design Docs
|
|
19
|
+
3. **Reference Architecture**: layered / mvc / clean / hexagonal / none
|
|
20
|
+
4. **Human review**: Yes (recommended) / No (fully autonomous)
|
|
21
|
+
|
|
22
|
+
### 0.2 Output Configuration
|
|
23
|
+
|
|
24
|
+
- PRD output: `docs/prd/` or existing PRD directory
|
|
25
|
+
- Design Doc output: `docs/design/` or existing design directory
|
|
26
|
+
- Verify directories exist, create if needed
|
|
27
|
+
|
|
28
|
+
## Workflow Overview
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Phase 1: PRD Generation
|
|
32
|
+
Step 1: Scope Discovery (all units)
|
|
33
|
+
Step 2-5: Per-unit loop (Generation → Verification → Review → Revision)
|
|
34
|
+
|
|
35
|
+
Phase 2: Design Doc Generation (if requested)
|
|
36
|
+
Step 6: Scope Discovery (all components per PRD)
|
|
37
|
+
Step 7-10: Per-component loop (Generation → Verification → Review → Revision)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Context Passing**: Pass structured JSON output between steps. Use `$STEP_N_OUTPUT` placeholder notation.
|
|
41
|
+
|
|
42
|
+
## Phase 1: PRD Generation
|
|
43
|
+
|
|
44
|
+
**Register in TodoWrite**:
|
|
45
|
+
- Step 1: PRD Scope Discovery
|
|
46
|
+
- Per-unit processing (Steps 2-5 for each unit)
|
|
47
|
+
|
|
48
|
+
### Step 1: PRD Scope Discovery
|
|
49
|
+
|
|
50
|
+
**Task invocation**:
|
|
51
|
+
```
|
|
52
|
+
subagent_type: scope-discoverer
|
|
53
|
+
prompt: |
|
|
54
|
+
Discover PRD targets in the codebase.
|
|
55
|
+
|
|
56
|
+
scope_type: prd
|
|
57
|
+
target_path: $USER_TARGET_PATH
|
|
58
|
+
reference_architecture: $USER_RA_CHOICE
|
|
59
|
+
focus_area: $USER_FOCUS_AREA (if specified)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Store output as**: `$STEP_1_OUTPUT`
|
|
63
|
+
|
|
64
|
+
**Quality Gate**:
|
|
65
|
+
- At least one PRD unit discovered → proceed
|
|
66
|
+
- No units discovered → ask user for hints
|
|
67
|
+
|
|
68
|
+
**Human Review Point** (if enabled): Present discovered units for confirmation.
|
|
69
|
+
|
|
70
|
+
### Step 2-5: Per-Unit Processing
|
|
71
|
+
|
|
72
|
+
**Complete Steps 2→3→4→5 for each unit before proceeding to the next unit.**
|
|
73
|
+
|
|
74
|
+
#### Step 2: PRD Generation
|
|
75
|
+
|
|
76
|
+
**Task invocation**:
|
|
77
|
+
```
|
|
78
|
+
subagent_type: prd-creator
|
|
79
|
+
prompt: |
|
|
80
|
+
Create reverse-engineered PRD for the following feature.
|
|
81
|
+
|
|
82
|
+
Operation Mode: reverse-engineer
|
|
83
|
+
External Scope Provided: true
|
|
84
|
+
|
|
85
|
+
Feature: $UNIT_NAME (from $STEP_1_OUTPUT)
|
|
86
|
+
Description: $UNIT_DESCRIPTION
|
|
87
|
+
Related Files: $UNIT_RELATED_FILES
|
|
88
|
+
Entry Points: $UNIT_ENTRY_POINTS
|
|
89
|
+
|
|
90
|
+
Skip independent scope discovery. Use provided scope data.
|
|
91
|
+
Create final version PRD based on code investigation within specified scope.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Store output as**: `$STEP_2_OUTPUT` (PRD path)
|
|
95
|
+
|
|
96
|
+
#### Step 3: Code Verification
|
|
97
|
+
|
|
98
|
+
**Task invocation**:
|
|
99
|
+
```
|
|
100
|
+
subagent_type: code-verifier
|
|
101
|
+
prompt: |
|
|
102
|
+
Verify consistency between PRD and code implementation.
|
|
103
|
+
|
|
104
|
+
doc_type: prd
|
|
105
|
+
document_path: $STEP_2_OUTPUT
|
|
106
|
+
code_paths: $UNIT_RELATED_FILES (from $STEP_1_OUTPUT)
|
|
107
|
+
verbose: false
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Store output as**: `$STEP_3_OUTPUT`
|
|
111
|
+
|
|
112
|
+
**Quality Gate**:
|
|
113
|
+
- consistencyScore >= 70 → proceed to review
|
|
114
|
+
- consistencyScore < 70 → flag for detailed review
|
|
115
|
+
|
|
116
|
+
#### Step 4: Review
|
|
117
|
+
|
|
118
|
+
**Required Input**: $STEP_3_OUTPUT (verification JSON from Step 3)
|
|
119
|
+
|
|
120
|
+
**Task invocation**:
|
|
121
|
+
```
|
|
122
|
+
subagent_type: document-reviewer
|
|
123
|
+
prompt: |
|
|
124
|
+
Review the following PRD considering code verification findings.
|
|
125
|
+
|
|
126
|
+
doc_type: PRD
|
|
127
|
+
target: $STEP_2_OUTPUT
|
|
128
|
+
mode: composite
|
|
129
|
+
|
|
130
|
+
## Code Verification Results
|
|
131
|
+
$STEP_3_OUTPUT
|
|
132
|
+
|
|
133
|
+
## Additional Review Focus
|
|
134
|
+
- Alignment between PRD claims and verification evidence
|
|
135
|
+
- Resolution recommendations for each discrepancy
|
|
136
|
+
- Completeness of undocumented feature coverage
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Store output as**: `$STEP_4_OUTPUT`
|
|
140
|
+
|
|
141
|
+
#### Step 5: Revision (conditional)
|
|
142
|
+
|
|
143
|
+
**Trigger Conditions** (any one of the following):
|
|
144
|
+
- Review status is "Needs Revision" or "Rejected"
|
|
145
|
+
- Critical discrepancies exist in `$STEP_3_OUTPUT`
|
|
146
|
+
- consistencyScore < 70
|
|
147
|
+
|
|
148
|
+
**Task invocation**:
|
|
149
|
+
```
|
|
150
|
+
subagent_type: prd-creator
|
|
151
|
+
prompt: |
|
|
152
|
+
Update PRD based on review feedback.
|
|
153
|
+
|
|
154
|
+
Operation Mode: update
|
|
155
|
+
Existing PRD: $STEP_2_OUTPUT
|
|
156
|
+
|
|
157
|
+
## Review Feedback
|
|
158
|
+
$STEP_4_OUTPUT
|
|
159
|
+
|
|
160
|
+
## Discrepancies to Address
|
|
161
|
+
(Extract critical and major discrepancies from $STEP_3_OUTPUT)
|
|
162
|
+
|
|
163
|
+
Apply corrections and improvements.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Loop Control**: Maximum 2 revision cycles. After 2 cycles, flag for human review regardless of status.
|
|
167
|
+
|
|
168
|
+
#### Unit Completion
|
|
169
|
+
|
|
170
|
+
- [ ] Review status is "Approved" or "Approved with Conditions"
|
|
171
|
+
- [ ] Human review passed (if enabled in Step 0)
|
|
172
|
+
|
|
173
|
+
**Next**: Proceed to next unit. After all units → Phase 2.
|
|
174
|
+
|
|
175
|
+
## Phase 2: Design Doc Generation
|
|
176
|
+
|
|
177
|
+
*Execute only if Design Docs were requested in Step 0*
|
|
178
|
+
|
|
179
|
+
**Register in TodoWrite**:
|
|
180
|
+
- Step 6: Design Doc Scope Discovery
|
|
181
|
+
- Per-component processing (Steps 7-10 for each component)
|
|
182
|
+
|
|
183
|
+
### Step 6: Design Doc Scope Discovery
|
|
184
|
+
|
|
185
|
+
For each approved PRD:
|
|
186
|
+
|
|
187
|
+
**Task invocation**:
|
|
188
|
+
```
|
|
189
|
+
subagent_type: scope-discoverer
|
|
190
|
+
prompt: |
|
|
191
|
+
Discover Design Doc targets within PRD scope.
|
|
192
|
+
|
|
193
|
+
scope_type: design-doc
|
|
194
|
+
existing_prd: $APPROVED_PRD_PATH
|
|
195
|
+
target_path: $PRD_RELATED_PATHS
|
|
196
|
+
reference_architecture: $USER_RA_CHOICE
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Store output as**: `$STEP_6_OUTPUT`
|
|
200
|
+
|
|
201
|
+
**Quality Gate**:
|
|
202
|
+
- At least one component discovered → proceed
|
|
203
|
+
- No components → ask user for hints
|
|
204
|
+
|
|
205
|
+
### Step 7-10: Per-Component Processing
|
|
206
|
+
|
|
207
|
+
**Complete Steps 7→8→9→10 for each component before proceeding to the next component.**
|
|
208
|
+
|
|
209
|
+
#### Step 7: Design Doc Generation
|
|
210
|
+
|
|
211
|
+
**Task invocation**:
|
|
212
|
+
```
|
|
213
|
+
subagent_type: technical-designer
|
|
214
|
+
prompt: |
|
|
215
|
+
Create Design Doc for the following component based on existing code.
|
|
216
|
+
|
|
217
|
+
Operation Mode: create
|
|
218
|
+
|
|
219
|
+
Component: $COMPONENT_NAME (from $STEP_6_OUTPUT)
|
|
220
|
+
Responsibility: $COMPONENT_RESPONSIBILITY
|
|
221
|
+
Primary Files: $COMPONENT_PRIMARY_FILES
|
|
222
|
+
Public Interfaces: $COMPONENT_PUBLIC_INTERFACES
|
|
223
|
+
Dependencies: $COMPONENT_DEPENDENCIES
|
|
224
|
+
|
|
225
|
+
Parent PRD: $APPROVED_PRD_PATH
|
|
226
|
+
|
|
227
|
+
Document current architecture. Do not propose changes.
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Store output as**: `$STEP_7_OUTPUT`
|
|
231
|
+
|
|
232
|
+
#### Step 8: Code Verification
|
|
233
|
+
|
|
234
|
+
**Task invocation**:
|
|
235
|
+
```
|
|
236
|
+
subagent_type: code-verifier
|
|
237
|
+
prompt: |
|
|
238
|
+
Verify consistency between Design Doc and code implementation.
|
|
239
|
+
|
|
240
|
+
doc_type: design-doc
|
|
241
|
+
document_path: $STEP_7_OUTPUT
|
|
242
|
+
code_paths: $COMPONENT_PRIMARY_FILES
|
|
243
|
+
verbose: false
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Store output as**: `$STEP_8_OUTPUT`
|
|
247
|
+
|
|
248
|
+
#### Step 9: Review
|
|
249
|
+
|
|
250
|
+
**Required Input**: $STEP_8_OUTPUT (verification JSON from Step 8)
|
|
251
|
+
|
|
252
|
+
**Task invocation**:
|
|
253
|
+
```
|
|
254
|
+
subagent_type: document-reviewer
|
|
255
|
+
prompt: |
|
|
256
|
+
Review the following Design Doc considering code verification findings.
|
|
257
|
+
|
|
258
|
+
doc_type: DesignDoc
|
|
259
|
+
target: $STEP_7_OUTPUT
|
|
260
|
+
mode: composite
|
|
261
|
+
|
|
262
|
+
## Code Verification Results
|
|
263
|
+
$STEP_8_OUTPUT
|
|
264
|
+
|
|
265
|
+
## Parent PRD
|
|
266
|
+
$APPROVED_PRD_PATH
|
|
267
|
+
|
|
268
|
+
## Additional Review Focus
|
|
269
|
+
- Technical accuracy of documented interfaces
|
|
270
|
+
- Consistency with parent PRD scope
|
|
271
|
+
- Completeness of component boundary definitions
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Store output as**: `$STEP_9_OUTPUT`
|
|
275
|
+
|
|
276
|
+
#### Step 10: Revision (conditional)
|
|
277
|
+
|
|
278
|
+
Same logic as Step 5, using technical-designer with update mode.
|
|
279
|
+
|
|
280
|
+
#### Component Completion
|
|
281
|
+
|
|
282
|
+
- [ ] Review status is "Approved" or "Approved with Conditions"
|
|
283
|
+
- [ ] Human review passed (if enabled in Step 0)
|
|
284
|
+
|
|
285
|
+
**Next**: Proceed to next component. After all components → Final Report.
|
|
286
|
+
|
|
287
|
+
## Final Report
|
|
288
|
+
|
|
289
|
+
Output summary including:
|
|
290
|
+
- Generated documents table (Type, Name, Consistency Score, Review Status)
|
|
291
|
+
- Action items (critical discrepancies, undocumented features, flagged items)
|
|
292
|
+
- Next steps checklist
|
|
293
|
+
|
|
294
|
+
## Error Handling
|
|
295
|
+
|
|
296
|
+
| Error | Action |
|
|
297
|
+
|-------|--------|
|
|
298
|
+
| Discovery finds nothing | Ask user for project structure hints |
|
|
299
|
+
| Generation fails | Log failure, continue with other units, report in summary |
|
|
300
|
+
| consistencyScore < 50 | Flag for mandatory human review, do not auto-approve |
|
|
301
|
+
| Review rejects after 2 revisions | Stop loop, flag for human intervention |
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reverse-engineer
|
|
3
|
+
description: 既存コードベースからPRDとDesign Docを生成するリバースエンジニアリングワークフロー
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
**コマンドコンテキスト**: 既存コードからドキュメントを作成するリバースエンジニアリングワークフロー
|
|
7
|
+
|
|
8
|
+
対象: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
**TodoWrite登録**: まずフェーズをTodoWriteに登録し、各フェーズ開始時に詳細ステップを追加登録する。
|
|
11
|
+
|
|
12
|
+
## ステップ0: 初期設定
|
|
13
|
+
|
|
14
|
+
### 0.1 スコープ確認
|
|
15
|
+
|
|
16
|
+
AskUserQuestionで以下を確認:
|
|
17
|
+
1. **対象パス**: どのディレクトリ/モジュールをドキュメント化するか
|
|
18
|
+
2. **深度**: PRDのみ、またはPRD + Design Doc
|
|
19
|
+
3. **参照アーキテクチャ**: layered / mvc / clean / hexagonal / none
|
|
20
|
+
4. **人間レビュー**: あり(推奨) / なし(自律実行)
|
|
21
|
+
|
|
22
|
+
### 0.2 出力設定
|
|
23
|
+
|
|
24
|
+
- PRD出力先: `docs/prd/` または既存PRDディレクトリ
|
|
25
|
+
- Design Doc出力先: `docs/design/` または既存Design Docディレクトリ
|
|
26
|
+
- ディレクトリの存在確認、必要に応じて作成
|
|
27
|
+
|
|
28
|
+
## ワークフロー概要
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
フェーズ1: PRD生成
|
|
32
|
+
ステップ1: スコープ発見(全ユニット)
|
|
33
|
+
ステップ2-5: ユニット毎ループ(生成 → 検証 → レビュー → 修正)
|
|
34
|
+
|
|
35
|
+
フェーズ2: Design Doc生成(要求された場合)
|
|
36
|
+
ステップ6: スコープ発見(PRD毎の全component)
|
|
37
|
+
ステップ7-10: component毎ループ(生成 → 検証 → レビュー → 修正)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**コンテキスト受け渡し**: ステップ間で構造化JSON出力を受け渡す。`$STEP_N_OUTPUT`プレースホルダー記法を使用。
|
|
41
|
+
|
|
42
|
+
## フェーズ1: PRD生成
|
|
43
|
+
|
|
44
|
+
**TodoWrite登録**:
|
|
45
|
+
- ステップ1: PRDスコープ発見
|
|
46
|
+
- ユニット毎の処理(各ユニットに対してステップ2-5)
|
|
47
|
+
|
|
48
|
+
### ステップ1: PRDスコープ発見
|
|
49
|
+
|
|
50
|
+
**Task呼び出し**:
|
|
51
|
+
```
|
|
52
|
+
subagent_type: scope-discoverer
|
|
53
|
+
prompt: |
|
|
54
|
+
コードベースからPRD対象を発見する。
|
|
55
|
+
|
|
56
|
+
scope_type: prd
|
|
57
|
+
target_path: $USER_TARGET_PATH
|
|
58
|
+
reference_architecture: $USER_RA_CHOICE
|
|
59
|
+
focus_area: $USER_FOCUS_AREA (指定時)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**出力を保存**: `$STEP_1_OUTPUT`
|
|
63
|
+
|
|
64
|
+
**品質ゲート**:
|
|
65
|
+
- 1つ以上のPRDユニットが発見された → 続行
|
|
66
|
+
- ユニットが発見されない → ユーザーにヒントを求める
|
|
67
|
+
|
|
68
|
+
**人間レビューポイント**(有効時): 発見されたユニットを確認用に提示。
|
|
69
|
+
|
|
70
|
+
### ステップ2-5: ユニット毎の処理
|
|
71
|
+
|
|
72
|
+
**各ユニットについてステップ2→3→4→5を完了してから次のユニットへ進む。**
|
|
73
|
+
|
|
74
|
+
#### ステップ2: PRD生成
|
|
75
|
+
|
|
76
|
+
**Task呼び出し**:
|
|
77
|
+
```
|
|
78
|
+
subagent_type: prd-creator
|
|
79
|
+
prompt: |
|
|
80
|
+
以下の機能のリバースエンジニアリングPRDを作成する。
|
|
81
|
+
|
|
82
|
+
動作モード: reverse-engineer
|
|
83
|
+
External Scope Provided: true
|
|
84
|
+
|
|
85
|
+
機能: $UNIT_NAME ($STEP_1_OUTPUTより)
|
|
86
|
+
説明: $UNIT_DESCRIPTION
|
|
87
|
+
関連ファイル: $UNIT_RELATED_FILES
|
|
88
|
+
エントリーポイント: $UNIT_ENTRY_POINTS
|
|
89
|
+
|
|
90
|
+
独自のスコープ発見をスキップ。提供されたスコープデータを使用。
|
|
91
|
+
指定スコープ内でのコード調査に基づき最終版PRDを作成。
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**出力を保存**: `$STEP_2_OUTPUT`(PRDパス)
|
|
95
|
+
|
|
96
|
+
#### ステップ3: コード検証
|
|
97
|
+
|
|
98
|
+
**Task呼び出し**:
|
|
99
|
+
```
|
|
100
|
+
subagent_type: code-verifier
|
|
101
|
+
prompt: |
|
|
102
|
+
PRDとコード実装の整合性を検証する。
|
|
103
|
+
|
|
104
|
+
doc_type: prd
|
|
105
|
+
document_path: $STEP_2_OUTPUT
|
|
106
|
+
code_paths: $UNIT_RELATED_FILES ($STEP_1_OUTPUTより)
|
|
107
|
+
verbose: false
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**出力を保存**: `$STEP_3_OUTPUT`
|
|
111
|
+
|
|
112
|
+
**品質ゲート**:
|
|
113
|
+
- consistencyScore >= 70 → レビューへ進む
|
|
114
|
+
- consistencyScore < 70 → 詳細レビュー用にフラグ
|
|
115
|
+
|
|
116
|
+
#### ステップ4: レビュー
|
|
117
|
+
|
|
118
|
+
**必須入力**: $STEP_3_OUTPUT(ステップ3からの検証JSON)
|
|
119
|
+
|
|
120
|
+
**Task呼び出し**:
|
|
121
|
+
```
|
|
122
|
+
subagent_type: document-reviewer
|
|
123
|
+
prompt: |
|
|
124
|
+
コード検証結果を考慮してPRDをレビューする。
|
|
125
|
+
|
|
126
|
+
doc_type: PRD
|
|
127
|
+
target: $STEP_2_OUTPUT
|
|
128
|
+
mode: composite
|
|
129
|
+
|
|
130
|
+
## コード検証結果
|
|
131
|
+
$STEP_3_OUTPUT
|
|
132
|
+
|
|
133
|
+
## 追加レビュー観点
|
|
134
|
+
- PRD主張と検証evidenceの整合性
|
|
135
|
+
- 各不整合に対する解決推奨
|
|
136
|
+
- 未ドキュメント機能カバレッジの完全性
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**出力を保存**: `$STEP_4_OUTPUT`
|
|
140
|
+
|
|
141
|
+
#### ステップ5: 修正(条件付き)
|
|
142
|
+
|
|
143
|
+
**トリガー条件**(以下のいずれか):
|
|
144
|
+
- レビューステータスが「Needs Revision」または「Rejected」
|
|
145
|
+
- `$STEP_3_OUTPUT`にクリティカルな不整合が存在
|
|
146
|
+
- consistencyScore < 70
|
|
147
|
+
|
|
148
|
+
**Task呼び出し**:
|
|
149
|
+
```
|
|
150
|
+
subagent_type: prd-creator
|
|
151
|
+
prompt: |
|
|
152
|
+
レビューフィードバックに基づきPRDを更新する。
|
|
153
|
+
|
|
154
|
+
動作モード: update
|
|
155
|
+
既存PRD: $STEP_2_OUTPUT
|
|
156
|
+
|
|
157
|
+
## レビューフィードバック
|
|
158
|
+
$STEP_4_OUTPUT
|
|
159
|
+
|
|
160
|
+
## 対処すべき不整合
|
|
161
|
+
($STEP_3_OUTPUTからcriticalとmajorの不整合を抽出)
|
|
162
|
+
|
|
163
|
+
修正と改善を適用する。
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**ループ制御**: 最大2回の修正サイクル。2サイクル後はステータスに関わらず人間レビュー用にフラグ。
|
|
167
|
+
|
|
168
|
+
#### ユニット完了
|
|
169
|
+
|
|
170
|
+
- [ ] レビューステータスが「Approved」または「Approved with Conditions」
|
|
171
|
+
- [ ] 人間レビュー通過(ステップ0で有効化時)
|
|
172
|
+
|
|
173
|
+
**次へ**: 次のユニットへ進む。全ユニット完了後 → フェーズ2。
|
|
174
|
+
|
|
175
|
+
## フェーズ2: Design Doc生成
|
|
176
|
+
|
|
177
|
+
*ステップ0でDesign Docが要求された場合のみ実行*
|
|
178
|
+
|
|
179
|
+
**TodoWrite登録**:
|
|
180
|
+
- ステップ6: Design Docスコープ発見
|
|
181
|
+
- component毎の処理(各componentに対してステップ7-10)
|
|
182
|
+
|
|
183
|
+
### ステップ6: Design Docスコープ発見
|
|
184
|
+
|
|
185
|
+
承認済みPRD毎に:
|
|
186
|
+
|
|
187
|
+
**Task呼び出し**:
|
|
188
|
+
```
|
|
189
|
+
subagent_type: scope-discoverer
|
|
190
|
+
prompt: |
|
|
191
|
+
PRDスコープ内でDesign Doc対象を発見する。
|
|
192
|
+
|
|
193
|
+
scope_type: design-doc
|
|
194
|
+
existing_prd: $APPROVED_PRD_PATH
|
|
195
|
+
target_path: $PRD_RELATED_PATHS
|
|
196
|
+
reference_architecture: $USER_RA_CHOICE
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**出力を保存**: `$STEP_6_OUTPUT`
|
|
200
|
+
|
|
201
|
+
**品質ゲート**:
|
|
202
|
+
- 1つ以上のcomponentが発見された → 続行
|
|
203
|
+
- componentなし → ユーザーにヒントを求める
|
|
204
|
+
|
|
205
|
+
### ステップ7-10: component毎の処理
|
|
206
|
+
|
|
207
|
+
**各componentについてステップ7→8→9→10を完了してから次のcomponentへ進む。**
|
|
208
|
+
|
|
209
|
+
#### ステップ7: Design Doc生成
|
|
210
|
+
|
|
211
|
+
**Task呼び出し**:
|
|
212
|
+
```
|
|
213
|
+
subagent_type: technical-designer
|
|
214
|
+
prompt: |
|
|
215
|
+
既存コードに基づき以下のcomponentのDesign Docを作成する。
|
|
216
|
+
|
|
217
|
+
動作モード: create
|
|
218
|
+
|
|
219
|
+
component: $COMPONENT_NAME ($STEP_6_OUTPUTより)
|
|
220
|
+
責務: $COMPONENT_RESPONSIBILITY
|
|
221
|
+
主要ファイル: $COMPONENT_PRIMARY_FILES
|
|
222
|
+
public interface: $COMPONENT_PUBLIC_INTERFACES
|
|
223
|
+
依存関係: $COMPONENT_DEPENDENCIES
|
|
224
|
+
|
|
225
|
+
親PRD: $APPROVED_PRD_PATH
|
|
226
|
+
|
|
227
|
+
現在のアーキテクチャをドキュメント化する。変更提案は行わない。
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**出力を保存**: `$STEP_7_OUTPUT`
|
|
231
|
+
|
|
232
|
+
#### ステップ8: コード検証
|
|
233
|
+
|
|
234
|
+
**Task呼び出し**:
|
|
235
|
+
```
|
|
236
|
+
subagent_type: code-verifier
|
|
237
|
+
prompt: |
|
|
238
|
+
Design Docとコード実装の整合性を検証する。
|
|
239
|
+
|
|
240
|
+
doc_type: design-doc
|
|
241
|
+
document_path: $STEP_7_OUTPUT
|
|
242
|
+
code_paths: $COMPONENT_PRIMARY_FILES
|
|
243
|
+
verbose: false
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**出力を保存**: `$STEP_8_OUTPUT`
|
|
247
|
+
|
|
248
|
+
#### ステップ9: レビュー
|
|
249
|
+
|
|
250
|
+
**必須入力**: $STEP_8_OUTPUT(ステップ8からの検証JSON)
|
|
251
|
+
|
|
252
|
+
**Task呼び出し**:
|
|
253
|
+
```
|
|
254
|
+
subagent_type: document-reviewer
|
|
255
|
+
prompt: |
|
|
256
|
+
コード検証結果を考慮してDesign Docをレビューする。
|
|
257
|
+
|
|
258
|
+
doc_type: DesignDoc
|
|
259
|
+
target: $STEP_7_OUTPUT
|
|
260
|
+
mode: composite
|
|
261
|
+
|
|
262
|
+
## コード検証結果
|
|
263
|
+
$STEP_8_OUTPUT
|
|
264
|
+
|
|
265
|
+
## 親PRD
|
|
266
|
+
$APPROVED_PRD_PATH
|
|
267
|
+
|
|
268
|
+
## 追加レビュー観点
|
|
269
|
+
- ドキュメント化されたinterfaceの技術的正確性
|
|
270
|
+
- 親PRDスコープとの整合性
|
|
271
|
+
- component境界定義の完全性
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**出力を保存**: `$STEP_9_OUTPUT`
|
|
275
|
+
|
|
276
|
+
#### ステップ10: 修正(条件付き)
|
|
277
|
+
|
|
278
|
+
ステップ5と同様のロジック。updateモードでtechnical-designerを使用。
|
|
279
|
+
|
|
280
|
+
#### component完了
|
|
281
|
+
|
|
282
|
+
- [ ] レビューステータスが「Approved」または「Approved with Conditions」
|
|
283
|
+
- [ ] 人間レビュー通過(ステップ0で有効化時)
|
|
284
|
+
|
|
285
|
+
**次へ**: 次のcomponentへ進む。全component完了後 → 最終レポート。
|
|
286
|
+
|
|
287
|
+
## 最終レポート
|
|
288
|
+
|
|
289
|
+
以下を含むサマリを出力:
|
|
290
|
+
- 生成ドキュメント表(タイプ、名前、整合性スコア、レビューステータス)
|
|
291
|
+
- アクション項目(クリティカルな不整合、未ドキュメント機能、フラグ項目)
|
|
292
|
+
- 次のステップチェックリスト
|
|
293
|
+
|
|
294
|
+
## エラーハンドリング
|
|
295
|
+
|
|
296
|
+
| エラー | アクション |
|
|
297
|
+
|--------|-----------|
|
|
298
|
+
| 発見で何も見つからない | ユーザーにプロジェクト構造のヒントを求める |
|
|
299
|
+
| 生成が失敗 | 失敗をログ、他のユニットで続行、サマリで報告 |
|
|
300
|
+
| consistencyScore < 50 | 必須人間レビュー用にフラグ、自動承認しない |
|
|
301
|
+
| 2回の修正後もレビューが却下 | ループ停止、人間介入用にフラグ |
|
package/README.ja.md
CHANGED
|
@@ -128,6 +128,7 @@ Claude Codeで利用できる主要なコマンド:
|
|
|
128
128
|
| `/front-plan` | フロントエンド作業計画書を作成 | フロントエンド設計承認後 |
|
|
129
129
|
| `/front-build` | フロントエンド実装の実行 | Reactコンポーネント開発 |
|
|
130
130
|
| `/diagnose` | 根本原因分析ワークフロー | デバッグ、トラブルシューティング |
|
|
131
|
+
| `/reverse-engineer` | コードからPRD/Design Docを生成 | 既存システムのドキュメント化 |
|
|
131
132
|
|
|
132
133
|
[コマンドの詳細はこちら →](docs/guides/ja/use-cases.md)
|
|
133
134
|
|
|
@@ -139,12 +140,36 @@ graph LR
|
|
|
139
140
|
B -->|小規模| C[直接実装]
|
|
140
141
|
B -->|中規模| D[設計 → 実装]
|
|
141
142
|
B -->|大規模| E[PRD → 設計 → 実装]
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
C --> F[品質チェック → コミット]
|
|
144
145
|
D --> F
|
|
145
146
|
E --> F
|
|
146
147
|
```
|
|
147
148
|
|
|
149
|
+
### リバースエンジニアリングワークフロー
|
|
150
|
+
|
|
151
|
+
```mermaid
|
|
152
|
+
graph TB
|
|
153
|
+
subgraph フェーズ1 [フェーズ1: PRD生成]
|
|
154
|
+
A1[スコープ発見] --> A2[PRD生成]
|
|
155
|
+
A2 --> A3[コード検証]
|
|
156
|
+
A3 --> A4[レビュー]
|
|
157
|
+
A4 -->|修正要| A2
|
|
158
|
+
A4 -->|承認| A5[次のユニット]
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
subgraph フェーズ2 [フェーズ2: Design Doc生成]
|
|
162
|
+
B1[コンポーネント発見] --> B2[Design Doc生成]
|
|
163
|
+
B2 --> B3[コード検証]
|
|
164
|
+
B3 --> B4[レビュー]
|
|
165
|
+
B4 -->|修正要| B2
|
|
166
|
+
B4 -->|承認| B5[次のコンポーネント]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
A5 --> B1
|
|
170
|
+
B5 --> C[最終レポート]
|
|
171
|
+
```
|
|
172
|
+
|
|
148
173
|
### 動作の仕組み
|
|
149
174
|
|
|
150
175
|
1. **要件分析**: `/implement`コマンドがタスクの規模を判断します
|
|
@@ -254,6 +279,8 @@ A: これらのツールはコード記述の支援に特化していますが
|
|
|
254
279
|
| **investigator** | 問題調査 | `/diagnose` ステップ1 |
|
|
255
280
|
| **verifier** | 調査結果の検証 | `/diagnose` ステップ3 |
|
|
256
281
|
| **solver** | 解決策の導出 | `/diagnose` ステップ4 |
|
|
282
|
+
| **scope-discoverer** | PRD/Design Docスコープ発見 | `/reverse-engineer` ステップ1, 6 |
|
|
283
|
+
| **code-verifier** | ドキュメントとコードの整合性検証 | `/reverse-engineer` ステップ3, 8 |
|
|
257
284
|
|
|
258
285
|
[エージェントの詳細 →](.claude/agents-ja/)
|
|
259
286
|
|
package/README.md
CHANGED
|
@@ -134,6 +134,7 @@ Essential commands for Claude Code:
|
|
|
134
134
|
| `/front-plan` | Create frontend work plan | After frontend design approval |
|
|
135
135
|
| `/front-build` | Execute frontend implementation | React component development |
|
|
136
136
|
| `/diagnose` | Root cause analysis workflow | Debugging, troubleshooting |
|
|
137
|
+
| `/reverse-engineer` | Generate PRD/Design Docs from code | Legacy system documentation |
|
|
137
138
|
|
|
138
139
|
[Full command reference →](docs/guides/en/use-cases.md)
|
|
139
140
|
|
|
@@ -145,12 +146,35 @@ graph LR
|
|
|
145
146
|
B -->|Small| C[Direct Implementation]
|
|
146
147
|
B -->|Medium| D[Design → Implementation]
|
|
147
148
|
B -->|Large| E[PRD → Design → Implementation]
|
|
148
|
-
|
|
149
|
+
|
|
149
150
|
C --> F[Quality Check → Commit]
|
|
150
151
|
D --> F
|
|
151
152
|
E --> F
|
|
152
153
|
```
|
|
153
154
|
|
|
155
|
+
### Reverse Engineering Workflow
|
|
156
|
+
|
|
157
|
+
Generate PRD and Design Docs from existing code:
|
|
158
|
+
|
|
159
|
+
```mermaid
|
|
160
|
+
graph TB
|
|
161
|
+
subgraph Phase1[Phase 1: PRD Generation]
|
|
162
|
+
CMD[/reverse-engineer] --> SD1[scope-discoverer]
|
|
163
|
+
SD1 --> PRD[prd-creator]
|
|
164
|
+
PRD --> CV1[code-verifier]
|
|
165
|
+
CV1 --> DR1[document-reviewer]
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
subgraph Phase2[Phase 2: Design Doc Generation]
|
|
169
|
+
SD2[scope-discoverer] --> DD[technical-designer]
|
|
170
|
+
DD --> CV2[code-verifier]
|
|
171
|
+
CV2 --> DR2[document-reviewer]
|
|
172
|
+
DR2 --> DONE[Complete]
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
DR1 --> |All PRDs Approved| SD2
|
|
176
|
+
```
|
|
177
|
+
|
|
154
178
|
### How It Works
|
|
155
179
|
|
|
156
180
|
1. **Requirement Analysis**: `/implement` command analyzes task scale
|
|
@@ -260,6 +284,8 @@ A: Those help write code. This manages entire development lifecycle with special
|
|
|
260
284
|
| **investigator** | Problem investigation | `/diagnose` Step 1 |
|
|
261
285
|
| **verifier** | Investigation verification | `/diagnose` Step 3 |
|
|
262
286
|
| **solver** | Solution derivation | `/diagnose` Step 4 |
|
|
287
|
+
| **scope-discoverer** | PRD/Design Doc scope discovery | `/reverse-engineer` Step 1 |
|
|
288
|
+
| **code-verifier** | Document-code consistency | `/reverse-engineer` verification |
|
|
263
289
|
|
|
264
290
|
[Full agent list →](.claude/agents-en/)
|
|
265
291
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-project",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"packageManager": "npm@10.8.2",
|
|
5
5
|
"description": "TypeScript boilerplate with skills and sub-agents for Claude Code. Prevents context exhaustion through role-based task splitting.",
|
|
6
6
|
"keywords": [
|