Create comprehensive feature implementation plan with codebase analysis and research. Also wires bidirectional back/forward references between existing plans (the update-references workflow). Use when the user wants to plan a feature, turn a PRD into an implementation plan, "link two plans", "add a back/forward reference", "connect related plans", or invokes $prp-plan.
72
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
High
Do not use without reviewing
Transform "$ARGUMENTS" into a battle-tested implementation plan through systematic codebase exploration, pattern extraction, and strategic research.Arguments:
$ARGUMENTS(and$1,$2, ...) refer to the arguments given when this skill was invoked. Take them from the user's request; if absent, infer them from the conversation.
Core Principle: PLAN ONLY - no code written. Create a context-rich document that enables one-pass implementation success.
Execution Order: CODEBASE FIRST, RESEARCH SECOND. Solutions must fit existing patterns before introducing new ones.
Agent Strategy: Use specialized agents for intelligence gathering:
codebase-explorer — finds WHERE code lives and extracts implementation patternscodebase-analyst — analyzes HOW integration points work and traces data flowweb-researcher — strategic web research with citations and gap analysisLaunch codebase agents in parallel first, then research agent second.
Project rules: follow the loaded AGENTS.md context; also read CLAUDE.md if the project has one.Directory Discovery (run these to understand project structure):
ls -lals -la */ 2>/dev/null | head -50IMPORTANT: Do NOT assume src/ exists. Common alternatives include:
app/ (Next.js, Rails, Laravel)lib/ (Ruby gems, Elixir)packages/ (monorepos)cmd/, internal/, pkg/ (Go)Discover the actual structure before proceeding.
Before planning, check intent:
update-references <plan> <related> [back|forward]). → Follow workflows/update-references.md and stop. Do NOT run the planning phases below.Determine input type:
| Input Pattern | Type | Action |
|---|---|---|
Ends with .prd.md | PRD file | Parse PRD, select next phase |
Ends with .md and contains "Implementation Phases" | PRD file | Parse PRD, select next phase |
| File path that exists | Document | Read and extract feature description |
| Free-form text | Description | Use directly as feature input |
| Empty/blank | Conversation | Use conversation context as input |
Read the PRD file
Parse the Implementation Phases table - find rows with Status: pending
Check dependencies - only select phases whose dependencies are complete
Select the next actionable phase:
Extract phase context:
PHASE: {phase number and name}
GOAL: {from phase details}
SCOPE: {from phase details}
SUCCESS SIGNAL: {from phase details}
PRD CONTEXT: {problem statement, user, hypothesis from PRD}Report selection to user:
PRD: {prd file path}
Selected Phase: #{number} - {name}
{If parallel phases available:}
Note: Phase {X} can also run in parallel (in separate worktree).
Proceeding with Phase #{number}...PHASE_0_CHECKPOINT:
EXTRACT from input:
FORMULATE user story:
As a <user type>
I want to <action/goal>
So that <benefit/value>PHASE_1_CHECKPOINT:
GATE: If requirements are AMBIGUOUS → STOP and ASK user for clarification before proceeding.
CRITICAL: Launch two specialized agents in parallel by spawning them as subagents in one step. Read references/agent-prompts.md now (mandatory) — it is the exact prompt text for every subagent launch in Phases 2, 3, and 5.
codebase-explorer — finds WHERE code lives and extracts implementation patterns. Launch with the Phase 2 codebase-explorer prompt.codebase-analyst — analyzes HOW integration points work and traces data flow. Launch with the Phase 2 codebase-analyst prompt.Combine findings from both agents into a unified discovery table:
| Category | File:Lines | Pattern Description | Code Snippet |
|---|---|---|---|
| NAMING | src/features/X/service.ts:10-15 | camelCase functions | export function createThing() |
| ERRORS | src/features/X/errors.ts:5-20 | Custom error classes | class ThingNotFoundError |
| LOGGING | src/core/logging/index.ts:1-10 | getLogger pattern | const logger = getLogger("domain") |
| TESTS | src/features/X/tests/service.test.ts:1-30 | describe/it blocks | describe("service", () => { |
| TYPES | src/features/X/models.ts:1-20 | Drizzle inference | type Thing = typeof things.$inferSelect |
| FLOW | src/features/X/service.ts:40-60 | Data transformation | input → validate → persist → respond |
PHASE_2_CHECKPOINT:
codebase-explorer and codebase-analyst) launched in parallel and completedONLY AFTER Phase 2 is complete - solutions must fit existing codebase patterns first.
Launch web-researcher with the Phase 3 web-researcher prompt from references/agent-prompts.md, filling in the feature description and the dependency versions found in Phase 2.
FORMAT the agent's findings into plan references:
- [Library Docs v{version}](https://url#specific-section)
- KEY_INSIGHT: {what we learned that affects implementation}
- APPLIES_TO: {which task/file this affects}
- GOTCHA: {potential pitfall and how to avoid}PHASE_3_CHECKPOINT:
web-researcher agent launched and completedCREATE ASCII diagrams showing user experience before and after, then DOCUMENT interaction changes. Read templates/ux-diagram-format.md now (mandatory) — it is the exact BEFORE/AFTER diagram shape and interaction-changes table to produce.
PHASE_4_CHECKPOINT:
For complex features with multiple integration points, use codebase-analyst to trace how existing architecture works at the integration points identified in Phase 2 — launch with the Phase 5 architecture deep-dive prompt from references/agent-prompts.md.
Then ANALYZE deeply (use extended thinking if needed):
DECIDE and document:
APPROACH_CHOSEN: [description]
RATIONALE: [why this over alternatives - reference codebase patterns]
ALTERNATIVES_REJECTED:
- [Alternative 1]: Rejected because [specific reason]
- [Alternative 2]: Rejected because [specific reason]
NOT_BUILDING (explicit scope limits):
- [Item 1 - explicitly out of scope and why]
- [Item 2 - explicitly out of scope and why]PHASE_5_CHECKPOINT:
# --- PRP store resolver (canonical; keep byte-identical across skills) ---
_gd="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)"
case "$_gd" in */.git) _root="${_gd%/.git}" ;; "") _root="$PWD" ;; *) _root="$_gd" ;; esac
_root="$(cd "$_root" && pwd -P)"
_name="$(basename "$_root" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-*//;s/-*$//')"
PRP_DIR="${PRP_HOME:-$HOME/.prp}/${_name:-project}-$(printf %s "$_root" | git hash-object --stdin | cut -c1-8)"
mkdir -p "$PRP_DIR"; [ -f "$PRP_DIR/project.json" ] || printf '{"path": "%s", "name": "%s"}\n' "$_root" "${_name:-project}" > "$PRP_DIR/project.json"OUTPUT_PATH: $PRP_DIR/plans/{kebab-case-feature-name}.plan.md
Create directory if needed: mkdir -p "$PRP_DIR/plans"
PLAN_STRUCTURE: Read templates/plan-template.md now (mandatory) — it is the exact plan document to fill and save. Keep every section heading; fill every {placeholder} with real, project-specific content (the template's remaining snippets and table entries are illustrative examples from one TypeScript project, not content to keep). Before writing the plan's Step-by-Step Tasks section, read references/task-block-format.md (mandatory) for the task-block field detail and worked examples; before filling its Validation Commands section, read references/validation-commands.md (mandatory) for the per-language commands to embed.
If input was from PRD file, also update the PRD:
Update phase status in the Implementation Phases table:
pending to in-progressEdit the PRD file with these changes
REPORT_TO_USER (display after creating plan): Read templates/report-format.md now (mandatory) and display the "Plan Created" report in exactly that structure.
CONTEXT_COMPLETENESS:
codebase-explorer and codebase-analyst documented with file:line referencesIMPLEMENTATION_READINESS:
PATTERN_FAITHFULNESS:
VALIDATION_COVERAGE:
UX_CLARITY:
NO_PRIOR_KNOWLEDGE_TEST: Could an agent unfamiliar with this codebase implement using ONLY the plan?
<success_criteria>
CONTEXT_COMPLETE: All patterns, gotchas, integration points documented from actual codebase via codebase-explorer and codebase-analyst agents
IMPLEMENTATION_READY: Tasks executable top-to-bottom without questions, research, or clarification
PATTERN_FAITHFUL: Every new file mirrors existing codebase style exactly
VALIDATION_DEFINED: Every task has executable verification command
UX_DOCUMENTED: Before/After transformation is visually clear with data flows
ONE_PASS_TARGET: Confidence score 8+ indicates high likelihood of first-attempt success
</success_criteria>
references/agent-prompts.md — exact subagent prompts for Phases 2, 3, and 5 (mandatory read at Phase 2)templates/plan-template.md — the plan document to fill and save (mandatory read in Phase 6)templates/ux-diagram-format.md — the BEFORE/AFTER ASCII diagram shape and interaction-changes table (mandatory read in Phase 4)templates/report-format.md — the "Plan Created" report displayed to the user (mandatory read in Output)references/task-block-format.md — task-block field detail and worked examples (mandatory read in Phase 6, before writing Step-by-Step Tasks)references/validation-commands.md — per-language validation command catalog (mandatory read in Phase 6, before filling Validation Commands)workflows/update-references.md — the update-references mode (read only when Mode Select routes there)1142738
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.