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.
Step 0 — Immediate Output
Before ANY tool calls, display this banner:
╔══════════════════════════════════════════════════════════════╗
║ PLAN-BUILD-RUN ► IMPORTING PLAN ║
╚══════════════════════════════════════════════════════════════╝
Then proceed to Step 1.
/pbr:import — Plan Import
You are the orchestrator for /pbr:import. This skill imports an external plan document (design doc, RFC, AI-generated plan, etc.) into the Plan-Build-Run planning format. It validates the imported document against project context, detects conflicts with locked decisions and existing architecture, and generates properly formatted PLAN.md files. Your job is to stay lean, do conflict detection inline, and delegate only the plan checker to a Task() subagent.
References
references/ui-brand.md— Status symbols, banners, checkpoint boxes for import display outputreferences/questioning.md— Questioning patterns for gap-fill prompts during PRD import
Context Budget
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Reference: skills/shared/agent-type-resolution.md for agent type fallback when spawning Task() subagents.
Additionally for this skill:
- Minimize reading subagent output — read only verdicts, not full reports
Prerequisites
.planning/config.jsonexists (run/pbr:new-projectfirst).planning/ROADMAP.mdexists with at least one phase.planning/REQUIREMENTS.mdexists (optional — if absent, skip requirement ID cross-referencing and warn the user: "No REQUIREMENTS.md found. Skipping REQ-ID validation.")
Orchestration Flow
Execute these steps in order.
Step 1: Parse and Validate (inline)
Reference: skills/shared/config-loading.md for the tooling shortcut and config field reference.
- Parse
$ARGUMENTSfor phase number - Parse optional
--from <filepath>flag (path to the external document to import) - Parse optional
--skip-checkerflag (skip plan validation step) 3b. Parse optional--prd <filepath>flag.- If
--prdis present: branch into PRD Import Flow (Steps A–G below) immediately after writing.active-skill. - Do NOT proceed to Step 2 (standard import flow). The --prd branch is a completely separate execution path.
- If both
--prdand--fromare present: treat--prdas the primary flag;--fromis ignored with an [INFO] note. - If
--prdis present but no filepath follows: display error "Missing filepath for --prd flag." and stop.
- If
- CRITICAL: Write .active-skill NOW. Write the text "import" to
.planning/.active-skillusing the Write tool.
→ If --prd flag was set: jump to PRD Import Flow (Step A). Do not continue to Step 2.
- Validate:
- Phase exists in ROADMAP.md
- Phase directory exists at
.planning/phases/{NN}-{slug}/
- If no phase number given, read current phase from
.planning/STATE.md - Check for existing plans in the phase directory (glob for
*-PLAN.md)- If plans exist: ask user via AskUserQuestion: "Phase {N} already has plans. Replace them with imported plans?"
- If yes: note that existing plans will be overwritten in Step 7
- If no: stop
PRD Import Flow
Entered when
--prd <filepath>is present in $ARGUMENTS. Steps A–G replace Steps 2–11 entirely for this path.
Step A: Read and Validate PRD File
- Read the file at the
--prd <filepath>path. - If the file does not exist: display the "Import file not found" error from the Error Handling section and stop.
- If the file is empty or < 100 characters: display error "PRD file appears empty or too short to extract meaningful content." and stop.
- Store the full PRD content for use in Steps B–E.
Step B: Gap Detection — Identify Missing Sections (inline)
Analyze the PRD content for the presence of these six required sections:
| Section | What to look for |
|---|---|
| Project name / title | A clear product name or title |
| Problem statement | What problem the product solves, who it's for |
| Goals / success criteria | Measurable outcomes, KPIs, or acceptance tests |
| Functional requirements | Feature list, user stories, or capabilities |
| Non-functional requirements | Performance, security, reliability constraints |
| Out of scope / deferred | Explicitly excluded features |
For each section that is absent or ambiguous, record it as a gap.
If 1–3 gaps found: Batch all gaps into ≤ 3 AskUserQuestion calls (max 4 options each). Ask the user to supply the missing info:
- If 1 gap: one AskUserQuestion with a freeform prompt.
- If 2–3 gaps: group into 2 AskUserQuestion calls of related topics (e.g., "Requirements" and "Constraints/Scope").
- If > 3 gaps: group all into exactly 3 AskUserQuestion calls. Do NOT exceed 3 calls.
Example AskUserQuestion for missing requirements:
Use AskUserQuestion:
question: "The PRD doesn't clearly specify functional requirements. Please describe the main features or capabilities this product must have."
header: "Fill Gap"
options: [] ← freeform (no options means free text input)
multiSelect: false
If 0 gaps: proceed directly to Step C with no prompts.
Incorporate user answers into the extraction context used in Step C.
Step C: Extract Project Files Inline (PROJECT.md with Context, REQUIREMENTS.md)
Using the PRD content (plus any gap-fill answers from Step B), generate the content for two files. Context is merged into PROJECT.md (not a separate CONTEXT.md). Do this inline in your context — no subagents.
C1. Generate PROJECT.md content using templates/PROJECT.md.tmpl as the structure:
{project_name}: extract from PRD title/header{ONE sentence core value statement}: extract from problem statement / vision- Vision section: 2-3 sentences from PRD problem statement
- Scope — In Scope: features from functional requirements section
- Scope — Out of Scope: features from "out of scope" section (or mark "None specified" if absent)
- Success Criteria: from goals/KPIs section
- Stakeholders: extract if present; default to "Primary user: end users of the product"
- Milestones line: leave as "Planned in {N} phases across 1 milestone — see .planning/ROADMAP.md"
- ## Context section (merged from brownfield variant TMPL-06):
- Locked Decisions: extract any explicit technology choices or constraints from PRD
- User Constraints: extract deployment, team size, budget, timeline if mentioned
- Deferred Ideas: items from "out of scope" section
- Claude's Discretion Areas: leave empty (executor will fill as they work)
C2. Generate REQUIREMENTS.md content using templates/REQUIREMENTS.md.tmpl as the structure:
- Functional Requirements: each feature/capability from PRD becomes one REQ-F-xxx row
- Number from REQ-F-001 sequentially
- Priority: "Must" for core features, "Should" for nice-to-haves (infer from PRD language)
- Non-Functional Requirements: from performance/security/reliability section if present
- Deferred Requirements: items from "out of scope" section
- Traceability table: leave "Implemented In" and "Verified In" columns as "—"
Step D: Confirmation Gate
Check config: Read .planning/config.json. If prd.auto_extract is true, skip this step entirely and proceed directly to Step E.
If prd.auto_extract is false (default):
Display a preview of the three generated files (show first 10 lines of each with a ... truncation).
CRITICAL -- DO NOT SKIP: Present the following choice to the user via AskUserQuestion before proceeding:
Then present the confirmation gate using the approve-revise-abort pattern from skills/shared/gate-prompts.md:
Use AskUserQuestion:
que