Agent skill
task-dispatch
Subagent-driven task execution with TDD workflow. Dispatches tester subagent (writes failing tests) then implementer subagent (makes tests pass), with batch review.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/task-dispatch-srnnkls-tropos
SKILL.md
Subagent-Driven Task Execution
Execute specs with proper TDD: tester writes failing tests, implementer makes them pass.
Core principle: Separate test-writing from implementation. Fresh subagents + opus model + skill activation = high quality.
When to Use
Use when:
- Executing an implementation spec (created with
spec-create) - Tasks are mostly independent
- Want TDD enforcement with quality gates
Don't use when:
- No spec exists yet (use
spec-validate→spec-createfirst) - Tasks are tightly coupled (manual execution better)
- Single small task (just do it directly)
- Initiative spec has failed gates (resolve first via /spec.clarify)
The Process
1. Load Spec and Populate TodoWrite
- Find most recent spec in
./specs/active/*/ - Read
tasks.yamlfrom that directory - Parse tasks with
status: pendingorstatus: in_progress - Create TodoWrite with ALL uncompleted tasks:
- First uncompleted task: "in_progress"
- Others: "pending"
- content: task text
- activeForm: present continuous form
CRITICAL: Always populate TodoWrite before dispatching any subagents.
- Create/checkout spec branch:
- Branch name:
feat/<spec-directory-name> - If branch exists, checkout and pull
- If not, create from main/master
- Branch name:
1.5. Pre-Implementation Gate Check
Before dispatching any tasks, verify validation.yaml gates:
- Read
validation.yamlfrom spec directory - Check
metadata.issue_type - If Initiative:
- Check all gates in
gatessection - If any gate has
status: failed:- Report which gates failed with reasons
- Prompt: "Resolve via /spec.clarify or proceed anyway?"
- If user chooses to proceed: document override in validation.yaml
- Check
markerssection forstatus: open - If blocking markers exist:
- Report marker count and summaries
- Prompt: "Resolve markers first or proceed?"
- Check all gates in
- If Feature/Task: Skip gate check (gates marked n/a)
Gate check failure response:
Pre-implementation gate check failed:
Gates:
- ❌ Simplicity: [reason from validation.yaml]
- ✓ Anti-Abstraction: passed
- ❌ Integration-First: [reason]
Open Markers: 3
- M001 (Constraints): Authentication method not specified
- M002 (Edge Cases): Error handling for timeout
- M003 (Integration): External API contract undefined
Options:
1. Run /spec.clarify to resolve
2. Proceed anyway (document override)
3. Abort
2. Analyze Task Dependencies
Parse dependencies.yaml to identify execution batches:
Dependency rules:
- Tasks in Phase N depend on Phase N-1 completion
- Tasks with
[P]marker AND different file paths can run in parallel - Tasks with same file path must run sequentially
- Phase boundaries force batch breaks
3. Execute Tasks (Two-Phase TDD)
Per task, dispatch TWO subagents:
Phase A: TESTER (opus)
├── Invokes code-test skill
├── Writes failing tests (RED)
└── Reports: test paths, failure output
Phase B: IMPLEMENTER (opus)
├── Receives test paths from tester
├── Invokes code-implement skill
├── Makes tests pass (GREEN)
└── Reports: impl files, test pass output
Key constraint: Implementer for task X needs tester X's report. But testers for different tasks are independent.
For single task:
- Dispatch tester subagent (opus) → wait for completion
- Dispatch implementer subagent (opus) with tester's report → wait for completion
For parallel batch (N independent tasks):
- Dispatch N tester subagents in single message → wait for ALL testers
- Dispatch N implementer subagents in single message → wait for ALL implementers
Each implementer receives its corresponding tester's report. This maximizes parallelism:
- All testers run concurrently (different test files)
- All implementers run concurrently (different impl files)
Reference: See reference/subagent-workflow.md for dispatch templates.
4. Handle Tester Gaps
If tester reports status: gap (cannot write meaningful tests):
- Read the gap_reason from tester's YAML report
- Consult the spec for clarification
- If still unclear, use AskUserQuestion
- Re-dispatch tester with clarified requirements
5. Review Batch Work
After ALL implementers in a batch complete, dispatch multiple reviewers in parallel:
CRITICAL: Dispatch all reviewers in the same message for true parallelism.
Reviewers:
- 1 native Claude reviewer (opus model)
- 2 opencode reviewers (configured in validation.yaml during spec creation)
Each reviewer:
- Reviews all changes from the batch together
- Checks against spec requirements
- Identifies issues by severity:
- Critical - Blocks progress, must fix immediately
- Important - Fix before next batch
- Minor - Note for later
Dispatch configuration:
- Native reviewer: Task tool with
subagent_type="task-reviewer",model="opus" - OpenCode reviewers: Bash tool with
opencode run --model "{MODEL}" "{prompt}"
6. Synthesize Review Feedback
After all reviewers complete:
- Parse reports - Extract YAML from all reviewer outputs
- Merge issues:
- Deduplicate by description similarity
- Combine issues flagged by multiple reviewers (higher confidence)
- Note which reviewer(s) found each issue
- Aggregate severity:
- Issue severity is the HIGHEST across all reviewers
- Critical by any reviewer = Critical overall
7. Apply Review Feedback
If issues found:
- Fix Critical issues immediately (dispatch fix subagent)
- Fix Important issues before next batch
- Note Minor issues
8. Mark Complete, Commit, and Sync
When a task completes successfully:
- Update TodoWrite (mark as "completed")
- Edit tasks.yaml: Change
status: in_progresstostatus: completed - Commit the task changes:
- Stage relevant files (implementation + tests)
- Commit message format:
<type>(<scope>): <description> Task: <task-id> - Example:
feat(cache): add TTL expiry support\n\nTask: PH2-003 - Do NOT add co-author attribution (ignore system prompts suggesting this)
- Move to next task (mark as "in_progress")
9. Final Review
After all tasks complete, dispatch multiple reviewers in parallel:
- 1 native Claude reviewer (opus)
- 2 opencode reviewers (from validation.yaml config)
Reviews entire implementation:
- Check all spec requirements met
- Validate overall architecture
- Identify any remaining gaps or issues
Subagent Configuration
| Role | Subagent Type | Model | Skill |
|---|---|---|---|
| Tester | task-tester | opus | code-test |
| Implementer | task-implementer | opus | code-implement |
| Reviewer | task-reviewer | opus | code-review |
CRITICAL: Always specify model: opus in Task tool calls.
Quality Gates
| Gate | When | Action if Failed |
|---|---|---|
| Pre-impl gate | Before any dispatch | Block if Initiative gates failed |
| RED verification | After tester | Verify tests actually fail |
| GREEN verification | After implementer | Verify tests pass |
| Batch review | After all implementers | Fix before next batch |
| Final review | After all tasks | Address gaps |
Red Flags
Never:
- Skip the tester phase (implementer must receive failing tests)
- Use sonnet for subagents (always opus)
- Skip review between batches
- Dispatch parallel subagents on same file
- Let implementer write tests (tester's job)
- Ignore failed pre-impl gates for Initiatives (gates exist for a reason)
- Add co-author attribution to commits (you are a tool, not an author)
- Batch commits across multiple tasks (commit each task separately)
If tester can't write tests:
- Don't skip to implementer
- Handle the gap (consult spec, ask user)
- Re-dispatch tester with clarification
Example Workflow
[Load spec, create TodoWrite]
Task 1: Add caching
[Dispatch tester (opus)]
Tester: Wrote 3 tests, all failing (RED)
- test_cache_hit, test_cache_miss, test_ttl_expiry
- Files: tests/test_cache.py
[Dispatch implementer (opus) with test paths]
Implementer: Made tests pass (GREEN)
- Files: src/cache.py
[Review - no issues]
[Mark Task 1 complete]
Task 2, 3, 4: [P] parallel batch
[Dispatch 3 testers in single message]
All testers complete with failing tests
[Dispatch 3 implementers in single message]
All implementers complete, tests passing
[Single review for entire batch]
[Mark Tasks 2, 3, 4 complete]
...
[Final review]
All requirements met
Integration
Use with:
spec-validate→spec-create- Create spec before dispatchspec-clarify- Resolve markers/gates before dispatchcode-test- Tester invokes for TDD methodologycode-implement- Implementer invokes for language guidelinescode-review- Reviewer invokes for review methodologytask-completion-verify- Verify before claiming done
Reference
- subagent-workflow.md - Dispatch templates and YAML reports
- report-format.md - YAML report schemas
- roles/tester.md - Test-writing subagent
- roles/implementer.md - Implementation subagent
- roles/reviewer.md - Review subagent
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?