$npx -y skills add krzysztofsurdy/code-virtuoso --skill dispatching-agent-teamsSpawn and coordinate a pre-composed agent team from a team definition file. Reads team files from teams/, resolves agents and skills, picks the best spawning mode (peer or sequential), and runs the workflow. Use when the user asks to run a team, dispatch a development team, start
| 1 | # Dispatching Agent Teams |
| 2 | |
| 3 | Read a team definition file, resolve its agents and skills, and execute the coordination protocol. The team file is the recipe - this skill is the cook. |
| 4 | |
| 5 | ## Core Principles |
| 6 | |
| 7 | | Principle | Meaning | |
| 8 | |---|---| |
| 9 | | **Team file is the contract** | Follow the workflow, entry/exit criteria, and coordination rules defined in the team file. Do not improvise the process. | |
| 10 | | **Detect capabilities first** | Check what spawning mode the platform supports before dispatching. Peer mode if available, sequential fallback otherwise. | |
| 11 | | **Skills before agents** | Preload the team's bundled skills before spawning any agent. Agents need their reference material from the start. | |
| 12 | | **Respect coordination rules** | If the team file says "Architect must approve before implementation starts", enforce it. Do not skip gates. | |
| 13 | | **Fail early, not late** | If a required agent is not installed, stop before dispatching. Do not discover missing agents mid-workflow. | |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Workflow |
| 18 | |
| 19 | ### Phase 1: Resolve the Team |
| 20 | |
| 21 | Teams are discovered from two locations in this order: |
| 22 | |
| 23 | 1. **Project teams** - `teams/{name}.md` at the user's project root (user-authored teams) |
| 24 | 2. **Library teams** - bundled with the `agent-teams` skill at `skills/tools/agent-teams/teams/{name}.md` (or wherever the agent-teams skill is installed) |
| 25 | |
| 26 | Resolution: |
| 27 | |
| 28 | 1. If the user provided a team name as argument, search project teams first, then the library. Project teams override library teams when names collide. |
| 29 | 2. If no argument, scan both locations and present a selection menu showing which are library teams vs project teams. |
| 30 | 3. Read the team file's YAML frontmatter: `name`, `lead`, `agents`, `skills`, `workflow`. |
| 31 | 4. Verify every agent in the `agents` list exists as an installed agent definition. |
| 32 | 5. Verify every skill in the `skills` list exists as an installed skill. |
| 33 | 6. If any agent or skill is missing, report what is missing and stop. Do not proceed with a partial team. |
| 34 | |
| 35 | ### Team Library |
| 36 | |
| 37 | The `agent-teams` skill catalogs the available pre-composed teams (development-team, review-squad, war-room) with their purpose and use cases. To browse what is available before dispatching, consult that skill first. |
| 38 | |
| 39 | To author your own team, see [spec/team-spec.md](../../../spec/team-spec.md) and place the file at the project root's `teams/{name}.md`. |
| 40 | |
| 41 | ### Phase 2: Verify Entry Criteria |
| 42 | |
| 43 | 1. Read the team file's "Entry Criteria" section. |
| 44 | 2. Check each criterion against the current state (e.g., "ticket exists", "CI is green", "stakeholder available"). |
| 45 | 3. If a criterion cannot be verified automatically, ask the user to confirm it. |
| 46 | 4. Do not proceed until all entry criteria are met or explicitly waived by the user. |
| 47 | |
| 48 | ### Phase 3: Preload Skills |
| 49 | |
| 50 | Load the skills listed in the team's `skills` frontmatter. These provide reference material that agents will need during their work (e.g., testing patterns, API design principles, verification checklists). |
| 51 | |
| 52 | ### Phase 4: Detect Spawning Mode and Workflow Variants |
| 53 | |
| 54 | Check what the current platform supports: |
| 55 | |
| 56 | | Capability | Detection | Mode | |
| 57 | |---|---|---| |
| 58 | | Platform supports agent teams with peer messaging and shared task lists | Team creation tools are available | **Peer mode** | |
| 59 | | Platform supports sub-agent spawning but no peer messaging | Agent delegation tools are available | **Sequential mode** | |
| 60 | | Neither | No delegation support | **Inline mode** - lead executes all phases in the current session | |
| 61 | |
| 62 | Then check the team's `workflow` type for special handling: |
| 63 | |
| 64 | | Workflow | Special protocol | |
| 65 | |---|---| |
| 66 | | `parallel` | Check Coordination Rules for per-agent context restrictions. If present, build differential briefs per agent (see [spawning-protocol](references/spawning-protocol.md)). | |
| 67 | | `war-room` | Use multi-pass rounds: position round, then challenge round, then synthesis. Agents respond with perspective only - no tool use during the debate (see [spawning-protocol](references/spawning-protocol.md)). | |
| 68 | | `sequential`, `hybrid` | Standard protocol. | |
| 69 | |
| 70 | ### Phase 5: Dispatch |
| 71 | |
| 72 | #### Peer Mode |
| 73 | |
| 74 | 1. Create a team with the lead agent as coordinator. |
| 75 | 2. Add all other agents as teammates. |
| 76 | 3. Create shared tasks matching the workflow phases from the team file. |
| 77 | 4. Set task dependencies based on the workflow order (e.g., "Implementation" is blocked by "Design"). |
| 78 | 5. The lead assigns the first unblocked task. Teammates claim tasks as they unblock. |
| 79 | 6. Teammates message each other for clarifications as described in the coordination rules. |
| 80 | |
| 81 | #### Sequential Mode |
| 82 | |
| 83 | 1. The lead agent runs in t |