Orchestrates detailed executable plans for project phases by delegating research, planning, verification to subagents before building.
From pbrnpx claudepluginhub sienklogic/plan-build-run --plugin pbrThis skill is limited to using the following tools:
decimal-phase-calc.mdtemplates/checker-prompt.md.tmpltemplates/completion-output.md.tmpltemplates/gap-closure-prompt.md.tmpltemplates/planner-prompt.md.tmpltemplates/researcher-prompt.md.tmpltemplates/revision-prompt.md.tmplSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agentic engineering workflows: eval-first loops, 15-min task decomposition, model routing (Haiku/Sonnet/Opus), AI code reviews, and cost tracking.
STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.
You are the orchestrator for /pbr:plan. This skill creates detailed, executable plans for a specific phase. Plans are the bridge between the roadmap and actual code — they must be specific enough for an executor agent to follow mechanically. Your job is to stay lean, delegate heavy work to Task() subagents, and keep the user's main context window clean.
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Additionally for this skill:
Before ANY tool calls, display this banner:
╔══════════════════════════════════════════════════════════════╗
║ PLAN-BUILD-RUN ► PLANNING PHASE {N} ║
╚══════════════════════════════════════════════════════════════╝
Where {N} is the phase number from $ARGUMENTS. Then proceed to Step 1.
.planning/config.json exists (run /pbr:begin first).planning/ROADMAP.md exists with at least one phase.planning/REQUIREMENTS.md existsParse $ARGUMENTS according to skills/shared/phase-argument-parsing.md.
/pbr:plan <N> — Plan phase N
Parse the phase number and optional flags:
| Argument | Meaning |
|---|---|
3 | Plan phase 3 |
3 --skip-research | Plan phase 3, skip research step |
3 --assumptions | Surface assumptions before planning phase 3 |
3 --gaps | Create gap-closure plans for phase 3 (from VERIFICATION.md) |
3 --teams | Plan phase 3 using specialist agent teams |
3 --model opus | Use opus for all researcher, planner, and checker spawns in phase 3 |
| (no number) | Use current phase from STATE.md |
3 --preview | Preview what planning would produce for phase 3 without spawning agents |
| Subcommand | Meaning |
|---|---|
add | Append a new phase to the end of the roadmap |
insert <N> | Insert a new phase at position N (uses decimal numbering) |
remove <N> | Remove phase N from the roadmap |
STOP. Before ANY context loading or Step 1 work, you MUST check whether $ARGUMENTS looks like freeform text rather than a valid invocation. This check is non-negotiable. Valid patterns are:
3, 03) or decimal (3.1)add, insert <N>, remove <N>3 --skip-research, 3 --assumptions, 3 --gaps, 3 --teamscheck (legacy alias)If $ARGUMENTS does NOT match any of these patterns — i.e., it contains freeform words that are not a recognized subcommand or flag — then stop execution and respond:
`/pbr:plan` expects a phase number or subcommand.
Usage:
/pbr:plan <N> Plan phase N
/pbr:plan <N> --gaps Create gap-closure plans
/pbr:plan add Add a new phase
/pbr:plan insert <N> Insert a phase at position N
/pbr:plan remove <N> Remove phase N
Then suggest the appropriate skill based on the text content:
| If the text looks like... | Suggest |
|---|---|
| A task, idea, or feature request | /pbr:todo to capture it, or /pbr:explore to investigate |
| A bug or debugging request | /pbr:debug to investigate the issue |
| A review or quality concern | /pbr:review to assess existing work |
| Anything else | /pbr:explore for open-ended work |
Do NOT proceed with planning. The user needs to use the correct skill.
Self-check: If you reach Step 1 without having matched a valid argument pattern above, you have a bug. Stop immediately and show the usage block.
Execute these steps in order for standard /pbr:plan <N> invocations.
Reference: skills/shared/config-loading.md for the tooling shortcut (state load, plan-index, phase-info) and config field reference.
$ARGUMENTS for phase number and flags
--model <value> is present in $ARGUMENTS, extract the value (sonnet, opus, haiku, inherit). Store as override_model. When spawning researcher, planner, and plan-checker Task() agents, use override_model instead of the config-derived model values. If an invalid value is provided, display an error and list valid values..planning/config.json for settings (see config-loading.md for field reference)
CRITICAL (hook-enforced): Write .active-skill NOW. Write the text "plan" to .planning/.active-skill using the Write tool.node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth to get the effective feature/gate settings for the current depth. Store the result for use in later gating decisions..planning/phases/{NN}-{slug}/.planning/STATE.md.planning/CONTEXT.md (project-level) OR .planning/phases/{NN}-{slug}/CONTEXT.md (phase-level). If NEITHER exists, warn: "Phase {N} has no CONTEXT.md. Consider running /pbr:discuss {N} first to capture your preferences. Continue anyway?" If user says no, stop. If yes, continue. If at least one exists, proceed without warning.If --preview is present in $ARGUMENTS:
Detect the --preview flag and extract the phase number.
Render the following dry-run banner:
╔══════════════════════════════════════════════════════════════╗
║ DRY RUN — /pbr:plan {N} --preview ║
║ No researchers or planners will be spawned ║
╚══════════════════════════════════════════════════════════════╝
Show the 5 steps that would occur:
Show estimated agent spawns: ~2-4 agents (1-2 researchers + 1 planner + 1 plan-checker)
Show output location: .planning/phases/{NN}-{slug}/PLAN-NN.md
STOP — do not proceed to Step 2.
If phase already has plans:
skills/shared/gate-prompts.md):
question: "Phase {N} already has plans. Re-plan from scratch?"
header: "Re-plan?"
options:
Init-first pattern: When spawning agents, pass the output of node plugins/pbr/scripts/pbr-tools.js init plan-phase {N} as context rather than having the agent read multiple files separately. This reduces file reads and prevents context-loading failures.
Read context file PATHS and metadata. Build lean context bundles for subagent prompts — include paths and one-line descriptions, NOT full file bodies. Agents have the Read tool and will pull file contents on-demand.
1. Read .planning/ROADMAP.md — extract current phase goal, dependencies, requirements
2. Read .planning/REQUIREMENTS.md — extract requirements mapped to this phase
3. Read .planning/CONTEXT.md (if exists) — extract only the `## Decision Summary` section (everything from `## Decision Summary` to the next `##` heading). If no Decision Summary section exists (legacy CONTEXT.md), fall back to extracting the full `## Decisions (LOCKED...)` and `## Deferred Ideas` sections.
4. Read .planning/phases/{NN}-{slug}/CONTEXT.md (if exists) — extract only the `## Decision Summary` section. Fall back to full locked decisions + deferred sections if no Decision Summary exists.
5. Read .planning/config.json — extract feature flags, depth, model settings
6. List prior SUMMARY.md file paths and extract frontmatter metadata only (status, provides, key_files). Do NOT read full SUMMARY bodies — agents pull these on-demand via Read tool.
7. Read .planning/research/SUMMARY.md (if exists) — extract research findings
Digest-select depth for prior SUMMARYs (Step 6):
Reference: skills/shared/digest-select.md for the full depth rules and examples. In short: direct dependencies get frontmatter + key decisions, transitive get frontmatter only, 2+ back get skipped.
Collect all of this into a context bundle that will be passed to subagents.
--assumptions flag)IMPORTANT: This step is FREE (no subagents). It happens entirely inline.
Before spawning any agents, present 4 assumptions to the user — one each for: approach (how the phase will be implemented), key technology, architecture, and scope boundary. For each, ask the user to confirm or correct. Record corrections as new CONTEXT.md locked decisions. After all assumptions are confirmed/corrected, continue to Step 4.
Skip this step if ANY of these are true:
--skip-research flag is set--gaps flag is setfeatures.research_phase: falseTo check: run node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js config resolve-depth and read profile["features.research_phase"]. This replaces checking features.research_phase and depth separately -- the depth profile already incorporates both.
Conditional research (standard/balanced mode): When the profile has features.research_phase: true, also check whether .planning/codebase/ or .planning/research/ already contains relevant context for this phase. If substantial context exists (>3 files in codebase/ or a RESEARCH.md mentioning this phase's technologies), skip research and note: "Skipping research -- existing context found in {directory}." This implements the balanced mode's "conditional research" behavior.
If research is needed:
Display to the user: ◐ Spawning researcher...
Spawn a researcher Task():
Task({
subagent_type: "pbr:researcher",
prompt: <phase research prompt>
})
NOTE: The pbr:researcher subagent type auto-loads the agent definition. Do NOT inline it.
Path resolution: Before constructing the agent prompt, resolve ${CLAUDE_PLUGIN_ROOT} to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
Read ${CLAUDE_SKILL_DIR}/templates/researcher-prompt.md.tmpl and use it as the prompt template for spawning the researcher agent. Fill in the placeholders with phase-specific context:
{NN} - phase number (zero-padded){phase name} - phase name from roadmap{goal from roadmap} - phase goal statement{REQ-IDs mapped to this phase} - requirement IDs{dependencies from roadmap} - dependency list<project_context> and <prior_work> blocks per the shared partial (templates/prompt-partials/phase-project-context.md.tmpl): Decision Summary for context, manifest table for prior workPrepend this block to the researcher prompt before sending:
<files_to_read>
CRITICAL (no hook): Read these files BEFORE any other action:
1. .planning/ROADMAP.md — phase goals, dependencies, and structure
2. .planning/REQUIREMENTS.md — scoped requirements for this phase (if exists)
</files_to_read>
Wait for the researcher to complete before proceeding.
After the researcher completes, check the Task() output for a completion marker:
## RESEARCH COMPLETE is present: proceed to planner## RESEARCH BLOCKED is present: warn the user that research could not complete, ask if they want to proceed with limited context or stopCRITICAL (no hook): Run pre-planner briefing before spawning the planner. Do NOT skip this step.
Consolidate seed scanning and deferred idea surfacing into a single lightweight Task():
Task({
subagent_type: "pbr:general",
model: "haiku",
prompt: "Pre-planner briefing for Phase {NN} ({phase-slug}).
1. SEED SCANNING:
Run: `node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js seeds match {phase-slug} {phase-number}`
If `matched` is non-empty, output a ## Seeds section listing each seed name, description, and content.
If empty, output: ## Seeds\nNo matching seeds found.
2. DEFERRED IDEAS:
Read `.planning/CONTEXT.md`. If it has a section containing 'deferred' or 'ideas' (case-insensitive),
extract items that mention Phase {NN} or keywords matching the phase slug.
If relevant items found, output a ## Deferred Ideas section listing them.
If none found, output: ## Deferred Ideas\nNo relevant deferred items.
Output format: Return both sections as markdown. End with ## BRIEFING COMPLETE."
})
After the Task() completes:
If ## Seeds section contains matches:
gates.confirm_seeds is true in config: present them to the user via AskUserQuestion (pattern: yes-no-pick from skills/shared/gate-prompts.md):
question: "Include these {N} seeds in planning?"
header: "Seeds?"
options:
- label: "Yes, all" description: "Include all {N} matching seeds"
- label: "Let me pick" description: "Choose which seeds to include"
- label: "No" description: "Proceed without seeds"
gates.confirm_seeds is false (default): automatically include all matching seeds in planner context without prompting. Log: "Including {N} seeds automatically (gates.confirm_seeds=false)."If ## Deferred Ideas section has items:
gates.confirm_deferred is true in config: present via AskUserQuestion (pattern: yes-no from skills/shared/gate-prompts.md):
question: "Include these deferred ideas in planning context?"
Deferred ideas to consider:gates.confirm_deferred is false (default): automatically append deferred ideas to planner context without prompting. Log: "Including deferred ideas automatically (gates.confirm_deferred=false)."If both sections are empty: proceed silently to Step 5 (no AskUserQuestion needed)
If --teams flag is set OR config.parallelization.use_teams is true, spawn 3 parallel planner agents (architect, security, test) then a synthesizer to merge their outputs. See references/agent-teams.md for agent role definitions, output paths (.planning/phases/{NN}-{slug}/team/), and prompt content for each role.
If --teams is NOT set and config.parallelization.use_teams is false or unset, proceed with the single-planner flow below.
Learnings injection (opt-in): Check for planning and estimation learnings before spawning the planner:
node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "estimation,planning,process" 2>/dev/null
If non-empty JSON array returned:
Write to temp file and note as {learnings_temp_path}:
node {resolved_plugin_root}/scripts/pbr-tools.js learnings query --tags "estimation,planning,process" > /tmp/pbr-learnings-$$.md
Add as an additional files_to_read item in the planner prompt below
If no learnings or command fails: omit.
Display to the user: ◐ Spawning planner...
Spawn the planner Task() with all context inlined:
Task({
subagent_type: "pbr:planner",
prompt: <planning prompt>
})
NOTE: The pbr:planner subagent type auto-loads the agent definition.
After planner completes, check for completion markers: `## PLANNING COMPLETE`, `## PLANNING FAILED`, or `## PLANNING INCONCLUSIVE`. Route accordingly. Do NOT inline it.
Path resolution: Before constructing the agent prompt, resolve ${CLAUDE_PLUGIN_ROOT} to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
Read ${CLAUDE_SKILL_DIR}/templates/planner-prompt.md.tmpl and use it as the prompt template for spawning the planner agent. Fill in all placeholder blocks with phase-specific context:
<phase_context> - phase number, directory, goal, requirements, dependencies, success criteria<project_context> - locked decisions, user constraints, deferred ideas, phase-specific decisions<prior_work> - manifest table of preceding phase SUMMARY.md file paths with status and one-line exports (NOT full bodies)<research> - file path to RESEARCH.md if it exists (NOT inlined content)<config> - max tasks, parallelization, TDD mode from config.json<planning_instructions> - phase-specific planning rules and output pathPrepend this block to the planner prompt before sending:
<files_to_read>
CRITICAL (no hook): Read these files BEFORE any other action:
1. .planning/CONTEXT.md — locked decisions and constraints (if exists)
2. .planning/ROADMAP.md — phase goals, dependencies, and structure
3. .planning/phases/{NN}-{slug}/RESEARCH.md — research findings (if exists)
{if learnings_temp_path exists}4. {learnings_temp_path} — cross-project learnings (estimation and planning patterns from past PBR projects){/if}
</files_to_read>
If {learnings_temp_path} was produced in the learnings injection step above, replace {if...}{/if} with the actual line. If no learnings were found, omit item 4 entirely.
Wait for the planner to complete.
After the planner returns, read the plan files it created to extract counts. Display a completion summary:
✓ Planner created {N} plan(s) across {M} wave(s)
Where {N} is the number of PLAN.md files written and {M} is the number of distinct wave values across those plans (from frontmatter).
CRITICAL (no hook): Verify planner output before proceeding.
.planning/phases/{NN}-{slug}/PLAN-*.md files exist on diskdepends_on, files_modified, must_haves fields present<task> block exists in each plan fileIf ANY spot-check fails, present the user with options: Retry / Continue anyway / Abort
Skip this step if:
features.plan_checking: falseTo check: use the resolved depth profile from Step 1. The profile consolidates the depth setting and any user overrides into a single boolean.
If validation is enabled:
Display to the user: ◐ Spawning plan checker...
Spawn the plan checker Task():
Task({
subagent_type: "pbr:plan-checker",
prompt: <checker prompt>
})
NOTE: The pbr:plan-checker subagent type auto-loads the agent definition. Do NOT inline it.
Path resolution: Before constructing the agent prompt, resolve ${CLAUDE_PLUGIN_ROOT} to its absolute path. Do not pass the variable literally in prompts — Task() contexts may not expand it. Use the resolved absolute path for any pbr-tools.js or template references included in the prompt.
Read ${CLAUDE_SKILL_DIR}/templates/checker-prompt.md.tmpl and use it as the prompt template for spawning the plan checker agent. Fill in the placeholders:
<plans_to_check> - manifest table of PLAN.md file paths (checker reads each via Read tool)<phase_context> - phase goal and requirement IDs<context> - file paths to project-level and phase-level CONTEXT.md files (checker reads via Read tool)Prepend this block to the checker prompt before sending:
<files_to_read>
CRITICAL (no hook): Read these files BEFORE any other action:
1. .planning/phases/{NN}-{slug}/PLAN-*.md — plan files to validate
2. .planning/CONTEXT.md — locked decisions to check against (if exists)
</files_to_read>
Process checker results:
After the plan checker returns, display its result:
VERIFICATION PASSED: display ✓ Plan checker: all plans passed and proceed to Step 8⚠ Plan checker found {N} issue(s) — entering revision loop and proceed to Step 7Reference: skills/shared/revision-loop.md for the full Check-Revise-Escalate pattern.
Follow the revision loop pattern with:
${CLAUDE_SKILL_DIR}/templates/revision-prompt.md.tmpl)Skip if:
gates.confirm_plan is false in configmode is autonomous in configIf approval is needed:
Present a summary of all plans to the user. For each plan include: plan name, wave, task count, must-haves, files_modified. For each task include the task name. Add a wave execution order summary (Wave 1: Plan 01, 02 (parallel), Wave 2: Plan 03, etc.).
Use AskUserQuestion (pattern: approve-revise-abort from skills/shared/gate-prompts.md):
question: "Approve these {count} plans for Phase {N}?"
header: "Approve?"
options:
- label: "Approve" description: "Proceed to build phase"
- label: "Request changes" description: "Discuss adjustments before proceeding"
- label: "Abort" description: "Cancel planning for this phase"
If user selects 'Request changes' or 'Other':
If user selects 'Approve':
CONTEXT.md compliance reporting: Check locked decisions from BOTH sources:
a. Project-level: .planning/CONTEXT.md (if exists) — cross-cutting decisions for all phases
b. Phase-level: .planning/phases/{NN}-{slug}/CONTEXT.md (if exists) — phase-specific decisions
Phase-level decisions override project-level for the same decision area.
Collect ALL locked decisions from both files (deduplicate identical decision text).
Compare against the generated plan tasks. Print:
CONTEXT.md compliance: {M}/{N} locked decisions mapped to tasks
where M = locked decisions reflected in at least one task action, N = total unique locked decisions.
If any locked decisions are unmapped, list them as warnings.
If neither CONTEXT.md exists: skip this check silently.
Dependency fingerprinting: For each dependency phase (phases that this phase depends on, per ROADMAP.md):
"len:{bytes}-mod:{mtime}" and add as a dependency_fingerprints map in each plan's YAML frontmatter — this allows the build skill to detect stale plans if dependencies were rebuilt.Update ROADMAP.md Progress table (REQUIRED — do this BEFORE updating STATE.md):
Tooling shortcut: Use the CLI for atomic updates:
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js roadmap update-plans {phase} 0 {N}
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js roadmap update-status {phase} planned
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update status planned
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state update last_activity now
.planning/ROADMAP.md## Progress tablePlans Complete column to 0/{N} where N = number of plan files just createdStatus column to plannedUpdate STATE.md via CLI (CRITICAL (no hook) — update BOTH frontmatter AND body): set status: "planned", plans_total, last_command in frontmatter AND update Status:, Plan: lines in body ## Current Position
Tooling shortcut: node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js state patch '{"status":"planned","last_command":"/pbr:plan {N}"}'
features.auto_advance is true AND mode is autonomous: Chain directly to build: Skill({ skill: "pbr:build", args: "{N}" }). This continues the build→review→plan→build cycle automatically./pbr:build {N}addCRITICAL (hook-enforced): Write .active-skill NOW. Write the text "plan" to .planning/.active-skill using the Write tool.
.planning/ROADMAP.md.planning/phases/{NN}-{slug}//pbr:plan {N} to plan the new phase.planning/.active-skill if it exists.insert <N>Reference: ${CLAUDE_SKILL_DIR}/decimal-phase-calc.md for decimal numbering rules.
CRITICAL (hook-enforced): Write .active-skill NOW. Write the text "plan" to .planning/.active-skill using the Write tool.
.planning/ROADMAP.md.planning/phases/{NN.M}-{slug}//pbr:plan {N.M} to plan the new phase.planning/.active-skill if it exists.remove <N>.planning/ROADMAP.mdpending or not started status (cannot remove completed/in-progress phases).planning/.active-skill using the Write tool..planning/phases/{NN}-{slug}/ directorydepends_on references in ROADMAP.md.planning/.active-skill if it exists.--gaps)When invoked with --gaps:
.planning/phases/{NN}-{slug}/VERIFICATION.md
/pbr:review {N} first."Read ${CLAUDE_SKILL_DIR}/templates/gap-closure-prompt.md.tmpl and use it as the prompt template for the gap closure planner. Fill in the placeholders:
<verification_report> - inline the FULL VERIFICATION.md content<existing_plans> - inline all existing PLAN.md files for the phase<gap_closure_instructions> - specify output path and gap_closure frontmatter flag/pbr:build {N} --gaps-onlyIf the specified phase doesn't exist in ROADMAP.md, use conversational recovery:
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js suggest-alternatives phase-not-found {slug}available phases and suggestions (closest matches).suggestions (if any) as numbered options.available.skills/shared/gate-prompts.md) to let the user pick a phase or abort.
If REQUIREMENTS.md or ROADMAP.md don't exist, use conversational recovery:
node ${CLAUDE_PLUGIN_ROOT}/scripts/pbr-tools.js suggest-alternatives missing-prereq {phase}existing_summaries, missing_summaries, and suggested_action.If the researcher Task() fails, display:
⚠ Research agent failed. Planning without phase-specific research.
This may result in less accurate plans.
Continue to the planning step.
If the planner Task() fails, display a branded error box — see skills/shared/error-reporting.md, pattern: Planner agent failure.
After 3 revision iterations without passing, display a branded error box — see skills/shared/error-reporting.md, pattern: Checker loops.
Present remaining issues and ask user to decide: proceed or intervene.
| File | Purpose | When |
|---|---|---|
.planning/phases/{NN}-{slug}/RESEARCH.md | Phase-specific research | Step 4 |
.planning/phases/{NN}-{slug}/PLAN-{NN}.md | Executable plan files | Step 5 |
.planning/CONTEXT.md | Updated with assumptions | Step 3 (--assumptions) |
.planning/ROADMAP.md | Plans Complete + Status → planned; updated for add/insert/remove | Step 8, Subcommands |
.planning/STATE.md | Updated with plan status | Step 8 |
Delete .planning/.active-skill if it exists. This must happen on all paths (success, partial, and failure) before reporting results.
After planning completes, present:
Use the branded stage banner and next-up block from ${CLAUDE_SKILL_DIR}/templates/completion-output.md.tmpl.
Fill in: {N} (phase number), {phase-name}, {plan_count}, {plan_list_lines} (one line per plan with wave and task count), {wave_table_lines} (one line per wave).