Help us improve
Share bugs, ideas, or general feedback.
From Claude Setup
Orchestrates a full build pipeline from PRD: plans tasks, implements in parallel, and reviews results. Routes simple work to a lighter workflow.
npx claudepluginhub nickmaglowsch/claude-setup --plugin claude-setupHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-setup:build [--brainstorm] <PRD or path to PRD file>[--brainstorm] <PRD or path to PRD file>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are orchestrating the full build pipeline. Follow these steps strictly in order.
Guides developers through the full development pipeline: discover, brainstorm, plan, execute, review, and ship. Invoke when starting work on a bug, feature, improvement, or task.
Executes Plans.md tasks end-to-end in solo, parallel, or full team modes with auto-mode selection based on task count.
Decomposes specs/PRDs/plans into independent tasks, assigns to builder agents for parallel execution in waves respecting dependencies, then integrates results. For fast multi-file feature implementation.
Share bugs, ideas, or general feedback.
You are orchestrating the full build pipeline. Follow these steps strictly in order.
The raw arguments (may include --brainstorm flag):
$ARGUMENTS
Parse flags before proceeding:
$ARGUMENTS starts with or contains --brainstorm, set BRAINSTORM=true and strip --brainstorm to get the clean PRD content.BRAINSTORM=false and the full arguments are the PRD content./claude-setup:build-lite?Before asking auto-commit, worktree, or orchestration questions, spend at most 2-3 minutes on a bounded read-only check:
$ARGUMENTS is a path.Glob/Grep/bounded Read only when needed to identify likely files and whether independent parallel work exists.Route to /claude-setup:build-lite and stop this workflow if the feature appears to be any of:
Proceed with full /claude-setup:build only when the work likely needs 3+ independent implementation tasks that can run in parallel, or when it genuinely exceeds a single warm context (large migrations, broad feature sweeps, multi-package changes with limited file overlap).
If routing to lite, tell the user: "This looks cheaper and equally safe as /claude-setup:build-lite because . Switching to the lite workflow." Then immediately follow skills/build-lite/SKILL.md from Step 1 using the same $ARGUMENTS, skipping all remaining full /claude-setup:build steps.
Skip if --brainstorm was passed — brainstorm mode is itself a form of pre-planning sharpening.
Treat the PRD as underspecified if any of: shorter than ~3 sentences; expresses a desire without naming user-facing behavior/scope/success criteria; contains hedges ("not sure if...", "maybe..."); the chat session has no prior design context.
If underspecified, check the repo root for CONTEXT.md / CONTEXT-MAP.md and offer via AskUserQuestion:
/claude-setup:grill-with-docs first" (only when CONTEXT doc detected)/claude-setup:grill-me first"--brainstorm"For grill/brainstorm choices, exit cleanly: "Stopping /claude-setup:build. Re-run after sharpening." Do not invoke the chosen skill yourself — the user re-invokes manually so the grilling session has a clean context. For "Continue anyway", proceed to Step 0.1.
Ask: "Enable auto-commit and PR?" → AUTO_COMMIT. If false: set BRANCH_ACTION=none, COMMIT_MODE=none, skip to Step 0.1b.
If true:
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD). If main/master: BRANCH_ACTION=new. Else ask: "Branch <name> exists — create new or commit here?" → BRANCH_ACTION=new|current.COMMIT_MODE=squash|per-wave|per-task-at-end:
feat/<3-5-word-slug> from PRD → AUTO_COMMIT_BRANCH.BRANCH_ACTION=new:
git fetch origin; DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||') (fallback main).DEFAULT_BRANCH / CURRENT_BRANCH / Other → BASE_BRANCH.git checkout -b or git worktree add -b depending on the worktree choice.Ask: "Run workflow in a new git worktree?" → USE_WORKTREE. Default WORKTREE_PATH="" (set only if a worktree is created).
If USE_WORKTREE=false:
AUTO_COMMIT=true AND BRANCH_ACTION=new: git checkout -b <AUTO_COMMIT_BRANCH> <BASE_BRANCH> (on failure append -2 and retry once).If USE_WORKTREE=true:
If AUTO_COMMIT=true AND BRANCH_ACTION=current: worktrees can't share a branch. Ask: "Switch to a new branch, or skip the worktree?"
BRANCH_ACTION=new, generate AUTO_COMMIT_BRANCH=feat/<slug> if not already, repeat the base-branch Q&A from Step 0.1 step 4.USE_WORKTREE=false and use the false branch above.Resolve WT_BRANCH and WT_BASE:
AUTO_COMMIT=true: WT_BRANCH=$AUTO_COMMIT_BRANCH, WT_BASE=$BASE_BRANCH.feat/<slug>), then run the same git fetch origin + base-branch Q&A.Sanitize $WT_BRANCH to a filesystem-safe path segment (/→-, strip non-[A-Za-z0-9._-], trim dashes) → WT_PATH_SEG.
git worktree add -b "$WT_BRANCH" ".claude-worktrees/$WT_PATH_SEG" "$WT_BASE". On collision append -2 to both and retry once; if still failing, abort. If the retry succeeded and AUTO_COMMIT=true, set AUTO_COMMIT_BRANCH=$WT_BRANCH so downstream steps target the renamed branch.
cd ".claude-worktrees/$WT_PATH_SEG". Set WORKTREE_PATH=".claude-worktrees/$WT_PATH_SEG" for the final report. All subsequent steps run inside the worktree.
Check ~/.claude/user-preferences.json for a saved orchestration mode preference:
"orchestrationMode" is parallel or agent-teams, log "Using saved orchestration mode: <value>", set ORCHESTRATION_MODE to that value, and skip the rest of this step."orchestrationMode" exists but has any other value, warn that the saved value is invalid and continue to the prompt below.Otherwise ask via AskUserQuestion ("How should tasks be implemented?"):
parallel — sub-agent approach with wave-based parallel executionagent-teams — Claude Code's native Agent Teams featureThen ask: "Save as default?" If yes, persist to ~/.claude/user-preferences.json:
MODE=<ORCHESTRATION_MODE> python3 -c "
import json, os
p = os.path.expanduser('~/.claude/user-preferences.json')
prefs = json.load(open(p)) if os.path.exists(p) else {}
prefs['orchestrationMode'] = os.environ['MODE']
json.dump(prefs, open(p, 'w'), indent=2)
"
Run the following in Bash to determine the branch-scoped task directory:
RAW_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
if [ -z "$RAW_BRANCH" ] || [ "$RAW_BRANCH" = "HEAD" ]; then
SHORT_SHA=$(git rev-parse --short HEAD 2>/dev/null || echo "")
RAW_BRANCH=${SHORT_SHA:+detached-$SHORT_SHA}
fi
if [ -z "$RAW_BRANCH" ]; then
echo "Warning: not a git repo — using tasks/ as task directory" >&2
TASKS_DIR="tasks"
else
SANITIZED=$(echo "$RAW_BRANCH" | tr '/' '-' | tr -cs 'A-Za-z0-9._-' '-' | sed 's/^-*//; s/-*$//')
[ -z "$SANITIZED" ] && SANITIZED="unknown-branch"
TASKS_DIR="tasks/$SANITIZED"
fi
Store TASKS_DIR as a session variable — use it everywhere below.
Use Bash to run rm -rf "$TASKS_DIR" to clear only this branch's task directory.
This prevents stale task files from being picked up by the orchestrator.
Launch prd-task-planner with subagent_type: "prd-task-planner" and prompt TASKS_DIR=$TASKS_DIR\nMODE: BRAINSTORM\n\n<clean PRD content>. Save the returned agent ID — this same agent will be resumed in Step 1a.
Read $TASKS_DIR/design-options.md. Present each option via AskUserQuestion (option name → label, summary/trade-offs → description). Include a "Custom direction" option. Store the chosen option as CHOSEN_DESIGN.
If BRAINSTORM=true: resume the agent from Step 0.5 with MODE: DISCOVERY\nChosen design direction: <CHOSEN_DESIGN>\n\n<clean PRD content>. The agent already has codebase context and will skip re-exploration.
If BRAINSTORM=false: launch fresh with subagent_type: "prd-task-planner" and TASKS_DIR=$TASKS_DIR\nMODE: DISCOVERY\n\n<PRD content>.
Either way, tell it to output questions to $TASKS_DIR/planning-questions.md. Save the returned agent ID — you will resume this same agent in Step 1c.
Read $TASKS_DIR/planning-questions.md. Present each question to the user via AskUserQuestion (use the file's questions, context, and options). Collect all answers.
Resume the same agent from Step 1a with MODE: GENERATE prepended, the formatted user answers, and instruction to generate $TASKS_DIR/updated-prd.md and the task files. Wait, then confirm task files were created.
Always runs. Read all task-*.md files; for each, extract task number, title, ## Objective first line, and ## Dependencies. Present as:
## Task Plan (N tasks)
1. task-01-name — [Objective]
Dependencies: None
2. task-02-name — [Objective]
Dependencies: task-01
...
Add: "You can also open and edit any file in $TASKS_DIR/ directly before proceeding."
Use AskUserQuestion: "How would you like to proceed?"
prd-task-planner agent (ID from Step 1a) with MODE: GENERATE\n\nUser feedback on the task plan:\n<feedback>\n\nPlease regenerate the task files incorporating this feedback., wait, then loop back to the top of Step 1d.Read all $TASKS_DIR/task-*.md files and classify FAST_PATH=true if ANY of:
Otherwise FAST_PATH=false (3+ tasks with real parallelism opportunities).
The planner already self-checked dependency soundness, file conflicts, PRD coverage, sizing, and TDD consistency before returning — no separate plan-review pass is needed. Unresolved ambiguities (if any) appear in $TASKS_DIR/updated-prd.md under ## Open Questions, which the user saw in Step 1d.
FAST_PATH=true) — Direct implementationIf ORCHESTRATION_MODE=agent-teams: inform the user "Fast-path detected — using direct implementation instead of Agent Teams; orchestration overhead is not justified." Skip the env-var setup from Step 0.2.
Implement tasks yourself, sequentially, in the current session. For each task file in order: (1) read the task file fully, (2) read referenced context files, (3) implement, (4) if ## TDD Mode is present, follow Section B of references/agents/tdd-mode.md (RED → adequacy check → GREEN → REFACTOR → VERIFY). (5) write $TASKS_DIR/notes/task-NN.md with Implementation Notes — same template the task-implementer agent uses (Decisions / Deviations / Trade-offs / Risks; one bullet per category, or a single No non-obvious decisions. line if all choices were obvious). After all tasks: concatenate $TASKS_DIR/notes/task-*.md (sorted) into $TASKS_DIR/implementation-notes.md with a # Implementation Notes header.
Commit handling: if COMMIT_MODE=per-wave, after each task run git add -A && git diff --staged --quiet || git commit -m "feat: <task-objective>". If COMMIT_MODE=per-task-at-end, skip — commits happen in Step 2.5b.
Fast path keeps continuous session context across tasks (no cold reads) and avoids the orchestrator overhead.
FAST_PATH=false) — Run orchestratorIf ORCHESTRATION_MODE=parallel (default):
Launch the parallel-task-orchestrator agent using the Task tool with:
subagent_type: "parallel-task-orchestrator"TASKS_DIR=$TASKS_DIR
Read and execute all tasks from `$TASKS_DIR/`
Batch same-wave tasks that share module/directory context when safe.
Keep sub-agent returns short; detailed decisions must go in `$TASKS_DIR/notes/`.
COMMIT_MODE=per-wave: Include COMMIT_MODE=per-wave in the launch prompt so the orchestrator commits after each wave. Also include: Use commit subject prefix 'feat:' instead of 'refactor:' for per-wave commits.COMMIT_MODE=squash, per-task-at-end, or AUTO_COMMIT=false: Launch normally with no additional commit instructions.Wait for it to complete. Note any issues reported.
If ORCHESTRATION_MODE=agent-teams (Beta):
Before starting: Verify no Agent Teams team is already active in this session. If team creation fails, inform the user and fall back to the default
parallel-task-orchestratorapproach automatically. Seeagent-teams-orchestrator.md→ Known Limitations for details.
First, enable the required env var by finding the user's settings file (check .claude/settings.local.json, then .claude/settings.json, then ~/.claude/settings.json) and adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 to the env object, preserving all existing settings. If no settings file exists, create .claude/settings.local.json with the env var.
Do NOT spawn a sub-agent. Instead, execute Agent Teams orchestration directly in this session:
agents/agent-teams-orchestrator.mdTASKS_DIR=$TASKS_DIR so teammates know where to read and write task files$TASKS_DIR/implementation-notes.md and $TASKS_DIR/execution-metrics.mdNote: Per-wave commits in Agent Teams mode are handled by the agent-teams-orchestrator when COMMIT_MODE=per-wave is passed in the session context. Per-task-at-end commits are handled by the skill layer in Step 2.5b (runs after Agent Teams execution completes). Auto-commit/branch handling (if AUTO_COMMIT=true) applies identically to both modes.
After Agent Teams execution completes (whether successful or not), clean up the env var: read the settings file that was modified above, remove CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS from the env object, and write it back. If the env object is now empty, remove it entirely. This prevents the beta env var from persisting across future sessions.
Before reviewing, run a quick build/lint check to catch obvious breakage:
package.json, Makefile, Cargo.toml, or similar build config in the project rootnpm run build, pnpm build, make, cargo check)After the build check, run the project's full test suite to catch regressions and verify implementation:
package.json (check for "test" script), pytest.ini/pyproject.toml, go.mod, Cargo.toml, or other test framework confignpm test, pnpm test, pytest, go test ./..., cargo test)A /simplify pass applies reuse/simplification/efficiency/altitude cleanups to the changes. It mutates code, so it must run against a verified-green baseline and re-verify afterward.
Guard: Only offer this step if Step 2c passed (or was skipped with no detected failures). If Step 2c reported failures the user chose to proceed past, skip this step entirely — never simplify on a red baseline. Set SIMPLIFY_RAN=false.
Use AskUserQuestion: "Run a /simplify quality cleanup pass on the changes before review?"
SIMPLIFY_RAN=false and proceed to Step 2.5If "Yes": invoke the simplify skill via the Skill tool. Tell it to scope to the full branch diff against the base branch, so changes already committed in per-wave/per-task-at-end modes are covered — not just uncommitted edits. Wait for it to finish.
Re-verify behavior: re-run the Step 2b build check command and the Step 2c test command.
git checkout -- <files> / git restore) and continue, or (c) stop. Do not silently proceed.SIMPLIFY_RAN=true.Simplify's edits are left uncommitted and flow into the existing Step 2.5b commit logic: included in the squash commit, swept into the per-wave post-run cleanup commit, or caught by the per-task-at-end miscellaneous-changes commit.
Skip if AUTO_COMMIT=false.
2.5a Safety: Run git rev-parse --abbrev-ref HEAD. If main/master: abort ("Auto-commit aborted: on main/master. Commit manually.") → proceed to Step 3.
2.5b Commit: behavior depends on COMMIT_MODE.
squash: read all $TASKS_DIR/task-*.md ## Objective lines, then git add -A && git commit -m "feat: <PRD summary>" with body -m containing one bullet per task objective (no cap). Subject ≤72 chars.
per-wave: commits already made by the orchestrator (or fast-path). git add -A; if anything's still staged, git commit -m "feat: post-run cleanup"; otherwise skip.
per-task-at-end: parallel run is complete. For each task-NN-*.md in numerical order:
git restore --staged . to clear staging## Target Files section for its file listgit add <file1> <file2> ... (only that task's files), then git commit -m "feat: <task objective>"
After all per-task commits: git add -A && git diff --staged --quiet || git commit -m "feat: miscellaneous changes" to catch files not covered by any task's manifest.2.5d Push: git push -u origin <branch-name>. On failure, show manual command and continue.
2.5e PR: Run gh auth status 2>/dev/null && echo GH_OK || echo GH_UNAVAILABLE.
GH_OK: Create PR body (1-2 sentence summary + "## Changes" task objectives + "## Review Notes" placeholder). Run gh pr create --title "feat: <desc>" --body "<body>" --base main. Display URL.GH_UNAVAILABLE: Display ready-to-copy gh pr create command.2.5f Report: Branch: <name> | Commits: <N> | Push: ok/failed | PR: <url or manual>
Detect TDD usage by grepping any task-*.md for ## TDD Mode. Note whether $TASKS_DIR/implementation-notes.md exists.
Before launching the reviewer, gather a compact review packet:
DEFAULT_BRANCH is not set, resolve it: DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||') (fallback main if empty or error).git diff --stat "$DEFAULT_BRANCH"...HEAD, git diff --name-only "$DEFAULT_BRANCH"...HEAD, and git log --oneline "$DEFAULT_BRANCH"..HEAD.Launch code-reviewer with:
subagent_type: "code-reviewer"TASKS_DIR=$TASKS_DIR\nReview all changes against $TASKS_DIR/updated-prd.md and write the review report to $TASKS_DIR/review-report.md.\nStart from this compact review packet: <diff stat, changed file list, commit list, build/test summaries>. Review diff-scoped changes first. Read changed files and requirement files as needed; only expand to unchanged files when required to verify behavior, contracts, or conventions.implementation-notes.md exists: tell it to read this file for implementer decision context.SIMPLIFY_RAN=true: append A /simplify cleanup pass already ran on these changes — do NOT re-flag reuse, simplification, efficiency, or altitude items as Minor issues. Focus on correctness, PRD compliance, security, and test adequacy. so the report stays signal-dense.Wait for it to complete.
Read $TASKS_DIR/review-report.md. Check if the ### Critical section contains any items.
If no critical issues: proceed directly to Step 4.
If critical issues are found:
Present the list of critical issues to the user — one bullet per issue, with file:line references.
Use AskUserQuestion: "How should we handle the N critical issues?"
If "Auto-fix":
01, 02, ...), launch a task-implementer sub-agent in parallel with:
TASKS_DIR=$TASKS_DIR so it can find shared-context$TASKS_DIR/notes/autofix-<idx>.md (e.g., notes/autofix-01.md) instead of the standard task-NN.md path — there is no task file for auto-fix runs, so the standard NN-derivation rule does not apply.$TASKS_DIR/updated-prd.md. Write the updated report to $TASKS_DIR/review-report.md (overwrite).If "Skip — I'll fix them": proceed to Step 4 with issues unfixed. Do not spawn any sub-agents. The Step 4 report will list the open critical issues so the user has them in writing.
If "Stop here": halt the pipeline. Print a short state summary (branch name, tasks completed, critical-issue count, path to $TASKS_DIR/review-report.md) and exit cleanly. Do not run Step 4. Do not spawn any sub-agents. Do not commit or push.
Check if $TASKS_DIR/execution-metrics.md exists (produced by the orchestrator in full-path mode). If not (fast-path mode), generate equivalent metrics from your own execution.
Summarize the full pipeline run to the user:
## Build Complete
### Planning
- [X tasks created]
### Implementation
- [tasks completed / total]
- [any issues]
### Build Check
- [passed / failed / skipped]
### Testing
- [test suite status: all passed / X failed / not detected]
- [if TDD: TDD compliance summary]
### Simplify
- [ran — behavior re-verified green / ran — broke X, user chose Y / skipped / not offered (red baseline)]
### Execution Metrics
- Tasks: [completed/total] | Waves: [N] | Retries: [N]
- TDD: [N/M tasks used TDD] | TDD skipped: [N (reasons)]
- Implementation notes: [see $TASKS_DIR/implementation-notes.md or "inline above"]
### Review
- [compliance score]
- [critical issues if any]
- [if implementation notes reviewed: decision assessment summary]
### Auto-Commit
- [skipped — not enabled]
OR
- Branch: <branch-name>
- PR: <url or "manual command displayed">
### Worktree
- [omit this section entirely if `WORKTREE_PATH` is empty]
OR
- Path: <WORKTREE_PATH>
- Cleanup: `git worktree remove <WORKTREE_PATH>` (run from the original repo root)
### Next Steps
- [what the user should do — e.g., run tests, fix issues, deploy]