aiblueprint-cli 1.4.42 → 1.4.43
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-code-config/skills/apex/SKILL.md +229 -84
- package/claude-code-config/skills/apex/scripts/setup-templates.sh +6 -50
- package/claude-code-config/skills/apex/steps/step-00-init.md +33 -39
- package/claude-code-config/skills/apex/steps/step-00b-interactive.md +1 -13
- package/claude-code-config/skills/apex/steps/step-01-analyze.md +17 -36
- package/claude-code-config/skills/apex/steps/step-02-plan.md +24 -353
- package/claude-code-config/skills/apex/steps/step-03-execute.md +0 -1
- package/claude-code-config/skills/apex/steps/step-04-validate.md +26 -41
- package/claude-code-config/skills/apex/templates/00-context.md +0 -10
- package/claude-code-config/skills/apex/templates/README.md +6 -25
- package/package.json +1 -1
- package/claude-code-config/skills/apex/steps/step-00b-save.md +0 -123
- package/claude-code-config/skills/apex/steps/step-02b-tasks.md +0 -301
- package/claude-code-config/skills/apex/steps/step-03-execute-teams.md +0 -296
- package/claude-code-config/skills/apex/steps/step-05-examine.md +0 -351
- package/claude-code-config/skills/apex/steps/step-06-resolve.md +0 -238
- package/claude-code-config/skills/apex/steps/step-07-tests.md +0 -250
- package/claude-code-config/skills/apex/steps/step-08-run-tests.md +0 -308
- package/claude-code-config/skills/apex/steps/step-09-finish.md +0 -223
- package/claude-code-config/skills/apex/templates/05-examine.md +0 -10
- package/claude-code-config/skills/apex/templates/06-resolve.md +0 -10
- package/claude-code-config/skills/apex/templates/07-tests.md +0 -10
- package/claude-code-config/skills/apex/templates/08-run-tests.md +0 -10
- package/claude-code-config/skills/apex/templates/09-finish.md +0 -10
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-03-execute-teams
|
|
3
|
-
description: Execute implementation using Claude Code Agent Teams for parallel task execution
|
|
4
|
-
prev_step: steps/step-02b-tasks.md
|
|
5
|
-
next_step: steps/step-04-validate.md
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Step 3t: Execute with Agent Teams
|
|
9
|
-
|
|
10
|
-
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
11
|
-
|
|
12
|
-
- 🛑 NEVER implement code yourself - you are the TEAM LEAD
|
|
13
|
-
- 🛑 NEVER use Edit, Write tools for implementation
|
|
14
|
-
- ✅ ALWAYS delegate implementation to teammates
|
|
15
|
-
- ✅ ALWAYS use delegate mode (Shift+Tab) to stay coordination-only
|
|
16
|
-
- ✅ ALWAYS keep the team alive after tasks complete
|
|
17
|
-
- 📋 YOU ARE A COORDINATOR, not an implementer
|
|
18
|
-
- 💬 FOCUS on assigning tasks, monitoring progress, resolving blockers
|
|
19
|
-
- 🚫 FORBIDDEN to write any implementation code
|
|
20
|
-
|
|
21
|
-
## EXECUTION PROTOCOLS:
|
|
22
|
-
|
|
23
|
-
- 🎯 Create team, assign tasks, monitor completion
|
|
24
|
-
- 💾 Log progress to output (if save_mode)
|
|
25
|
-
- 📖 Each teammate gets full task context
|
|
26
|
-
- 🚫 FORBIDDEN to implement anything yourself
|
|
27
|
-
|
|
28
|
-
## CONTEXT BOUNDARIES:
|
|
29
|
-
|
|
30
|
-
- Task breakdown from step-02b is available
|
|
31
|
-
- TaskList has all tasks with dependencies
|
|
32
|
-
- You have the plan from step-02
|
|
33
|
-
- Implementation has NOT started
|
|
34
|
-
- **If context was cleared ("Execute and clear context"):** The plan file contains all APEX state variables in the "APEX Workflow Context" section. Read the plan file first and restore all variables before proceeding.
|
|
35
|
-
|
|
36
|
-
## YOUR TASK:
|
|
37
|
-
|
|
38
|
-
Coordinate a team of Claude Code agents to implement all tasks in parallel, acting purely as team lead.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
<available_state>
|
|
43
|
-
From previous steps:
|
|
44
|
-
|
|
45
|
-
| Variable | Description |
|
|
46
|
-
|----------|-------------|
|
|
47
|
-
| `{task_description}` | What to implement |
|
|
48
|
-
| `{task_id}` | Kebab-case identifier |
|
|
49
|
-
| `{auto_mode}` | Skip confirmations |
|
|
50
|
-
| `{save_mode}` | Save outputs to files |
|
|
51
|
-
| `{teams_mode}` | Should be true |
|
|
52
|
-
| `{tasks_mode}` | Should be true |
|
|
53
|
-
| `{output_dir}` | Path to output (if save_mode) |
|
|
54
|
-
| TaskList | All tasks with dependencies from step-02 |
|
|
55
|
-
| Task files | Individual task files from step-02b (if save_mode) |
|
|
56
|
-
</available_state>
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## EXECUTION SEQUENCE:
|
|
61
|
-
|
|
62
|
-
### 1. Initialize Save Output (if save_mode)
|
|
63
|
-
|
|
64
|
-
**If `{save_mode}` = true:**
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "03" "execute-teams" "in_progress"
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 2. Analyze Tasks for Team Sizing
|
|
71
|
-
|
|
72
|
-
Review TaskList and determine team size:
|
|
73
|
-
|
|
74
|
-
| Tasks | Teammates | Rationale |
|
|
75
|
-
|-------|-----------|-----------|
|
|
76
|
-
| 1-2 | 1 | Sequential is fine |
|
|
77
|
-
| 3-4 | 2 | Small parallel benefit |
|
|
78
|
-
| 5-8 | 3-4 | Good parallelism |
|
|
79
|
-
| 9+ | 4-6 | Max parallel benefit |
|
|
80
|
-
|
|
81
|
-
<critical>
|
|
82
|
-
NEVER create more than 6 teammates. Group related tasks if needed.
|
|
83
|
-
Cap at the number of independent task groups, not total tasks.
|
|
84
|
-
</critical>
|
|
85
|
-
|
|
86
|
-
### 3. Map Skills to Tasks
|
|
87
|
-
|
|
88
|
-
For each task, check if a matching skill should be suggested:
|
|
89
|
-
|
|
90
|
-
| Task Type | Suggested Skill |
|
|
91
|
-
|-----------|----------------|
|
|
92
|
-
| UI/Frontend components | `/frontend-design` |
|
|
93
|
-
| API endpoints | - |
|
|
94
|
-
| Database/schema | - |
|
|
95
|
-
| Tests | - |
|
|
96
|
-
| Documentation | - |
|
|
97
|
-
|
|
98
|
-
Add `skill_hint` to task assignments when relevant.
|
|
99
|
-
|
|
100
|
-
### 4. Use Existing Team (created in step-02-plan)
|
|
101
|
-
|
|
102
|
-
<critical>
|
|
103
|
-
IMPORTANT: Claude Code Agent Teams is an EXPERIMENTAL feature.
|
|
104
|
-
Ensure CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set in settings.json.
|
|
105
|
-
|
|
106
|
-
The team "apex-{feature_name}" was ALREADY created in step-02-plan BEFORE the TaskList.
|
|
107
|
-
Do NOT call TeamCreate again — it would reset the task list and lose all tasks.
|
|
108
|
-
</critical>
|
|
109
|
-
|
|
110
|
-
**Spawn teammates using the Task tool with `subagent_type: "implementer"`:**
|
|
111
|
-
|
|
112
|
-
<critical>
|
|
113
|
-
MANDATORY: Always use `subagent_type: "implementer"` for ALL teammates.
|
|
114
|
-
The `implementer` agent is the dedicated APEX executor — it knows how to:
|
|
115
|
-
- Claim tasks from TaskList via TaskUpdate
|
|
116
|
-
- Stay within its assigned file boundaries
|
|
117
|
-
- Report via SendMessage (not plain text)
|
|
118
|
-
- Handle shutdown requests gracefully
|
|
119
|
-
NEVER use `general-purpose` or other agent types.
|
|
120
|
-
</critical>
|
|
121
|
-
|
|
122
|
-
For each teammate, spawn via the Task tool:
|
|
123
|
-
- `subagent_type`: `"implementer"` (MANDATORY)
|
|
124
|
-
- `team_name`: `"apex-{feature_name}"`
|
|
125
|
-
- `name`: `"impl-{group-name}"` (e.g., `impl-backend`, `impl-frontend`)
|
|
126
|
-
- `mode`: `"bypassPermissions"`
|
|
127
|
-
- `prompt`: Full task context (see template below)
|
|
128
|
-
|
|
129
|
-
### 5. Spawn Teammates with Assignments
|
|
130
|
-
|
|
131
|
-
**Spawn template (one Task call per teammate):**
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
Task:
|
|
135
|
-
subagent_type: "implementer"
|
|
136
|
-
team_name: "apex-{feature_name}"
|
|
137
|
-
name: "impl-{group-name}"
|
|
138
|
-
mode: "bypassPermissions"
|
|
139
|
-
prompt: |
|
|
140
|
-
You are impl-{group-name} in team apex-{feature_name}.
|
|
141
|
-
|
|
142
|
-
## Your Assignment
|
|
143
|
-
|
|
144
|
-
**Task:** {task-id} - {task-title}
|
|
145
|
-
|
|
146
|
-
### Objective
|
|
147
|
-
{objective from task file}
|
|
148
|
-
|
|
149
|
-
### Plan
|
|
150
|
-
{implementation steps from task file}
|
|
151
|
-
|
|
152
|
-
### Files to Modify (YOUR boundary — only touch these)
|
|
153
|
-
{file list from task file}
|
|
154
|
-
|
|
155
|
-
### Acceptance Criteria
|
|
156
|
-
{criteria from task file}
|
|
157
|
-
|
|
158
|
-
### Patterns to Follow
|
|
159
|
-
{relevant patterns from step-01 analysis}
|
|
160
|
-
|
|
161
|
-
### Skill Hint
|
|
162
|
-
{skill to invoke, if applicable — e.g., "Use /frontend-design for UI components"}
|
|
163
|
-
|
|
164
|
-
### Dependencies
|
|
165
|
-
{list of completed dependencies and their outputs}
|
|
166
|
-
|
|
167
|
-
IMPORTANT: Check TaskList, claim your task, implement, then report via SendMessage.
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Spawn rules:**
|
|
171
|
-
- Spawn all INDEPENDENT teammates in PARALLEL (single message, multiple Task calls)
|
|
172
|
-
- Each teammate gets ALL context (they can't see your conversation)
|
|
173
|
-
- Use `mode: "bypassPermissions"` to avoid permission prompt interruptions
|
|
174
|
-
- As tasks with dependencies complete, spawn teammates for dependent tasks
|
|
175
|
-
- 2-4 teammates for most tasks — more adds overhead, not speed
|
|
176
|
-
|
|
177
|
-
### 6. Monitor Progress
|
|
178
|
-
|
|
179
|
-
**While tasks are running:**
|
|
180
|
-
|
|
181
|
-
Messages from teammates arrive AUTOMATICALLY — no need to poll or check periodically.
|
|
182
|
-
|
|
183
|
-
1. Wait for teammate messages (completion reports or blocker reports)
|
|
184
|
-
2. If a teammate reports a blocker:
|
|
185
|
-
- Analyze the blocker
|
|
186
|
-
- Send guidance via SendMessage
|
|
187
|
-
- If blocker requires another task's output, check TaskList for its status
|
|
188
|
-
3. If a teammate reports completion, verify via TaskList that the task is marked `completed`
|
|
189
|
-
(The `implementer` agent marks its own tasks complete — you don't need to do it)
|
|
190
|
-
4. As tasks complete, spawn teammates for newly-unblocked dependent tasks
|
|
191
|
-
|
|
192
|
-
### 7. Handle Completion
|
|
193
|
-
|
|
194
|
-
**When ALL tasks are complete:**
|
|
195
|
-
|
|
196
|
-
<critical>
|
|
197
|
-
NEVER clean up or dismiss the team here.
|
|
198
|
-
The team MUST stay alive through validation (step-04), examine (step-05), resolve (step-06), and finish (step-09).
|
|
199
|
-
Team shutdown happens ONLY in step-09-finish.md — the very last step of the APEX workflow.
|
|
200
|
-
</critical>
|
|
201
|
-
|
|
202
|
-
**If `{auto_mode}` = true:**
|
|
203
|
-
→ Proceed directly to step-04-validate.md
|
|
204
|
-
|
|
205
|
-
**If `{auto_mode}` = false:**
|
|
206
|
-
|
|
207
|
-
```yaml
|
|
208
|
-
questions:
|
|
209
|
-
- header: "Team Status"
|
|
210
|
-
question: "All tasks complete. What would you like to do?"
|
|
211
|
-
options:
|
|
212
|
-
- label: "Proceed to validation (Recommended)"
|
|
213
|
-
description: "Run typecheck, lint, and verify acceptance criteria"
|
|
214
|
-
- label: "Assign additional tasks"
|
|
215
|
-
description: "Give more work to the team"
|
|
216
|
-
- label: "Message a teammate"
|
|
217
|
-
description: "Send follow-up instructions to a specific teammate"
|
|
218
|
-
multiSelect: false
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### 8. Complete Save Output (if save_mode)
|
|
222
|
-
|
|
223
|
-
**If `{save_mode}` = true:**
|
|
224
|
-
|
|
225
|
-
Append to `{output_dir}/03-execute.md`:
|
|
226
|
-
|
|
227
|
-
```markdown
|
|
228
|
-
## Execution Mode: Agent Teams
|
|
229
|
-
|
|
230
|
-
**Team size:** {count} teammates
|
|
231
|
-
**Tasks completed:** {count}/{total}
|
|
232
|
-
|
|
233
|
-
### Task Results
|
|
234
|
-
| Task | Teammate | Status | Files Changed |
|
|
235
|
-
|------|----------|--------|---------------|
|
|
236
|
-
| task-01 | impl-backend | ✓ | file1.ts, file2.ts |
|
|
237
|
-
| task-02 | impl-frontend | ✓ | file3.ts |
|
|
238
|
-
|
|
239
|
-
**Team Status:** Active (kept alive for follow-up)
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Step Complete
|
|
244
|
-
|
|
245
|
-
**Status:** ✓ Complete
|
|
246
|
-
**Next:** step-04-validate.md
|
|
247
|
-
**Timestamp:** {ISO timestamp}
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "03" "execute-teams" "complete"
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
## SUCCESS METRICS:
|
|
257
|
-
|
|
258
|
-
✅ All tasks assigned to teammates
|
|
259
|
-
✅ All tasks completed successfully
|
|
260
|
-
✅ TaskList updated with completion status
|
|
261
|
-
✅ Team kept alive (NOT cleaned up)
|
|
262
|
-
✅ NO implementation code written by team lead
|
|
263
|
-
✅ Output saved (if save_mode)
|
|
264
|
-
|
|
265
|
-
## FAILURE MODES:
|
|
266
|
-
|
|
267
|
-
❌ Team lead writing implementation code
|
|
268
|
-
❌ Cleaning up or dismissing the team
|
|
269
|
-
❌ **CRITICAL**: Calling TeamCreate again (team already exists from step-02-plan — re-creating resets TaskList!)
|
|
270
|
-
❌ Using any agent type other than `implementer` for teammates
|
|
271
|
-
❌ Not providing enough context to teammates
|
|
272
|
-
❌ Assigning tasks with unmet dependencies
|
|
273
|
-
❌ Not monitoring for blockers
|
|
274
|
-
|
|
275
|
-
## BEST PRACTICES:
|
|
276
|
-
|
|
277
|
-
- Give each teammate ALL context they need (they can't see your conversation)
|
|
278
|
-
- Avoid assigning tasks that modify the same files to different teammates
|
|
279
|
-
- Size tasks appropriately - not too large, not too small
|
|
280
|
-
- Monitor actively and resolve blockers quickly
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
## NEXT STEP:
|
|
285
|
-
|
|
286
|
-
After all tasks complete, load `./step-04-validate.md`
|
|
287
|
-
|
|
288
|
-
<critical>
|
|
289
|
-
Remember:
|
|
290
|
-
- You are the TEAM LEAD — NEVER implement code yourself
|
|
291
|
-
- ALWAYS use `subagent_type: "implementer"` when spawning teammates
|
|
292
|
-
- Keep the team ALIVE — shutdown happens ONLY in step-09-finish.md
|
|
293
|
-
- NEVER send shutdown_request to teammates in this step
|
|
294
|
-
- Each teammate needs FULL context (plan, patterns, file references)
|
|
295
|
-
- The `implementer` agent handles TaskList claiming, SendMessage reporting, and file boundaries automatically
|
|
296
|
-
</critical>
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-05-examine
|
|
3
|
-
description: Adversarial code review - security, logic, and quality analysis
|
|
4
|
-
prev_step: steps/step-04-validate.md
|
|
5
|
-
next_step: steps/step-06-resolve.md
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Step 5: Examine (Adversarial Review)
|
|
9
|
-
|
|
10
|
-
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
11
|
-
|
|
12
|
-
- 🛑 NEVER skip security review
|
|
13
|
-
- 🛑 NEVER dismiss findings without justification
|
|
14
|
-
- 🛑 NEVER auto-approve without thorough review
|
|
15
|
-
- ✅ ALWAYS check OWASP top 10 vulnerabilities
|
|
16
|
-
- ✅ ALWAYS classify findings by severity and validity
|
|
17
|
-
- ✅ ALWAYS present findings table to user
|
|
18
|
-
- 📋 YOU ARE A SKEPTICAL REVIEWER, not a defender
|
|
19
|
-
- 💬 FOCUS on "What could go wrong?"
|
|
20
|
-
- 🚫 FORBIDDEN to approve without thorough analysis
|
|
21
|
-
|
|
22
|
-
## EXECUTION PROTOCOLS:
|
|
23
|
-
|
|
24
|
-
- 🎯 Launch 3+ parallel review agents via Task tool in ONE message (unless economy_mode)
|
|
25
|
-
- 🛑 NEVER launch only 1 review agent — you MUST launch Security + Logic + Clean Code as separate agents
|
|
26
|
-
- 💾 Document all findings with severity
|
|
27
|
-
- 📖 Create todos for each finding
|
|
28
|
-
- 🚫 FORBIDDEN to skip security analysis
|
|
29
|
-
- 🚫 FORBIDDEN to combine review categories into a single agent
|
|
30
|
-
|
|
31
|
-
## CONTEXT BOUNDARIES:
|
|
32
|
-
|
|
33
|
-
- Implementation is complete and validated
|
|
34
|
-
- All tests pass
|
|
35
|
-
- Now looking for issues that tests miss
|
|
36
|
-
- Adversarial mindset - assume bugs exist
|
|
37
|
-
- **If `{teams_mode}` = true:** Agent team is still alive. Do NOT shutdown teammates — that happens in step-09-finish only.
|
|
38
|
-
|
|
39
|
-
## YOUR TASK:
|
|
40
|
-
|
|
41
|
-
Conduct an adversarial code review to identify security vulnerabilities, logic flaws, and quality issues.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
<available_state>
|
|
46
|
-
From previous steps:
|
|
47
|
-
|
|
48
|
-
| Variable | Description |
|
|
49
|
-
|----------|-------------|
|
|
50
|
-
| `{task_description}` | What was implemented |
|
|
51
|
-
| `{task_id}` | Kebab-case identifier |
|
|
52
|
-
| `{auto_mode}` | Auto-fix Real findings |
|
|
53
|
-
| `{save_mode}` | Save outputs to files |
|
|
54
|
-
| `{economy_mode}` | No subagents, direct review |
|
|
55
|
-
| `{output_dir}` | Path to output (if save_mode) |
|
|
56
|
-
| Files modified | From step-03 |
|
|
57
|
-
</available_state>
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## EXECUTION SEQUENCE:
|
|
62
|
-
|
|
63
|
-
### 1. Initialize Save Output (if save_mode)
|
|
64
|
-
|
|
65
|
-
**If `{save_mode}` = true:**
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
bash {skill_dir}/scripts/update-progress.sh "{task_id}" "05" "examine" "in_progress"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Append findings to `{output_dir}/05-examine.md` as you work.
|
|
72
|
-
|
|
73
|
-
### 2. Gather Changes
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
git diff --name-only HEAD~1
|
|
77
|
-
git status --porcelain
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Group files: source, tests, config, other.
|
|
81
|
-
|
|
82
|
-
### 3. Conduct Review
|
|
83
|
-
|
|
84
|
-
**If `{economy_mode}` = true:**
|
|
85
|
-
→ Self-review with checklist:
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
## Security Checklist
|
|
89
|
-
- [ ] No SQL injection (parameterized queries)
|
|
90
|
-
- [ ] No XSS (output encoding)
|
|
91
|
-
- [ ] No secrets in code
|
|
92
|
-
- [ ] Input validation present
|
|
93
|
-
- [ ] Auth checks on protected routes
|
|
94
|
-
|
|
95
|
-
## Logic Checklist
|
|
96
|
-
- [ ] Error handling for all failure modes
|
|
97
|
-
- [ ] Edge cases handled
|
|
98
|
-
- [ ] Null/undefined checks
|
|
99
|
-
- [ ] Race conditions considered
|
|
100
|
-
|
|
101
|
-
## Quality Checklist
|
|
102
|
-
- [ ] Follows existing patterns
|
|
103
|
-
- [ ] No code duplication
|
|
104
|
-
- [ ] Clear naming
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**If `{economy_mode}` = false:**
|
|
108
|
-
→ Launch parallel review agents using the **Task tool**
|
|
109
|
-
|
|
110
|
-
**🛑 CRITICAL: You MUST launch ALL 3 agents (or 4 if Next.js) in a SINGLE message using MULTIPLE Task tool calls. DO NOT launch them one at a time. DO NOT use only 1 agent. Each agent reviews a DIFFERENT aspect.**
|
|
111
|
-
|
|
112
|
-
First, gather the list of modified files:
|
|
113
|
-
```bash
|
|
114
|
-
git diff --name-only HEAD~1
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Then, in **ONE message with 3+ parallel Task tool calls**, launch:
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
**Agent 1: Security Review** — `subagent_type: "code-reviewer"`
|
|
122
|
-
```
|
|
123
|
-
prompt: |
|
|
124
|
-
You are a SECURITY reviewer. Review ONLY the following files for security vulnerabilities:
|
|
125
|
-
{list of modified files}
|
|
126
|
-
|
|
127
|
-
Focus exclusively on:
|
|
128
|
-
- OWASP Top 10: injection flaws (SQL, command, XSS)
|
|
129
|
-
- Authentication and authorization issues
|
|
130
|
-
- Sensitive data exposure (secrets, tokens, PII in logs)
|
|
131
|
-
- Security misconfiguration
|
|
132
|
-
- Insecure deserialization
|
|
133
|
-
- Missing input validation at system boundaries
|
|
134
|
-
|
|
135
|
-
For each finding, provide: file:line, severity (CRITICAL/HIGH/MEDIUM/LOW), description, and suggested fix.
|
|
136
|
-
If no security issues found, explicitly state "No security issues found."
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
**Agent 2: Logic & Edge Cases Review** — `subagent_type: "code-reviewer"`
|
|
142
|
-
```
|
|
143
|
-
prompt: |
|
|
144
|
-
You are a LOGIC reviewer. Review ONLY the following files for logic correctness:
|
|
145
|
-
{list of modified files}
|
|
146
|
-
|
|
147
|
-
Focus exclusively on:
|
|
148
|
-
- Edge cases not handled (empty arrays, null/undefined, boundary values)
|
|
149
|
-
- Race conditions and concurrency issues
|
|
150
|
-
- Incorrect conditional logic or off-by-one errors
|
|
151
|
-
- Missing error handling for failure modes
|
|
152
|
-
- State management bugs
|
|
153
|
-
- Incorrect assumptions about data shape or types
|
|
154
|
-
|
|
155
|
-
For each finding, provide: file:line, severity (CRITICAL/HIGH/MEDIUM/LOW), description, and suggested fix.
|
|
156
|
-
If no logic issues found, explicitly state "No logic issues found."
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
**Agent 3: Clean Code & Quality Review** — `subagent_type: "code-reviewer"`
|
|
162
|
-
```
|
|
163
|
-
prompt: |
|
|
164
|
-
You are a CLEAN CODE reviewer. Review ONLY the following files for code quality:
|
|
165
|
-
{list of modified files}
|
|
166
|
-
|
|
167
|
-
Focus exclusively on:
|
|
168
|
-
- SOLID principle violations
|
|
169
|
-
- Code smells (long methods, god objects, feature envy)
|
|
170
|
-
- Cyclomatic complexity > 10
|
|
171
|
-
- Code duplication > 20 lines
|
|
172
|
-
- Naming that doesn't communicate intent
|
|
173
|
-
- Functions doing too many things
|
|
174
|
-
|
|
175
|
-
For each finding, provide: file:line, severity (CRITICAL/HIGH/MEDIUM/LOW), description, and suggested fix.
|
|
176
|
-
If no quality issues found, explicitly state "No quality issues found."
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
**Agent 4: Vercel/Next.js Best Practices** (CONDITIONAL — launch alongside Agents 1-3)
|
|
182
|
-
|
|
183
|
-
→ **Detection:** Check if modified files match Next.js/Vercel patterns:
|
|
184
|
-
```
|
|
185
|
-
- *.tsx, *.jsx files in app/, pages/, components/
|
|
186
|
-
- next.config.* files
|
|
187
|
-
- Server actions (use server)
|
|
188
|
-
- API routes (app/api/*, pages/api/*)
|
|
189
|
-
- Middleware (middleware.ts)
|
|
190
|
-
- Server components, client components
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
→ **If Next.js/Vercel code detected:** Add a 4th parallel Task tool call:
|
|
194
|
-
|
|
195
|
-
`subagent_type: "code-reviewer"`
|
|
196
|
-
```
|
|
197
|
-
prompt: |
|
|
198
|
-
You are a NEXT.JS / REACT PERFORMANCE reviewer. Review ONLY the following files:
|
|
199
|
-
{list of modified files}
|
|
200
|
-
|
|
201
|
-
Focus exclusively on:
|
|
202
|
-
- Sequential awaits that should use Promise.all for parallel fetching
|
|
203
|
-
- Barrel imports causing bundle bloat (import from index files)
|
|
204
|
-
- Missing dynamic imports for heavy client components
|
|
205
|
-
- Server-side caching opportunities (React cache, unstable_cache)
|
|
206
|
-
- Unnecessary re-renders (missing memo, useMemo, useCallback)
|
|
207
|
-
- Wrong Server vs Client component boundaries
|
|
208
|
-
- Data fetching patterns (preloading, parallel fetching, waterfall detection)
|
|
209
|
-
|
|
210
|
-
For each finding, provide: file:line, severity (CRITICAL/HIGH/MEDIUM/LOW), description, and suggested fix.
|
|
211
|
-
If no performance issues found, explicitly state "No performance issues found."
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
→ **If NOT Next.js/Vercel code:** Skip this agent (launch only Agents 1-3)
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
**🛑 REMINDER: You MUST have 3+ Task tool calls in a SINGLE response. If you only launched 1 agent, you are doing it WRONG. Go back and launch all agents.**
|
|
219
|
-
|
|
220
|
-
### 4. Classify Findings
|
|
221
|
-
|
|
222
|
-
For each finding:
|
|
223
|
-
|
|
224
|
-
**Severity:**
|
|
225
|
-
- CRITICAL: Security vulnerability, data loss risk
|
|
226
|
-
- HIGH: Significant bug, will cause issues
|
|
227
|
-
- MEDIUM: Should fix, not urgent
|
|
228
|
-
- LOW: Minor improvement
|
|
229
|
-
|
|
230
|
-
**Validity:**
|
|
231
|
-
- Real: Definitely needs fixing
|
|
232
|
-
- Noise: Not actually a problem
|
|
233
|
-
- Uncertain: Needs discussion
|
|
234
|
-
|
|
235
|
-
### 5. Present Findings Table
|
|
236
|
-
|
|
237
|
-
```markdown
|
|
238
|
-
## Findings
|
|
239
|
-
|
|
240
|
-
| ID | Severity | Category | Location | Issue | Validity |
|
|
241
|
-
|----|----------|----------|----------|-------|----------|
|
|
242
|
-
| F1 | CRITICAL | Security | auth.ts:42 | SQL injection | Real |
|
|
243
|
-
| F2 | HIGH | Logic | handler.ts:78 | Missing null check | Real |
|
|
244
|
-
| F3 | MEDIUM | Quality | utils.ts:15 | Complex function | Uncertain |
|
|
245
|
-
|
|
246
|
-
**Summary:** {count} findings ({blocking} blocking)
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### 6. Create Finding Todos
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
- [ ] F1 [CRITICAL] Fix SQL injection in auth.ts:42
|
|
253
|
-
- [ ] F2 [HIGH] Add null check in handler.ts:78
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 7. Get User Approval (review → resolve/test)
|
|
257
|
-
|
|
258
|
-
**If `{auto_mode}` = true:**
|
|
259
|
-
→ Proceed automatically based on findings
|
|
260
|
-
|
|
261
|
-
**If `{auto_mode}` = false:**
|
|
262
|
-
|
|
263
|
-
```yaml
|
|
264
|
-
questions:
|
|
265
|
-
- header: "Review"
|
|
266
|
-
question: "Review complete. How would you like to proceed?"
|
|
267
|
-
options:
|
|
268
|
-
- label: "Resolve findings (Recommended)"
|
|
269
|
-
description: "Address the identified issues"
|
|
270
|
-
- label: "Skip to tests"
|
|
271
|
-
description: "Skip resolution, proceed to test creation"
|
|
272
|
-
- label: "Skip resolution"
|
|
273
|
-
description: "Accept findings, don't make changes"
|
|
274
|
-
- label: "Discuss findings"
|
|
275
|
-
description: "I want to discuss specific findings"
|
|
276
|
-
multiSelect: false
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
<critical>
|
|
280
|
-
This is one of the THREE transition points that requires user confirmation:
|
|
281
|
-
1. plan → execute
|
|
282
|
-
2. validate → review
|
|
283
|
-
3. review → resolve/test (THIS ONE)
|
|
284
|
-
</critical>
|
|
285
|
-
|
|
286
|
-
### 8. Complete Save Output (if save_mode)
|
|
287
|
-
|
|
288
|
-
**If `{save_mode}` = true:**
|
|
289
|
-
|
|
290
|
-
Append to `{output_dir}/05-examine.md`:
|
|
291
|
-
```markdown
|
|
292
|
-
---
|
|
293
|
-
## Step Complete
|
|
294
|
-
**Status:** ✓ Complete
|
|
295
|
-
**Findings:** {count}
|
|
296
|
-
**Critical:** {count}
|
|
297
|
-
**Next:** step-06-resolve.md
|
|
298
|
-
**Timestamp:** {ISO timestamp}
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## SUCCESS METRICS:
|
|
304
|
-
|
|
305
|
-
✅ All modified files reviewed
|
|
306
|
-
✅ Security checklist completed
|
|
307
|
-
✅ Findings classified by severity
|
|
308
|
-
✅ Validity assessed for each finding
|
|
309
|
-
✅ Findings table presented
|
|
310
|
-
✅ Todos created for tracking
|
|
311
|
-
✅ Next.js/Vercel best practices checked (if applicable)
|
|
312
|
-
|
|
313
|
-
## FAILURE MODES:
|
|
314
|
-
|
|
315
|
-
❌ **CRITICAL**: Launching only 1 review agent instead of 3+ — each category (Security, Logic, Clean Code) MUST be a separate agent
|
|
316
|
-
❌ Combining multiple review categories into a single agent prompt
|
|
317
|
-
❌ Skipping security review
|
|
318
|
-
❌ Not classifying by severity
|
|
319
|
-
❌ Auto-dismissing findings
|
|
320
|
-
❌ Launching agents sequentially instead of in parallel
|
|
321
|
-
❌ Using subagents when economy_mode
|
|
322
|
-
❌ Skipping Vercel/Next.js review when React/Next.js files are modified
|
|
323
|
-
❌ **CRITICAL**: Not using AskUserQuestion for review → resolve/test transition
|
|
324
|
-
|
|
325
|
-
## REVIEW PROTOCOLS:
|
|
326
|
-
|
|
327
|
-
- Adversarial mindset - assume bugs exist
|
|
328
|
-
- Check security FIRST
|
|
329
|
-
- Every finding gets severity and validity
|
|
330
|
-
- Don't dismiss without justification
|
|
331
|
-
- Present clear summary
|
|
332
|
-
|
|
333
|
-
---
|
|
334
|
-
|
|
335
|
-
## NEXT STEP:
|
|
336
|
-
|
|
337
|
-
After user confirms via AskUserQuestion (or auto-proceed):
|
|
338
|
-
|
|
339
|
-
**If user chooses "Resolve findings":** → Load `./step-06-resolve.md`
|
|
340
|
-
|
|
341
|
-
**If user chooses "Skip to tests" (and test_mode):** → Load `./step-07-tests.md`
|
|
342
|
-
|
|
343
|
-
**If user chooses "Skip resolution":**
|
|
344
|
-
- **If test_mode:** → Load `./step-07-tests.md`
|
|
345
|
-
- **If pr_mode:** → Load `./step-09-finish.md` to create pull request
|
|
346
|
-
- **Otherwise:** → Workflow complete - show summary
|
|
347
|
-
|
|
348
|
-
<critical>
|
|
349
|
-
Remember: Be SKEPTICAL - your job is to find problems, not approve code!
|
|
350
|
-
This step MUST ask before proceeding (unless auto_mode).
|
|
351
|
-
</critical>
|