dispatching-agent-teams
Dispatching Agent Teams
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.
Core Principles
| Principle | Meaning |
|---|---|
| Team file is the contract | Follow the workflow, entry/exit criteria, and coordination rules defined in the team file. Do not improvise the process. |
| Detect capabilities first | Check what spawning mode the platform supports before dispatching. Peer mode if available, sequential fallback otherwise. |
| Skills before agents | Preload the team's bundled skills before spawning any agent. Agents need their reference material from the start. |
| Respect coordination rules | If the team file says "Architect must approve before implementation starts", enforce it. Do not skip gates. |
| Fail early, not late | If a required agent is not installed, stop before dispatching. Do not discover missing agents mid-workflow. |
Workflow
Phase 1: Resolve the Team
- If the user provided a team name as argument, look for
teams/{name}.mdin the project directory, then user-level directories, then plugin cache. - If no argument, scan for available team files and present a selection menu.
- Read the team file's YAML frontmatter:
name,lead,agents,skills,workflow. - Verify every agent in the
agentslist exists as an installed agent definition. - Verify every skill in the
skillslist exists as an installed skill. - If any agent or skill is missing, report what is missing and stop. Do not proceed with a partial team.
Phase 2: Verify Entry Criteria
- Read the team file's "Entry Criteria" section.
- Check each criterion against the current state (e.g., "ticket exists", "CI is green", "stakeholder available").
- If a criterion cannot be verified automatically, ask the user to confirm it.
- Do not proceed until all entry criteria are met or explicitly waived by the user.
Phase 3: Preload Skills
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).
Phase 4: Detect Spawning Mode and Workflow Variants
Check what the current platform supports:
| Capability | Detection | Mode |
|---|---|---|
| Platform supports agent teams with peer messaging and shared task lists | Team creation tools are available | Peer mode |
| Platform supports sub-agent spawning but no peer messaging | Agent delegation tools are available | Sequential mode |
| Neither | No delegation support | Inline mode -- lead executes all phases in the current session |
Then check the team's workflow type for special handling:
| Workflow | Special protocol |
|---|---|
parallel |
Check Coordination Rules for per-agent context restrictions. If present, build differential briefs per agent (see spawning-protocol). |
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). |
sequential, hybrid |
Standard protocol. |
Phase 5: Dispatch
Peer Mode
- Create a team with the lead agent as coordinator.
- Add all other agents as teammates.
- Create shared tasks matching the workflow phases from the team file.
- Set task dependencies based on the workflow order (e.g., "Implementation" is blocked by "Design").
- The lead assigns the first unblocked task. Teammates claim tasks as they unblock.
- Teammates message each other for clarifications as described in the coordination rules.
Sequential Mode
- The lead agent runs in the current session.
- For each workflow phase in order: a. Read the phase description from the team file (what this agent does, expected input/output). b. Spawn the phase's agent as a sub-agent with a brief containing: the phase description, the output from previous phases, and the relevant skills to consult. c. Collect the sub-agent's output. d. If the team file defines a gate between this phase and the next, verify the gate condition before proceeding.
- Pass each phase's output as input to the next phase.
Inline Mode
- Execute each workflow phase sequentially in the current session.
- For each phase, adopt the role described in the team file and consult the relevant skills.
- Produce the expected output before moving to the next phase.
Phase 6: Verify Exit Criteria
- Read the team file's "Exit Criteria" section.
- Check each criterion against the current state.
- Report results to the user with evidence for each criterion (pass/fail with proof).
- If any exit criterion fails, report what remains and ask the user how to proceed.
Handling Failures
| Failure | Action |
|---|---|
| Agent not installed | Stop before dispatching. List missing agents with install instructions. |
| Skill not installed | Stop before dispatching. List missing skills with install instructions. |
| Entry criterion not met | Ask user to confirm or waive. Do not silently skip. |
| Phase produces no output | Retry the phase once. If it fails again, report to the lead/user. |
| Gate condition not met | Block the next phase. Report what failed the gate and what needs to change. |
| Agent times out or errors | Report the error. Ask user whether to retry, skip, or abort the team. |
Quality Checklist
Before claiming the team run is complete:
- All workflow phases were executed in the defined order
- All coordination gates were enforced (no skipped approvals)
- All exit criteria were verified with evidence
- Outputs from each phase were captured and passed forward
- Any failures were reported with context, not silently swallowed
Reference Files
| Reference | Contents |
|---|---|
| spawning-protocol | Detailed spawning steps for peer, sequential, and inline modes |
Integration with Other Skills
| Situation | Recommended Skill |
|---|---|
| Need to discover which teams are available | using-ecosystem |
| Need to create a new team definition | Use template/team-template.md and spec/team-spec.md |
| Need to dispatch agents without a team file | dispatching-parallel-agents or subagent-driven-development |
| Need to verify work before closing a phase | verification-before-completion |
More from krzysztofsurdy/code-virtuoso
symfony-upgrade
Symfony framework version upgrade guide using the deprecation-first approach. Use when the user asks to upgrade Symfony to a new minor or major version, fix deprecation warnings, update Symfony recipes, check bundle compatibility, migrate between LTS versions, or plan a Symfony version migration strategy. Covers PHPUnit Bridge deprecation tracking, recipe updates, bundle compatibility checks, version-specific breaking changes, and the changelog-first upgrade workflow.
90symfony-components
Comprehensive reference for all 38 Symfony framework components with PHP 8.3+ and Symfony 7.x patterns. Use when the user asks to implement, configure, or troubleshoot any Symfony component including HttpFoundation, HttpKernel, DependencyInjection, Form, Validator, Cache, Messenger, Console, EventDispatcher, Workflow, Serializer, Security, Routing, Twig, Doctrine integration, or any other Symfony component. Covers APIs, configuration, best practices, and common pitfalls.
83solid
SOLID principles for object-oriented design with multi-language examples (PHP, Java, Python, TypeScript, C++). Use when the user asks to review SOLID compliance, fix a SOLID violation, evaluate class design, reduce coupling, improve extensibility, or apply Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, or Dependency Inversion principles. Covers motivation, violation detection, refactoring fixes, and real-world trade-offs for each principle.
47agentic-rules-writer
Interactive tool to generate tailored rules and instruction files for any AI coding agent. Use when the user asks to set up agent rules, configure Claude Code instructions, create Cursor rules, write Windsurf rules, generate Copilot instructions, or establish consistent AI coding standards for a team. Supports 13+ agents (Claude Code, Cursor, Windsurf, Copilot, Gemini, Codex, Cline, OpenCode, Continue, Trae, Roo Code, Amp) with global, team-shared, and dev-specific scopes. Defers to the `using-ecosystem` meta-skill for ecosystem discovery (skills, agents, recommendations) and runs an interactive questionnaire for workflow preferences.
47refactoring
Comprehensive skill for 89 refactoring techniques and 22 code smells with practical examples. Use when the user asks to refactor code, detect code smells, improve code quality, reduce complexity, or clean up technical debt. Covers composing methods, moving features between objects, organizing data, simplifying conditionals and method calls, dealing with generalization, and detecting smells across bloaters, OO abusers, change preventers, dispensables, and couplers with before/after comparisons and step-by-step mechanics.
42design-patterns
Comprehensive skill for all 26 Gang of Four design patterns with practical implementations and real-world examples. Use when the user asks to apply a design pattern, refactor code using patterns, choose between competing patterns, or review existing pattern usage. Covers creational (Abstract Factory, Builder, Factory Method, Prototype, Singleton, Object Pool), structural (Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy, Private Class Data), and behavioral patterns (Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor, Null Object) with real-world examples, trade-offs, and anti-patterns.
41