Executes spec-defined implementation plans in sequential, delegated, or team modes. Manages git branches, tasks, dependencies, resumption, optional playwright/design, and validation.
From dream-teamnpx claudepluginhub ratler/dream-team --plugin dream-teamThis skill uses the workspace's default tool permissions.
Execute an implementation plan by reading a spec file and running the strategy matching its declared mode.
SPEC_PATH: $ARGUMENTS
AVAILABLE_AGENTS: ${CLAUDE_PLUGIN_ROOT}/agents/*.md
SPEC_PATH is provided, stop and ask the user to provide it.mode, complexity, type, playwright, frontend-design, spec-version, and branch.spec-version is missing from frontmatter, log a warning ("spec written before spec-version was introduced — consider updating") but proceed normally. This ensures backwards compatibility.branch is present in frontmatter, this is a resumed build — see Resuming a Build below.mode, follow the corresponding execution strategy below.playwright: true, append the Playwright instructions (see below) to every builder and tester agent dispatch prompt. If playwright: false or missing, do NOT mention Playwright to agents.frontend-design: true, read ${CLAUDE_PLUGIN_ROOT}/templates/frontend-design-guidelines.md and the spec's ## Design Direction section. Append the Frontend Design Instructions (see below) to every builder agent dispatch prompt. If frontend-design: false or missing, do NOT mention frontend design to agents.branch: feat/<spec-name> into the spec file's frontmatter to mark the build as started.## Step by Step Tasks section.addBlockedBy to set dependencies per each task's Depends On field.## Validation Commands and verify ## Acceptance Criteria.If the spec's frontmatter contains a branch field, this is a resumed build:
completed.in_progress tasks: read the task description for partial progress notes, then continue from where the previous build left off.not_started/pending tasks: proceed normally according to the mode.Delegated mode: Builder and debugger agents running in worktrees MUST commit their own changes inside the worktree before marking the task complete. The orchestrator then merges the worktree branch back into the feature branch. Read-only agents do not commit.
Team mode: Agents do NOT touch git. All git operations are handled by the orchestrator (teammates have no worktree isolation).
Before executing any tasks:
branch field. If yes, check out that branch — this is a resumed build (see Resuming a Build above).branch field, create a new feature branch:
git checkout -b feat/<spec-name-without-date>
Derive the branch name from the spec filename. For example, specs/2026-02-07-user-auth-api.md becomes feat/user-auth-api.branch: feat/<spec-name> into the spec file's YAML frontmatter (before the closing ---). This marks the spec as "build started" so it can be resumed if interrupted.branch field in frontmatter, check it out and add the field.Commit after each task passes review — never before review approval. This ensures only reviewed code enters the history.
Use this commit message format:
git add <files changed by the task>
git commit -m "<type>(<scope>): <what changed>"
Where <type> is one of: feat, fix, refactor, test, docs, chore. Keep the first line under 72 characters. Do NOT include internal task IDs in commit messages.
After all acceptance criteria pass, do NOT merge or push. Report the branch name and let the user decide what to do next.
You execute tasks directly — no sub-agents.
Follow the spec literally. When the spec provides exact values (hex colors, string templates, element types, class names, timeout values, API parameters, units), use those exact values. Do not substitute your own preferences — the spec author chose specific values to ensure reproducible builds. If the spec says #e57373, use #e57373 — not a "similar" red. If the spec says createElement("div"), use a div — not a p or span. If the spec says timeout: 10000, use 10000 — not 5000. Treat the spec as a blueprint, not a suggestion.
frontend-design: true, read ${CLAUDE_PLUGIN_ROOT}/templates/frontend-design-guidelines.md. When executing tasks that involve frontend/UI code, apply these guidelines along with the spec's ## Design Direction section.in_progress via TaskUpdate.playwright: true and the task involves UI changes, verify visually using Playwright MCP tools (navigate, screenshot, interact, check console). If Playwright tools are not available, skip and note it.completed via TaskUpdate.security-reviewer agent definition from AVAILABLE_AGENTS to load the security checklist. List all files changed on the feature branch (git diff --name-only main...HEAD). Read every changed file and work through the 7-category security checklist systematically. Report findings using Critical/Important/Minor severity. Fix any Critical or Important issues before proceeding to the code review task.You are the orchestrator. You NEVER write code directly — you dispatch agents. When dispatching builder agents, emphasize that they must follow the spec literally — exact values specified in the task description (hex colors, string formats, element types, timeouts, units) must be used verbatim, not creatively interpreted.
## Review Policy section to understand review rules.Background: true and no dependency conflicts, dispatch with run_in_background: true.Task(subagent_type: "<agent-type>", model: "<model>", ...).model parameter matching the agent definition. Read each agent's model field from their definition file. Do NOT rely on the default — if omitted, subagents inherit the parent model. The correct models are: builder=opus, researcher=sonnet, reviewer=sonnet, tester=sonnet, validator=haiku, architect=opus, debugger=opus, security-reviewer=opus.isolation: "worktree" so each agent works in an isolated git worktree. This prevents concurrent builders from conflicting. Do NOT pass isolation for read-only agents (reviewer, researcher, validator, architect, security-reviewer, tester) — they don't need it.reviewer agent (model: sonnet) with the task spec, files changed, and a summary of what the builder did.isolation: "worktree") and include the review feedback plus original task context in the prompt. Do NOT resume the previous builder — its worktree is gone.Max Retries times.completed.security-reviewer agent (model: opus) to audit all files changed on the feature branch. Provide the list of changed files (git diff --name-only main...HEAD) and the spec's acceptance criteria.
Max Retries times.validator agent for final verification.Builder and debugger agents run with isolation: "worktree", each on its own branch. The agent commits its work inside the worktree before marking the task complete. After review approval, the orchestrator merges the worktree branch back into the feature branch.
Protocol:
git worktree list / git branch.git checkout feat/<spec-name>.git merge <worktree-branch> --no-ff -m "merge: <worktree-branch>".Note: Read-only agents (reviewer, validator, researcher, security-reviewer, architect) make no file changes — no merge needed.
When creating tasks via TaskCreate, always prefix the task description with [agent-type: <agent-type>] on its own line. For example, a builder task description starts with [agent-type: builder]. This tag is used by the TaskCompleted hook for audit logging.
When dispatching an agent, provide this context:
You are a <agent-type> agent.
**Your Task**: <task name>
**Task ID**: <id>
**IMPORTANT — Literal spec adherence**: When the task description provides exact values (hex colors, string templates, element types, class names, timeout values, API parameters, units), use those exact values. Do not substitute your own preferences. Treat the spec as a blueprint, not a suggestion.
**Description**:
<full task description from the spec, including all bullet points>
**Files to work with**:
<relevant files from the spec>
**Acceptance Criteria for this task**:
<criteria specific to this task>
**Tests required**:
<tests from the spec's Tests field for this task>
**TDD is mandatory.** For every piece of functionality you implement:
1. Write a failing test first
2. Write the minimal code to make it pass
3. Refactor if needed, keeping tests green
Do NOT write implementation code without a corresponding test. If the task has no testable code, explain why in your report.
**Before marking done, commit your changes** with `git add <files> && git commit -m "<type>(<scope>): <what changed>"`. Use conventional commit format (feat, fix, refactor, test, docs, chore). Do NOT include task IDs. This is required so the orchestrator can merge your worktree branch back into the feature branch.
**Then write your completion report into the task description** using TaskUpdate. Include `[agent-type: <agent-type>]` as the first line of your report, followed by your structured report. Then mark the task completed. You can do both in a single TaskUpdate call:
TaskUpdate(taskId: "<id>", status: "completed", description: "[agent-type: <agent-type>]\n## Task Complete\n...")
playwright: true)Append this block to every builder and tester agent dispatch prompt when the spec has playwright: true. Do NOT include it for reviewer, validator, researcher, or architect agents. Do NOT include it if playwright: false or missing.
**Playwright MCP**: This project uses Playwright for frontend verification.
After making UI changes, verify them visually:
- Use playwright_navigate to load the relevant page
- Use playwright_screenshot to capture the current state
- Use playwright_click / playwright_fill to test interactions
- Use playwright_evaluate to check for console errors
If Playwright tools are not available in your tool list, skip this step and note it in your report.
frontend-design: true)Append this block to every builder agent dispatch prompt when the spec has frontend-design: true. Do NOT include it for reviewer, validator, researcher, or architect agents. Do NOT include it if frontend-design: false or missing.
Before dispatching, read ${CLAUDE_PLUGIN_ROOT}/templates/frontend-design-guidelines.md and include its full content in the builder prompt. Also include the spec's ## Design Direction section (aesthetic style, stack, component libraries, design notes).
**Frontend Design**: This project has specific design direction. Follow these guidelines for all UI code.
## Design Direction (from spec)
<paste the spec's Design Direction section here — aesthetic style, stack, component libraries, design notes>
## Frontend Design Guidelines
<paste the full content of templates/frontend-design-guidelines.md here>
Apply these guidelines to all UI code you write. The Design Direction section takes precedence for project-specific choices (aesthetic style, stack, component libraries). The guidelines provide implementation details (animation timings, interaction patterns, accessibility requirements, anti-generic rules).
You are the orchestrator of a dynamic agent team. You NEVER write code directly — you manage agent slots, schedule tasks, and handle git.
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set by attempting to use TeamCreate. If teams are not available, STOP immediately. Tell the user: "This spec uses mode: team, which requires agent teams. Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in your environment and restart, or re-spec with /dream-team:spec-delegated as an alternative." Do NOT fall back to delegated mode. Do NOT proceed.## Team Configuration for Display Mode, Coordinate Only, Max Active Agents (default 6), and Rotation After (default 3).Max Active Agents. If the spec contains "Assigned To" labels with numbered suffixes (e.g., "Builder 1", "Builder 2", "Reviewer 3") — IGNORE THE NUMBERS. These are cosmetic grouping hints, NOT separate agents. You schedule by Agent Type, not by "Assigned To" label. See the scheduling loop below.Coordinate Only: true, enable delegate mode (Shift+Tab) so you only coordinate.IMPORTANT — HOW AGENT MATCHING WORKS: The scheduling loop matches tasks to agents by Agent Type (builder, reviewer, researcher, tester, validator, architect, debugger, security-reviewer). It does NOT match by "Assigned To" label. The "Assigned To" field in specs is a COSMETIC HINT for human readers — it has NO effect on scheduling. If a spec says "Assigned To: Security Builder 1" with Agent Type: builder, and another task says "Assigned To: Builder 5" with Agent Type: builder, those are BOTH just
buildertasks and can be handled by THE SAME agent instance. NEVER create a separate agent instance for each unique "Assigned To" label.
All agent slots are equal. There are no reserved slots. You fill slots dynamically based on what unblocked tasks need doing right now.
Scheduling loop — repeat until all tasks are complete: a. List all unblocked tasks (no pending dependencies). b. Sort them: review tasks first, then all other tasks. c. For each unblocked task, determine how to dispatch it:
isolation: "worktree" — all teammates work in the main directory. To prevent conflicts, commit each builder's changes immediately after review approval (see Commit After Completion) and design specs with non-overlapping file boundaries between parallel builders.SendMessage. If NO, spawn a new one if a slot is free. It does NOT matter if the idle agent's previous task had a different "Assigned To" label — what matters is the Agent Type matches.Max Active Agents concurrent agents. If you find yourself about to spawn an agent that would exceed the cap, STOP and wait for a slot to free up first. Count your active agents before every spawn. If active agents >= Max Active Agents, you MUST wait.Rotation After tasks (default 3). Track the task count per agent instance.
Rotation After), retire it — do not send it further messages.You are taking over as a [Agent Type] agent.
Previous instance completed tasks: [task-id-1, task-id-2, task-id-3]
Commits: [sha1 "message1", sha2 "message2", sha3 "message3"]
Your remaining tasks: [task-id-4, task-id-5]
WRONG — spawning a new agent for each unique "Assigned To" label: The spec has tasks assigned to "Security Builder 1", "Security Builder 2", "Builder 3", "Reviewer 1", "Reviewer 2", etc. You spawn a SEPARATE agent for each label — 14 unique labels = 14 agents. This is WRONG. "Assigned To" labels are cosmetic. All of those builders are Agent Type: builder. All of those reviewers are Agent Type: reviewer. You should have at most a few builder instances and a few reviewer instances, NOT one per label.
WRONG — reusing a builder/debugger agent via SendMessage: A builder agent finishes task 1 and goes idle. Task 2 (Agent Type: builder) becomes unblocked. You send task 2 to the same builder via SendMessage. This is WRONG — the builder's worktree was cleaned up after task 1, so task 2 runs in the main directory with no isolation. Always spawn a fresh builder for each task.
RIGHT — reuse read-only agents, spawn fresh builders:
isolation: "worktree" for task 2.SendMessage — reviewers are read-only and don't need worktree isolation. It does NOT matter that the labels are "Reviewer 1" and "Reviewer 3".Key rule: One agent instance = one task at a time. Schedule by Agent Type, NEVER by "Assigned To" label. Reuse idle read-only agents before spawning new ones. NEVER reuse builder/debugger agents — always spawn fresh. DO spawn multiple instances of the same type when multiple tasks can run in parallel, but only when they touch different files.
Team mode teammates do NOT support isolation: "worktree" — all teammates work directly in the main directory. Committing immediately after each builder completes is the primary mechanism for preventing conflicts.
Protocol:
git status in the main working directory.git add <changed-files> && git commit -S -m "<type>(<scope>): <what changed>".Note: Read-only agents (reviewer, validator, researcher, security-reviewer, architect) make no file changes, so no commit is needed after them.
isolation: "worktree") and include the review feedback plus original task context. Do NOT reuse the previous builder. After fixes, schedule another review. Repeat up to Max Retries times.Plan Approval: true on a task, the agent must submit a plan before implementing. Review and approve or reject with feedback before the agent proceeds.security-reviewer agent (model: opus) in a free slot to audit all files changed on the feature branch. Provide the list of changed files (git diff --name-only main...HEAD) and the spec's acceptance criteria. If Critical issues are found, spawn a fresh builder agent (with isolation: "worktree") to fix them. After fixes, commit and re-run the security review. Commit security fixes before proceeding to validation.Regardless of mode, after all tasks are done:
## Validation Commands. Record output.## Acceptance Criteria. Mark pass/fail.## Documentation Requirements — verify documentation was created.Build Complete
Spec: <spec file path>
Mode: <sequential | delegated | team>
Branch: feat/<spec-name>
Tasks: <completed>/<total>
Commits: <number of commits on branch>
Results:
- [x] <acceptance criterion 1> — PASS
- [x] <acceptance criterion 2> — PASS
- [ ] <acceptance criterion 3> — FAIL: <reason>
Validation:
- <command 1> — <result>
- <command 2> — <result>
Status: <ALL PASS | ISSUES FOUND>
If all criteria passed, suggest next steps: merge to main, create a PR, or keep the branch for further work.
If any acceptance criteria failed, list what needs to be fixed and ask the user how to proceed.
Designs and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.