Use when executing a leaf PLAN.md in an environment that can dispatch workers (Claude Code subagents), when a leader is coordinating per-task dispatch + review across a plan tree, or when Phase 6 of ultra-planner flow runs in team mode. NOT for single-worker execution (use ultra-implementing-solo) and NOT for single-feature plans outside a tree (use superpowers:subagent-driven-development directly).
LEADER-ONLY: This skill is for the dispatching leader that owns SHAs, parallelism scheduling, two-stage review gates, and 3-tier rollback. Worker subagents invoked by this leader should defer — they implement one assigned task per their brief and must not load or act on this skill.
Executes a leaf-node PLAN.md as a leader that dispatches fresh workers per task, reviews each in two stages, and gates every handoff. Leader owns: session state, sibling-INTERFACE pinning, cross-node context curation, parallelism, divergence logging, rollback. Workers own: implementation of one assigned task.
Core principle: Workers NEVER read sibling nodes. The leader reads sibling INTERFACE.md files once, pins SHAs, pastes required types verbatim into each brief. Fixes drift at the leader level, keeps worker context clean.
State file naming: uses per-leaf nodes/<path>/SESSION_STATE.md (per-execution leader state for this leaf's run) — distinct from the tree-level docs/ultra-plans/<slug>/SESSION.md (cross-session planner brain used by ultra-planner and ultra-implementing-solo). Separate names avoid collision.
Invoke and via the Skill tool. This skill EXTENDS them with hierarchical discipline (SHA pinning, leader-curated context, DIVERGENCE_LOG, HANDOFF) and baked-in quality enforcement. Not loaded → stop and load.
superpowers:subagent-driven-developmentultra-code-standards| Signal | Use? |
|---|---|
| Leaf node has PLAN.md + SPEC.md + INTERFACE.md stable | Yes |
| Subagent/Task dispatch available (Claude Code) | Yes |
| Plan depends on 1+ sibling INTERFACE.md | Yes |
| Phase 6 of ultra-planner flow, team mode | Yes |
| No subagent dispatch available | No — use ultra-implementing-solo |
| Single-feature plan outside a tree | No — use superpowers:subagent-driven-development |
| Interior node (has children) | No — decompose, don't implement |
REQUIRED: The leader loads ultra-code-standards via the Skill tool. Workers load it too (included in every brief's "Skills to load"). Reviewers check against it mechanically. If ultra-code-standards is not loaded → stop and load it.
Key standards enforced: LOC limits (1k soft / 2k hard), no duplicated code, proactive refactoring, clean separation of concerns, meaningful names, best practices. See the skill for full details and the reviewer checklist.
Operate on a leaf node path nodes/<path>/. Do not skip or reorder.
Confirm leaf status + prerequisites. SPEC.md, INTERFACE.md, PLAN.md all present. Parent INTERFACE.md readable. Every sibling in depends-on has a readable INTERFACE.md. Missing → stop, file P0 interview item.
Create worktree. (LEADER-ONLY) Run superpowers:using-git-worktrees to isolate work. No dispatch touches main. If dispatched as a subagent, skip this step and report back to the leader.
Pre-flight: pin sibling INTERFACE SHAs + frozen-shadow gate. Read every sibling INTERFACE.md you depend on OR feed into. Record path + git SHA (or content hash) in nodes/<path>/SESSION_STATE.md under ## Sibling INTERFACE pins. Copy the exact types/contracts verbatim — SESSION_STATE.md is the canonical copy for this execution. If nodes/<leaf>/SHADOW/ exists, read SHADOW/META.md and require STATUS: frozen or STATUS: graduated; consume the frozen shadow as the architecture spec for all downstream briefs. STATUS: planning → STOP. Message: "shadow not yet reviewed — run ultra-shadow-review first."
Extract all PLAN.md tasks. Read PLAN.md once, copy each task's full text into SESSION_STATE.md. For each: which sibling types it touches, which local files it owns, whether it's parallelizable. Build a TodoWrite list.
Declare parallelism schedule. Default serial. Opt-in to parallel ONLY when every parallel worker has an exclusive file-ownership declaration (disjoint write-sets). Record the schedule in SESSION_STATE.md (e.g. 1 → 2 → {3,4,5} → 6 → {7,8}). Never parallelize workers that share a file.
Per-task dispatch loop. (LEADER-ONLY — dispatches implementer + reviewer subagents via Task tool.) If dispatched as a subagent, defer to leader and do not attempt to dispatch further workers. For each task (or parallel cohort):
Mid-execution checkpoint review (every parallel cohort boundary OR every 3 serial tasks). (LEADER-ONLY) Dispatch a code-reviewer subagent over all commits since the last checkpoint. Reviewer brief:
If ISSUES: dispatch a fixer subagent with the full issue list and Code Standards. Fixer has write access to all files in the leaf's ownership set. After fix, re-dispatch the same reviewer. Max 2 cycles. Persistent issues → log to DIVERGENCE_LOG.md, continue with noted technical debt.
Record in SESSION_STATE.md: Checkpoint after task N: [GREEN | N issues fixed | N issues deferred].
Dispatch brief template — every brief MUST contain:
ultra-test-driven-development (RED-GREEN-REFACTOR discipline, Iron Law) and ultra-writing-tests (test-writing craft: fast-test preference, DI-seam discipline, contract smoke tests) as standard. Workers MUST also load ultra-code-standards for LOC limits, duplication rules, and quality bar. Prefer fast tests per ultra-writing-tests — unit <100ms, integration <1s, context-dependent.ultra-code-standards) are non-negotiable. Specifically: no file over 1,000 LOC (soft) / 2,000 LOC (hard), no duplicated logic, meaningful names, clean separation of concerns. Worker must check LOC on every touched file before reporting DONE.toMatchObject in integration tests — deep-equal required", "do not commit a file exceeding 2,000 lines", "do not duplicate logic that exists in another file — extract to shared module")Freshness re-check before contract tests. Before dispatching any contract/integration task, re-read the relevant sibling INTERFACE.md, compare SHA to pin. Drift → pause, write DIVERGENCE_LOG entry, decide (patch plan vs escalate) before dispatching.
DIVERGENCE_LOG.md discipline. When a task reveals a plan bug (type mismatch, missing sibling field, wrong task shape), append an entry to nodes/<path>/DIVERGENCE_LOG.md: what was wrong, evidence, resolution (amend-plan / queue-interview-item / rollback / escalate). Never silently absorb plan bugs.
Rollback tiers (pick smallest that applies):
git reset --hard <last-green-SHA> → patch PLAN.md → log to DIVERGENCE_LOG → re-dispatch from divergence. User informed.Final review gate. (LEADER-ONLY — dispatches code-reviewer + cross-doc-review + shadow-drift subagents.) If dispatched as a subagent, defer to leader. After the last task: dispatch a final code-reviewer over all commits in the worktree. For multi-task interface audits, delegate to ultra-cross-doc-review. Run tsc --noEmit / test suite as leader sanity check. If SHADOW/ was gated frozen in step 3, dispatch ultra-shadow-drift as a post-implementation drift check before writing HANDOFF.md.
Write HANDOFF.md. Record: commit range, test results, sibling INTERFACE paths + SHAs built-against, known gaps, divergence entries. This is the drift-detection anchor. Then invoke superpowers:finishing-a-development-branch.
superpowers:subagent-driven-development loadedtoMatchObject (or other partial-match) in anchor integration testsultra-code-standards)toMatchObject, any, invented fields). Every brief needs concrete anti-patterns.ultra-code-standards. Workers need concrete, checkable criteria — "no file over 1,000 LOC" not "keep files small."[ -d ~/src/ultra-skills ] && printf '\n---\n*Dogfooding: patch this skill in place when you find gaps.*\n'