From agent-workflows
Decomposes PRD into dependency-ordered work units, dispatches parallel agents in isolated worktrees, runs code reviews, and merges verified implementations.
npx claudepluginhub sjarmak/agent-workflows<path/to/prd.md> [--max-passes N] [--max-parallel N] [--dry-run]This skill is limited to using the following tools:
Automated PRD-to-implementation orchestrator. Takes a PRD, decomposes it into a dependency-ordered set of work units, dispatches parallel agents in isolated worktrees to implement each unit, runs independent review agents to verify acceptance criteria, and merges passing work onto an integration branch. Handles retries, evictions, and multi-pass recovery.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Automated PRD-to-implementation orchestrator. Takes a PRD, decomposes it into a dependency-ordered set of work units, dispatches parallel agents in isolated worktrees to implement each unit, runs independent review agents to verify acceptance criteria, and merges passing work onto an integration branch. Handles retries, evictions, and multi-pass recovery.
You are the orchestrator. Your ONLY job is to decompose, dispatch, and land. You do NOT:
You DO:
isolation: "worktree" to dispatch each unit to a separate agentsubagent_type: "code-reviewer" for independent reviews.claude/prd-build-artifacts/CRITICAL: Every work unit MUST be executed by an Agent tool call with isolation: "worktree". You NEVER implement code yourself.
$ARGUMENTS — format: <path/to/prd.md> [--max-passes N] [--max-parallel N] [--dry-run]
Parse:
Read the PRD file. If it does not exist, report an error and stop.
Break the PRD into work units.
npm test passes with 0 failures" IS acceptable.Write the work plan to .claude/prd-build-artifacts/dag.json:
[
{
"id": "unit-kebab-name",
"name": "Human name",
"description": "What and why",
"deps": ["other-id"],
"tier": "trivial|small|medium|large",
"acceptance": ["VERIFIABLE criterion"],
"layer": 0,
"scope": ["path/to/file.ts"],
"status": "pending",
"branch": null,
"pass_number": 1
}
]
Print a summary table, then immediately proceed to Phase 2 (unless --dry-run).
Process layers in topological order. For each layer:
Agent(
description: "prd-build impl: <unit-name>",
isolation: "worktree",
mode: "bypassPermissions",
prompt: <tier-appropriate IMPLEMENT prompt>
)
Send ALL agents for a layer in a single message so they run in parallel.
Agent(
description: "prd-build review: <unit-name>",
subagent_type: "code-reviewer",
isolation: "worktree",
prompt: <REVIEW prompt>
)
Implement work unit "${UNIT_ID}" in this codebase.
WHAT: ${UNIT_DESCRIPTION}
FILES IN SCOPE: ${SCOPE_FILES}
ACCEPTANCE CRITERIA:
${ACCEPTANCE_LIST}
STEPS:
0. (If the project uses bd) Run any worktree setup helper present:
[ -f scripts/bd-worktree-redirect.sh ] && bash scripts/bd-worktree-redirect.sh || true
The helper is idempotent — no-op if the project doesn't use bd.
1. Read the files in scope to understand current code
2. Implement the changes. Stay within scoped files.
3. Write tests for your changes. Run them — they must pass.
4. Commit all changes: git add -A && git commit -m "prd-build: ${UNIT_ID} — ${UNIT_NAME}"
Do NOT ask questions. Output "SUCCESS" or "FAILURE: <reason>" as your final line.
Implement work unit "${UNIT_ID}" in this codebase.
WHAT: ${UNIT_DESCRIPTION}
FILES IN SCOPE: ${SCOPE_FILES}
ACCEPTANCE CRITERIA:
${ACCEPTANCE_LIST}
Execute these phases in order. Do NOT skip any phase.
PHASE 0 — SETUP: (If the project uses bd) Run any worktree setup helper present:
[ -f scripts/bd-worktree-redirect.sh ] && bash scripts/bd-worktree-redirect.sh || true
The helper is idempotent — no-op if the project doesn't use bd.
PHASE 1 — RESEARCH: Read codebase files in scope. Write findings to .claude/prd-build-artifacts/research-${UNIT_ID}.md
PHASE 2 — PLAN: Write implementation plan to .claude/prd-build-artifacts/plan-${UNIT_ID}.md
PHASE 3 — IMPLEMENT: Follow your plan. Write the code. Stay in scope.
PHASE 4 — TEST: Write tests covering ALL acceptance criteria. Run them. Fix failures.
PHASE 5 — COMMIT: git add -A && git commit -m "prd-build: ${UNIT_ID} — ${UNIT_NAME}"
Do NOT ask questions. Output "SUCCESS" or "FAILURE: <reason>" as your final line.
You are a verification agent. You did NOT write this code. Verify each acceptance criterion is met. ACTIVELY TEST — not just read code.
Review work unit "${UNIT_ID}".
UNIT DESCRIPTION: ${UNIT_DESCRIPTION}
ACCEPTANCE CRITERIA:
${ACCEPTANCE_LIST}
PROCEDURE:
1. Run: git log --oneline -5
2. Run: git diff HEAD~1 --stat
3. Run: git diff HEAD~1
4. For EACH criterion: READ the code, FIND the test, RUN the test, VERDICT PASS/FAIL with evidence
5. Check: security issues? extraneous changes outside scope?
OUTPUT:
## Criterion Checklist
- [criterion]: PASS/FAIL — evidence
## Verdict
PASS — all criteria met
OR
FAIL:
- [criterion]: what's wrong and what needs to change
Do NOT fix the code. Do NOT suggest improvements beyond acceptance criteria.
After all agents in a layer complete, merge each passing unit onto the integration branch. Rebase, run tests, and either land or evict with context.
Teardown after merge (MANDATORY). For each unit whose branch lands successfully on the integration branch, remove the subagent's worktree and delete the branch:
git worktree unlock <unit-worktree-path> 2>/dev/null || true
git worktree remove --force <unit-worktree-path>
git branch -D <unit-branch-name> 2>/dev/null || true
The Agent tool returns the worktree path and branch name in its result — capture those when each implement agent completes. Without teardown, .claude/worktrees/agent-* directories accumulate (~24GB+ over a few weeks of normal multi-pass build runs).
For evicted units (review failed, or implement-review loop exhausted), keep the worktree until the eviction record is written so a retry pass can find the artifacts; tear down after the retry decision is final.
Proceed to next layer only after all units in current layer are landed-and-torn-down or evicted.
After all layers processed:
isolation: "worktree" for isolated copies of the repo/prd-build-resume..claude/worktrees/agent-* directory and agent-* branch behind. Phase 3 LAND MUST git worktree remove --force + git branch -D immediately after each successful merge. Skipping this leaks ~MB per unit and makes multi-pass runs unsustainable./research-project to produce a risk-annotated PRD, or /scaffold for build-order planning, or any PRD source