prp-workflow
功能实现的全面PRP(产品需求提示)工作流程。当用户想要实现复杂功能、需要结构化实施计划或提及PRP、功能实现或系统开发时使用。处理从需求生成PRP、解决模糊性和执行实施的问题。三种模式 - 生成(创建PRP)、澄清(解决模糊性)、执行(实施功能)。
name: prp-workflow description: | Product Requirements Prompt (PRP) workflow for systematic feature implementation. PRPs are PRDs engineered for AI - they include complete context, implementation blueprints, and validation gates for one-pass success.
Use when user: (1) wants to implement a complex feature systematically, (2) asks to "create/generate a PRP", (3) mentions "PRP workflow" or "context engineering", (4) has a feature file to implement, (5) asks to "clarify" or "review" a PRP for ambiguities, (6) asks to "execute" an existing PRP.
Three modes: Generation (create PRP from requirements), Clarification (resolve ambiguities before execution), Execution (implement from PRP with validation loops).
PRP Workflow
Three-phase workflow: Generation -> Clarification (recommended) -> Execution
Mode 1: PRP Generation
Generate a comprehensive PRP from a feature request.
Process
Launch 2 parallel Opus agents for research:
Agent #1 - Codebase Research: Search for similar features/patterns in the codebase. Identify conventions (imports, naming, structure), test patterns, and architecture. Return a summary of patterns found and a list of 5-10 key files to read.
Agent #2 - External Research: Search the web for library documentation, implementation examples, best practices, and known gotchas. Return URLs, version-specific details, and recommendations.
Read key files identified by agents to build deep understanding
Clarify with user (if needed) using AskUserQuestion for patterns to follow, integration requirements, constraints
Generate PRP using the template in references/prp-template.md
Save to
plans/{XXX}-{feature-name}.md- Auto-increment from highest number in
plans/ - Filename: lowercase, hyphens, max 50 chars
- Auto-increment from highest number in
Report confidence score (1-10) and ask: clarify or execute?
Mode 2: PRP Clarification
Identify and resolve underspecified areas BEFORE implementation.
Process
Locate PRP - Ask user or search
plans/*.mdLaunch an Opus agent to analyze the PRP for ambiguities:
The agent should analyze the PRP against the coverage taxonomy in references/clarification-taxonomy.md. Mark each category (Functional Scope, Data Model, UX Flow, Non-Functional, Integration, Edge Cases, Constraints, Terminology, Completion Signals) as Clear/Partial/Missing. Return a coverage summary table and up to 5 recommended clarification questions prioritized by (Impact × Uncertainty).
Present questions to user using AskUserQuestion (max 5, up to 4 per batch):
AskUserQuestion({ questions: [ { question: "Which authentication method should the system use?", header: "Auth", multiSelect: false, options: [ { label: "OAuth 2.0 + JWT", description: "Stateless, scalable" }, { label: "Session cookies", description: "Traditional, requires storage" } ] } ] })Integrate answers into PRP:
- Add
## Clarificationssection with### Session YYYY-MM-DD - Record:
- Q: <question> → A: <answer> - Update relevant PRP sections per integration table in taxonomy reference
- Add
Report coverage summary and recommend next step
Early Exit
- No critical gaps: proceed to execution
- PRP missing: generate first (Mode 1)
Mode 3: PRP Execution
Implement a feature using an existing PRP.
Process
Load PRP - Read completely, note success criteria and validation gates
Launch an Opus agent to execute the implementation:
The agent should:
- Create a TodoWrite task list from the PRP's implementation blueprint
- Work through tasks systematically, keeping ONE task in_progress at a time
- Follow patterns from PRP exactly (don't introduce new patterns)
- Run validation commands after each major step
- Fix failures immediately (don't accumulate)
- Return: implementation summary, files modified, validation results, any deviations from PRP
Handle blockers - If agent returns with issues, help resolve
Report completion summary
Validation Philosophy
If validation fails:
- Read error carefully
- Understand root cause
- Fix underlying issue (don't patch)
- Re-run validation
- Repeat until passing
Quick Reference
File Locations
- PRPs:
plans/{XXX}-{feature-name}.md - Template: references/prp-template.md
- Taxonomy: references/clarification-taxonomy.md
Agent Summary
| Phase | Agents | Model |
|---|---|---|
| Generation | 2 parallel (codebase + external research) | Opus |
| Clarification | 1 (coverage analysis) | Opus |
| Execution | 1 (implementation) | Opus |
Key Constraints
- Clarification: max 5 questions, 4 per AskUserQuestion batch
- Execution: one task in_progress at a time
- Validate after each major step
- If CLAUDE.md exists, follow its rules
Anti-Patterns
- Skipping research to save time
- Implementing without reading full PRP
- Ignoring validation failures
- Creating new patterns instead of following existing ones