|
| 1 | +# Team-Based Plan Execution Implementation Plan |
| 2 | + |
| 3 | +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. |
| 4 | +
|
| 5 | +**Goal:** Add Claude Code agent team support to the three execution skills, with detection, user choice, and cross-platform fallback. |
| 6 | + |
| 7 | +**Architecture:** Each execution skill gets a "Team Mode" section that activates only when Claude Code teams are detected and the user opts in. The existing sequential subagent pattern remains the default. A shared detection-and-choice pattern is documented once and referenced by all three skills. |
| 8 | + |
| 9 | +**Tech Stack:** Markdown skill files (SKILL.md), Claude Code tools (TeamCreate, SendMessage, TaskCreate/TaskUpdate/TaskList, Task) |
| 10 | + |
| 11 | +**Design doc:** `docs/plans/2026-02-13-team-based-plan-execution-design.md` |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +### Task 1: Add team detection and choice pattern to `writing-plans` |
| 16 | + |
| 17 | +The entry point for execution mode selection is `writing-plans/SKILL.md`, which currently offers two choices (subagent-driven or parallel session). Add a third option for team-based execution and document the detection pattern. |
| 18 | + |
| 19 | +**Files:** |
| 20 | +- Modify: `skills/writing-plans/SKILL.md` (Execution Handoff section, ~line 99-117) |
| 21 | + |
| 22 | +**Step 1: Add team detection instructions to the Execution Handoff section** |
| 23 | + |
| 24 | +After the current two options, add a third option and a detection preamble. Replace the Execution Handoff section with: |
| 25 | + |
| 26 | +```markdown |
| 27 | +## Execution Handoff |
| 28 | + |
| 29 | +After saving the plan, check for team support and offer execution choice: |
| 30 | + |
| 31 | +**Detection:** Before presenting options, check if the `TeamCreate` tool is available in this environment. |
| 32 | +If it is, include Option 3 below. If not, only show Options 1 and 2. |
| 33 | + |
| 34 | +**"Plan complete and saved to `docs/plans/<filename>.md`. Execution options:** |
| 35 | + |
| 36 | +**1. Subagent-Driven (this session)** - I dispatch fresh subagent per task, review between tasks, fast iteration |
| 37 | + |
| 38 | +**2. Parallel Session (separate)** - Open new session with executing-plans, batch execution with checkpoints |
| 39 | + |
| 40 | +**3. Team-Based (parallel, this session)** *(only if TeamCreate is available)* - Spawn an agent team with parallel implementers and reviewers, coordinated via shared task list |
| 41 | + |
| 42 | +**Which approach?"** |
| 43 | + |
| 44 | +**If Subagent-Driven chosen:** |
| 45 | +- **REQUIRED SUB-SKILL:** Use superpowers:subagent-driven-development |
| 46 | +- Stay in this session |
| 47 | +- Fresh subagent per task + code review |
| 48 | + |
| 49 | +**If Parallel Session chosen:** |
| 50 | +- Guide them to open new session in worktree |
| 51 | +- **REQUIRED SUB-SKILL:** New session uses superpowers:executing-plans |
| 52 | + |
| 53 | +**If Team-Based chosen:** |
| 54 | +- **REQUIRED SUB-SKILL:** Use superpowers:subagent-driven-development (team mode) |
| 55 | +- Stay in this session |
| 56 | +- TeamCreate to spawn parallel implementers |
| 57 | +- Shared TaskList for coordination |
| 58 | +``` |
| 59 | + |
| 60 | +**Step 2: Commit** |
| 61 | + |
| 62 | +```bash |
| 63 | +git add skills/writing-plans/SKILL.md |
| 64 | +git commit -m "feat(writing-plans): add team-based execution as third handoff option" |
| 65 | +``` |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +### Task 2: Add team mode to `subagent-driven-development` - When to Use decision tree |
| 70 | + |
| 71 | +Add team mode branching to the decision tree at the top of the skill. |
| 72 | + |
| 73 | +**Files:** |
| 74 | +- Modify: `skills/subagent-driven-development/SKILL.md` (When to Use section) |
| 75 | + |
| 76 | +**Step 1: Update the decision tree** |
| 77 | + |
| 78 | +Add a new decision node after "Stay in this session?" that checks for team availability. The updated flow: |
| 79 | + |
| 80 | +```markdown |
| 81 | +## When to Use |
| 82 | + |
| 83 | +\`\`\`dot |
| 84 | +digraph when_to_use { |
| 85 | + "Have implementation plan?" [shape=diamond]; |
| 86 | + "Tasks mostly independent?" [shape=diamond]; |
| 87 | + "Stay in this session?" [shape=diamond]; |
| 88 | + "TeamCreate available and user opted in?" [shape=diamond]; |
| 89 | + "subagent-driven-development (team mode)" [shape=box]; |
| 90 | + "subagent-driven-development (standard)" [shape=box]; |
| 91 | + "executing-plans" [shape=box]; |
| 92 | + "Manual execution or brainstorm first" [shape=box]; |
| 93 | + |
| 94 | + "Have implementation plan?" -> "Tasks mostly independent?" [label="yes"]; |
| 95 | + "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"]; |
| 96 | + "Tasks mostly independent?" -> "Stay in this session?" [label="yes"]; |
| 97 | + "Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"]; |
| 98 | + "Stay in this session?" -> "TeamCreate available and user opted in?" [label="yes"]; |
| 99 | + "Stay in this session?" -> "executing-plans" [label="no - parallel session"]; |
| 100 | + "TeamCreate available and user opted in?" -> "subagent-driven-development (team mode)" [label="yes"]; |
| 101 | + "TeamCreate available and user opted in?" -> "subagent-driven-development (standard)" [label="no"]; |
| 102 | +} |
| 103 | +\`\`\` |
| 104 | +``` |
| 105 | + |
| 106 | +**Step 2: Commit** |
| 107 | + |
| 108 | +```bash |
| 109 | +git add skills/subagent-driven-development/SKILL.md |
| 110 | +git commit -m "feat(subagent-driven-dev): add team mode to When to Use decision tree" |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### Task 3: Add team mode process flow to `subagent-driven-development` |
| 116 | + |
| 117 | +Add a "Team Mode" section describing the parallel execution flow using Claude Code teams. |
| 118 | + |
| 119 | +**Files:** |
| 120 | +- Modify: `skills/subagent-driven-development/SKILL.md` (add new section after The Process) |
| 121 | + |
| 122 | +**Step 1: Add Team Mode section after the existing Process section** |
| 123 | + |
| 124 | +Insert after the current process flow and before the Prompt Templates section: |
| 125 | + |
| 126 | +```markdown |
| 127 | +## Team Mode (Claude Code Only) |
| 128 | + |
| 129 | +When the user opts into team mode and `TeamCreate` is available, use this alternative flow instead of the standard sequential process above. |
| 130 | + |
| 131 | +**Core difference:** Independent tasks run in parallel via team members. Review gates remain sequential per task. |
| 132 | + |
| 133 | +### Team Composition |
| 134 | + |
| 135 | +- **Team Lead (you):** Orchestrates work, assigns tasks, reviews results |
| 136 | +- **Implementer agents:** One per independent task, spawned as team members |
| 137 | +- **Reviewer agents:** Dispatched per task after implementation completes (spec then quality) |
| 138 | + |
| 139 | +### Team Mode Process |
| 140 | + |
| 141 | +\`\`\`dot |
| 142 | +digraph team_process { |
| 143 | + rankdir=TB; |
| 144 | + |
| 145 | + "Read plan, extract tasks, identify independent groups" [shape=box]; |
| 146 | + "TeamCreate with implementer agents" [shape=box]; |
| 147 | + "Assign independent tasks to implementers via TaskCreate" [shape=box]; |
| 148 | + "Implementers work in parallel" [shape=box]; |
| 149 | + "As each implementer completes:" [shape=box]; |
| 150 | + |
| 151 | + subgraph cluster_per_task { |
| 152 | + label="Per Completed Task (sequential)"; |
| 153 | + "Dispatch spec reviewer for task" [shape=box]; |
| 154 | + "Spec passes?" [shape=diamond]; |
| 155 | + "Send fix instructions to implementer" [shape=box]; |
| 156 | + "Dispatch code quality reviewer" [shape=box]; |
| 157 | + "Quality passes?" [shape=diamond]; |
| 158 | + "Send quality fix instructions" [shape=box]; |
| 159 | + "Mark task complete" [shape=box]; |
| 160 | + } |
| 161 | + |
| 162 | + "More tasks to assign?" [shape=diamond]; |
| 163 | + "Assign next batch to idle implementers" [shape=box]; |
| 164 | + "All tasks complete" [shape=box]; |
| 165 | + "Shutdown team" [shape=box]; |
| 166 | + "Final code review + finishing-a-development-branch" [shape=box]; |
| 167 | + |
| 168 | + "Read plan, extract tasks, identify independent groups" -> "TeamCreate with implementer agents"; |
| 169 | + "TeamCreate with implementer agents" -> "Assign independent tasks to implementers via TaskCreate"; |
| 170 | + "Assign independent tasks to implementers via TaskCreate" -> "Implementers work in parallel"; |
| 171 | + "Implementers work in parallel" -> "As each implementer completes:"; |
| 172 | + "As each implementer completes:" -> "Dispatch spec reviewer for task"; |
| 173 | + "Dispatch spec reviewer for task" -> "Spec passes?"; |
| 174 | + "Spec passes?" -> "Send fix instructions to implementer" [label="no"]; |
| 175 | + "Send fix instructions to implementer" -> "Dispatch spec reviewer for task"; |
| 176 | + "Spec passes?" -> "Dispatch code quality reviewer" [label="yes"]; |
| 177 | + "Dispatch code quality reviewer" -> "Quality passes?"; |
| 178 | + "Quality passes?" -> "Send quality fix instructions" [label="no"]; |
| 179 | + "Send quality fix instructions" -> "Dispatch code quality reviewer"; |
| 180 | + "Quality passes?" -> "Mark task complete" [label="yes"]; |
| 181 | + "Mark task complete" -> "More tasks to assign?"; |
| 182 | + "More tasks to assign?" -> "Assign next batch to idle implementers" [label="yes"]; |
| 183 | + "Assign next batch to idle implementers" -> "Implementers work in parallel"; |
| 184 | + "More tasks to assign?" -> "All tasks complete" [label="no"]; |
| 185 | + "All tasks complete" -> "Shutdown team"; |
| 186 | + "Shutdown team" -> "Final code review + finishing-a-development-branch"; |
| 187 | +} |
| 188 | +\`\`\` |
| 189 | + |
| 190 | +### Key Constraints in Team Mode |
| 191 | + |
| 192 | +- **Review gates are still sequential per task:** spec review must pass before code quality review |
| 193 | +- **Dependent tasks must wait:** only dispatch tasks whose dependencies are complete |
| 194 | +- **Implementers on different tasks in parallel is OK:** they work on separate files |
| 195 | +- **Implementers on the same task is NOT OK:** one implementer per task |
| 196 | +- **Team lead handles review dispatch:** don't delegate review scheduling to implementers |
| 197 | +- **Use SendMessage for fix instructions:** when a reviewer finds issues, message the implementer with specific fixes needed |
| 198 | +- **Use shared TaskList for tracking:** all task state lives in the team's task list |
| 199 | + |
| 200 | +### Team Lifecycle |
| 201 | + |
| 202 | +1. **Create:** `TeamCreate` at start of execution |
| 203 | +2. **Staff:** Spawn implementer agents as team members via `Task` with `team_name` |
| 204 | +3. **Assign:** Create tasks via `TaskCreate`, assign via `TaskUpdate` with `owner` |
| 205 | +4. **Coordinate:** Use `SendMessage` for review feedback, fix instructions |
| 206 | +5. **Shutdown:** Send `shutdown_request` to all team members when complete |
| 207 | +6. **Cleanup:** `TeamDelete` after all members shut down |
| 208 | +``` |
| 209 | + |
| 210 | +**Step 2: Commit** |
| 211 | + |
| 212 | +```bash |
| 213 | +git add skills/subagent-driven-development/SKILL.md |
| 214 | +git commit -m "feat(subagent-driven-dev): add team mode process flow and constraints" |
| 215 | +``` |
| 216 | + |
| 217 | +--- |
| 218 | + |
| 219 | +### Task 4: Add team mode to `dispatching-parallel-agents` |
| 220 | + |
| 221 | +Add a team-based alternative to the current parallel Task dispatch. |
| 222 | + |
| 223 | +**Files:** |
| 224 | +- Modify: `skills/dispatching-parallel-agents/SKILL.md` (add Team Mode section after The Pattern) |
| 225 | + |
| 226 | +**Step 1: Add Team Mode section** |
| 227 | + |
| 228 | +Insert after "The Pattern" section (after Step 4: Review and Integrate): |
| 229 | + |
| 230 | +```markdown |
| 231 | +## Team Mode (Claude Code Only) |
| 232 | + |
| 233 | +If `TeamCreate` is available and the user opts in, use a coordinated team instead of individual `Task` calls. |
| 234 | + |
| 235 | +### Standard Mode vs Team Mode |
| 236 | + |
| 237 | +| Aspect | Standard (Task calls) | Team Mode | |
| 238 | +|--------|----------------------|-----------| |
| 239 | +| Dispatch | Individual `Task` tool calls | `TeamCreate` + team members | |
| 240 | +| Communication | None between agents | `SendMessage` for sharing findings | |
| 241 | +| Progress tracking | Wait for Task return | Shared `TaskList` with live status | |
| 242 | +| Result collection | Read each Task result | Agents report via messages + TaskUpdate | |
| 243 | +| Best for | Quick independent investigations | Longer investigations needing coordination | |
| 244 | + |
| 245 | +### When to Prefer Team Mode |
| 246 | + |
| 247 | +- Investigations may need to share context mid-flight (e.g., "I found the root cause is in module X, check if it affects your area too") |
| 248 | +- More than 3 parallel agents (better lifecycle management) |
| 249 | +- Agents may discover dependencies during investigation |
| 250 | + |
| 251 | +### Team Mode Pattern |
| 252 | + |
| 253 | +1. **Create team:** `TeamCreate` with descriptive name |
| 254 | +2. **Spawn investigators:** One team member per independent domain |
| 255 | +3. **Let them work:** Agents investigate, can message each other if relevant findings |
| 256 | +4. **Collect results:** Team lead monitors `TaskList`, reads agent messages |
| 257 | +5. **Integrate:** Same as standard - verify fixes don't conflict, run full suite |
| 258 | +6. **Shutdown:** `shutdown_request` to all members, then `TeamDelete` |
| 259 | +``` |
| 260 | + |
| 261 | +**Step 2: Commit** |
| 262 | + |
| 263 | +```bash |
| 264 | +git add skills/dispatching-parallel-agents/SKILL.md |
| 265 | +git commit -m "feat(dispatching-parallel): add team mode as alternative to Task dispatch" |
| 266 | +``` |
| 267 | + |
| 268 | +--- |
| 269 | + |
| 270 | +### Task 5: Add team mode to `executing-plans` |
| 271 | + |
| 272 | +Add within-batch parallelism via teams. |
| 273 | + |
| 274 | +**Files:** |
| 275 | +- Modify: `skills/executing-plans/SKILL.md` (add Team Mode section after Step 5) |
| 276 | + |
| 277 | +**Step 1: Add Team Mode section** |
| 278 | + |
| 279 | +Insert before "When to Stop and Ask for Help": |
| 280 | + |
| 281 | +```markdown |
| 282 | +### Team Mode (Claude Code Only) |
| 283 | + |
| 284 | +If `TeamCreate` is available and the user opted in during the writing-plans handoff, parallelize tasks within each batch. |
| 285 | + |
| 286 | +**What changes:** |
| 287 | +- Step 2 (Execute Batch): Instead of executing 3 tasks sequentially, spawn a team and assign batch tasks to team members working in parallel |
| 288 | +- Step 3 (Report): Wait for all batch members to complete, then report combined results |
| 289 | +- Steps 1, 4, 5: Unchanged (plan review, feedback loop, and completion stay the same) |
| 290 | + |
| 291 | +**What doesn't change:** |
| 292 | +- Batch boundaries and human review checkpoints remain |
| 293 | +- Default batch size is still 3 tasks |
| 294 | +- "Ready for feedback" checkpoint after each batch |
| 295 | +- The human-in-the-loop approval between batches is preserved |
| 296 | + |
| 297 | +**Team lifecycle per batch:** |
| 298 | +1. `TeamCreate` for the batch |
| 299 | +2. Assign batch tasks to team members |
| 300 | +3. Wait for all to complete |
| 301 | +4. Report results, wait for feedback |
| 302 | +5. `TeamDelete` (or reuse for next batch) |
| 303 | +``` |
| 304 | + |
| 305 | +**Step 2: Commit** |
| 306 | + |
| 307 | +```bash |
| 308 | +git add skills/executing-plans/SKILL.md |
| 309 | +git commit -m "feat(executing-plans): add team mode for within-batch parallelism" |
| 310 | +``` |
| 311 | + |
| 312 | +--- |
| 313 | + |
| 314 | +### Task 6: Update Red Flags and cross-platform notes |
| 315 | + |
| 316 | +Add team-specific red flags and ensure cross-platform safety is documented. |
| 317 | + |
| 318 | +**Files:** |
| 319 | +- Modify: `skills/subagent-driven-development/SKILL.md` (Red Flags section) |
| 320 | +- Modify: `skills/dispatching-parallel-agents/SKILL.md` (When NOT to Use section) |
| 321 | + |
| 322 | +**Step 1: Add team-specific red flags to subagent-driven-development** |
| 323 | + |
| 324 | +Add to the existing "Never:" list: |
| 325 | + |
| 326 | +```markdown |
| 327 | +**Team mode specific - Never:** |
| 328 | +- Use team mode when `TeamCreate` is not available (fall back to standard mode) |
| 329 | +- Assume team mode works on non-Claude-Code environments (Codex, OpenCode) |
| 330 | +- Skip the user choice - always ask before spawning a team |
| 331 | +- Let implementers self-assign tasks (team lead assigns via TaskUpdate) |
| 332 | +- Forget to shutdown the team (always send shutdown_request + TeamDelete) |
| 333 | +``` |
| 334 | + |
| 335 | +**Step 2: Add cross-platform note to dispatching-parallel-agents** |
| 336 | + |
| 337 | +Add a note in the "When NOT to Use" section: |
| 338 | + |
| 339 | +```markdown |
| 340 | +**Cross-platform note:** Team mode requires Claude Code with teams enabled (beta). |
| 341 | +On Codex, OpenCode, or Claude Code without teams, use the standard parallel Task dispatch. |
| 342 | +Always detect capability before offering team mode. |
| 343 | +``` |
| 344 | + |
| 345 | +**Step 3: Commit** |
| 346 | + |
| 347 | +```bash |
| 348 | +git add skills/subagent-driven-development/SKILL.md skills/dispatching-parallel-agents/SKILL.md |
| 349 | +git commit -m "feat: add team-specific red flags and cross-platform safety notes" |
| 350 | +``` |
| 351 | + |
| 352 | +--- |
| 353 | + |
| 354 | +### Task 7: Final review and integration test |
| 355 | + |
| 356 | +Verify all changes are consistent and the skills work together. |
| 357 | + |
| 358 | +**Step 1: Read all modified files end-to-end** |
| 359 | + |
| 360 | +Verify: |
| 361 | +- `writing-plans` offers 3 execution options (with detection) |
| 362 | +- `subagent-driven-development` has both standard and team mode paths |
| 363 | +- `dispatching-parallel-agents` has team mode alternative |
| 364 | +- `executing-plans` has within-batch parallelism option |
| 365 | +- All team features are gated behind detection |
| 366 | +- No skill breaks when `TeamCreate` is unavailable |
| 367 | +- Cross-platform notes are present |
| 368 | + |
| 369 | +**Step 2: Verify decision tree consistency** |
| 370 | + |
| 371 | +Trace the full flow: |
| 372 | +1. `writing-plans` → user chooses team-based → routes to `subagent-driven-development (team mode)` |
| 373 | +2. `subagent-driven-development` → detects TeamCreate → offers team mode → spawns team |
| 374 | +3. `dispatching-parallel-agents` → detects TeamCreate → offers team mode → spawns team |
| 375 | +4. `executing-plans` → detects TeamCreate → parallelizes within batch |
| 376 | + |
| 377 | +**Step 3: Commit any fixes found during review** |
| 378 | + |
| 379 | +```bash |
| 380 | +git add -A |
| 381 | +git commit -m "fix: address integration issues found during final review" |
| 382 | +``` |
0 commit comments