prp-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePRP Generator
PRP生成器
Overview
概述
This skill generates comprehensive Product Requirement Plans (PRPs) that enable AI agents to implement features in a single pass with high success rates. The skill combines systematic codebase analysis with external research to create detailed, context-rich implementation blueprints.
本技能可生成详尽的产品需求计划(PRP),让AI Agent能够一次性成功实现功能。该技能结合系统性的代码库分析与外部研究,创建内容详实、贴合上下文的实施蓝图。
When to Use This Skill
何时使用本技能
Invoke this skill when:
- User requests a PRP or PRD (Product Requirement Plan/Document)
- User wants a detailed implementation plan for a new feature
- User asks to "plan out" or "design" a complex feature
- Beginning a significant feature development that would benefit from structured planning
- User provides a feature description file and asks for implementation guidance
在以下场景调用本技能:
- 用户请求PRP或PRD(产品需求计划/文档)
- 用户需要新功能的详细实施计划
- 用户要求“规划”或“设计”复杂功能
- 启动需要结构化规划的重要功能开发工作
- 用户提供功能描述文件并寻求实施指导
Core Principle
核心原则
Context is Everything: The AI agent implementing your PRP only receives:
- The PRP content you create
- Training data knowledge
- Access to the codebase
- WebSearch capabilities
Therefore, your PRP must be self-contained with all necessary context, specific references, and executable validation gates.
上下文决定一切:执行PRP的AI Agent仅能获取以下信息:
- 你创建的PRP内容
- 训练数据知识
- 代码库访问权限
- WebSearch能力
因此,你的PRP必须具备自包含性,涵盖所有必要的上下文、具体引用和可执行的验证关卡。
Workflow
工作流程
Phase 1: Understanding the Feature
阶段1:理解功能
-
Read the Feature Request
- If user provides a feature file path, read it completely
- If user provides verbal description, clarify requirements by asking:
- What is the user trying to accomplish?
- What are the acceptance criteria?
- Are there any specific constraints or requirements?
- Identify the core problem being solved
-
Clarify Ambiguities
- Use AskUserQuestion tool for any unclear requirements
- Confirm technology stack assumptions
- Verify integration points
- Ask about specific patterns to follow if not obvious
-
阅读功能请求
- 如果用户提供功能文件路径,完整读取该文件
- 如果用户提供口头描述,通过以下问题澄清需求:
- 用户想要实现什么目标?
- 验收标准是什么?
- 是否有任何特定约束或要求?
- 识别需要解决的核心问题
-
澄清模糊点
- 使用AskUserQuestion工具解决任何不明确的需求
- 确认技术栈假设
- 验证集成点
- 如果模式不明确,询问需要遵循的特定模式
Phase 2: Codebase Analysis (Mandatory)
阶段2:代码库分析(必填)
Goal: Understand existing patterns, conventions, and integration points
Refer to for detailed guidance, but the core steps are:
references/research_methodology.md-
Search for Similar Features
Use Grep to search for: - Similar component names - Similar functionality keywords - Similar UI patterns - Similar API endpointsDocument findings with:- Exact file paths and line numbers
- Code snippets showing patterns
- Relevance to new feature
- Necessary adaptations
-
Identify Architectural Patterns
- Directory structure conventions
- Component organization patterns
- State management approach
- API structure patterns
- Routing patterns (if applicable)
Example findings:Pattern: Feature-based directory structure Location: src/features/ Application: Create src/features/[new-feature]/ -
Document Coding Conventions
- TypeScript usage patterns (interfaces vs types, strict mode)
- Component patterns (FC vs function, default vs named exports)
- Styling approach (CSS modules, styled-components, Tailwind)
- Import ordering and organization
- Function and variable naming
- Comment style
Example:Convention: Named exports for all components Example: export function UserProfile() { ... } Found in: src/components/*.tsx -
Study Test Patterns
- Test framework and version
- Test file naming and location
- Mock strategies
- Coverage expectations
- Example test to mirror
Document:Framework: Vitest + @testing-library/react Pattern: Co-located tests with *.test.tsx Example: src/components/Button/Button.test.tsx Mock Strategy: Use vi.fn() for functions, MSW for HTTP -
Check Project Configuration
- Review for dependencies and scripts
package.json - Check for TypeScript settings
tsconfig.json - Review build configuration (vite.config.ts, etc.)
- Note path aliases and special configurations
Document:Build Tool: Vite 5.x Path Aliases: '@/' → 'src/', '@components/' → 'src/components/' TypeScript: Strict mode enabled - Review
目标:理解现有模式、约定和集成点
详细指导请参考,核心步骤如下:
references/research_methodology.md-
搜索相似功能
Use Grep to search for: - Similar component names - Similar functionality keywords - Similar UI patterns - Similar API endpoints记录以下发现:- 确切的文件路径和行号
- 展示模式的代码片段
- 与新功能的相关性
- 必要的适配方案
-
识别架构模式
- 目录结构约定
- 组件组织模式
- 状态管理方法
- API结构模式
- 路由模式(如适用)
示例发现:Pattern: Feature-based directory structure Location: src/features/ Application: Create src/features/[new-feature]/ -
记录编码约定
- TypeScript使用模式(接口vs类型、严格模式)
- 组件模式(FC vs函数、默认导出vs命名导出)
- 样式方案(CSS modules、styled-components、Tailwind)
- 导入顺序与组织方式
- 函数和变量命名规则
- 注释风格
示例:Convention: Named exports for all components Example: export function UserProfile() { ... } Found in: src/components/*.tsx -
研究测试模式
- 测试框架及版本
- 测试文件命名与位置
- 模拟策略
- 覆盖率要求
- 可参考的示例测试
记录:Framework: Vitest + @testing-library/react Pattern: Co-located tests with *.test.tsx Example: src/components/Button/Button.test.tsx Mock Strategy: Use vi.fn() for functions, MSW for HTTP -
检查项目配置
- 查看中的依赖和脚本
package.json - 检查中的TypeScript设置
tsconfig.json - 查看构建配置(vite.config.ts等)
- 记录路径别名和特殊配置
记录:Build Tool: Vite 5.x Path Aliases: '@/' → 'src/', '@components/' → 'src/components/' TypeScript: Strict mode enabled - 查看
Phase 3: External Research (Mandatory)
阶段3:外部研究(必填)
Goal: Find best practices, documentation, examples, and gotchas
Refer to for detailed guidance, but the core steps are:
references/research_methodology.md-
Search for Library Documentation
- Go to official documentation for any libraries being used
- Find the SPECIFIC version in package.json
- Document exact URLs to relevant sections
- Note version-specific features or changes
Example output:Library: @tanstack/react-query Version: 5.28.0 (from package.json) Docs: https://tanstack.com/query/latest/docs/react/overview Key Sections: - Queries: https://tanstack.com/query/latest/docs/react/guides/queries - Mutations: https://tanstack.com/query/latest/docs/react/guides/mutations Gotchas: - Query keys must be arrays - Automatic refetching on window focus - Default staleTime is 0 -
Find Implementation Examples
- Search GitHub for similar implementations
- Look for StackOverflow solutions (recent, highly-voted)
- Find blog posts from reputable sources
- Check official example repositories
Document:Example: Form validation with React Hook Form + Zod Source: https://github.com/react-hook-form/react-hook-form/tree/master/examples/V7/zodResolver Relevance: Shows exact integration pattern needed Key Takeaway: Use zodResolver from @hookform/resolvers -
Research Best Practices
- Search for "[technology] best practices [current year]"
- Look for common pitfalls and gotchas
- Research performance considerations
- Check security implications (OWASP guidelines)
Document:Practice: Input sanitization for user content Why: Prevent XSS attacks How: Use DOMPurify before rendering HTML Reference: https://owasp.org/www-community/attacks/xss/ Warning: NEVER use dangerouslySetInnerHTML without sanitization -
Performance & Security Research
- Bundle size implications of new dependencies
- Runtime performance patterns
- Security vulnerabilities to avoid
- Accessibility considerations
Document specific URLs and recommendations
目标:查找最佳实践、文档、示例和注意事项
详细指导请参考,核心步骤如下:
references/research_methodology.md-
搜索库文档
- 访问所用库的官方文档
- 查找中的具体版本
package.json - 记录相关章节的确切URL
- 标注版本特定的功能或变更
示例输出:Library: @tanstack/react-query Version: 5.28.0 (from package.json) Docs: https://tanstack.com/query/latest/docs/react/overview Key Sections: - Queries: https://tanstack.com/query/latest/docs/react/guides/queries - Mutations: https://tanstack.com/query/latest/docs/react/guides/mutations Gotchas: - Query keys must be arrays - Automatic refetching on window focus - Default staleTime is 0 -
查找实现示例
- 在GitHub上搜索相似实现
- 查找StackOverflow上近期高票的解决方案
- 查找权威来源的博客文章
- 查看官方示例仓库
记录:Example: Form validation with React Hook Form + Zod Source: https://github.com/react-hook-form/react-hook-form/tree/master/examples/V7/zodResolver Relevance: Shows exact integration pattern needed Key Takeaway: Use zodResolver from @hookform/resolvers -
研究最佳实践
- 搜索"[technology] best practices [current year]"
- 查找常见陷阱和注意事项
- 研究性能考量因素
- 检查安全影响(OWASP指南)
记录:Practice: Input sanitization for user content Why: Prevent XSS attacks How: Use DOMPurify before rendering HTML Reference: https://owasp.org/www-community/attacks/xss/ Warning: NEVER use dangerouslySetInnerHTML without sanitization -
性能与安全研究
- 新增依赖对包体积的影响
- 运行时性能模式
- 需要避免的安全漏洞
- 可访问性考量
记录具体的URL和建议
Phase 4: Ultra-Thinking (Critical)
阶段4:深度思考(关键)
STOP AND THINK DEEPLY BEFORE WRITING THE PRP
This is the most important phase. Spend significant time analyzing:
-
Integration Analysis
- How does the new feature connect to existing code?
- What existing patterns should be followed?
- Where might conflicts arise?
- What files will need to be created vs modified?
-
Implementation Path Planning
- What is the logical order of implementation steps?
- What are the dependencies between steps?
- Where are the potential roadblocks?
- What edge cases need handling?
-
Validation Strategy
- What can be validated automatically?
- What requires manual testing?
- How can the implementer verify each step?
- What are the success criteria?
-
Context Completeness Check Ask yourself:
- Could an AI agent implement this without asking questions?
- Are all integration points documented?
- Are all necessary examples included?
- Are gotchas and warnings clearly stated?
- Are validation gates executable?
- Is the implementation path clear and logical?
-
Quality Assessment
- Is this PRP comprehensive enough for one-pass implementation?
- What could cause the implementation to fail?
- What additional context would be helpful?
- Are all assumptions documented?
在编写PRP前,请停下来深入思考
这是最重要的阶段。请花足够时间分析以下内容:
-
集成分析
- 新功能如何与现有代码连接?
- 应遵循哪些现有模式?
- 可能会出现哪些冲突?
- 需要创建哪些文件,修改哪些文件?
-
实施路径规划
- 实施步骤的逻辑顺序是什么?
- 步骤之间的依赖关系是什么?
- 潜在的障碍在哪里?
- 需要处理哪些边缘情况?
-
验证策略
- 哪些内容可以自动验证?
- 哪些需要手动测试?
- 实施者如何验证每个步骤?
- 成功标准是什么?
-
上下文完整性检查 自问:
- AI Agent无需提问就能基于此PRP完成实现吗?
- 所有集成点都已记录吗?
- 所有必要的示例都已包含吗?
- 注意事项和警告是否清晰说明?
- 验证关卡是否可执行?
- 实施路径是否清晰合理?
-
质量评估
- 此PRP是否详尽到足以支持一次性实现?
- 哪些因素可能导致实现失败?
- 哪些额外的上下文会有帮助?
- 所有假设都已记录吗?
Phase 5: Generate the PRP
阶段5:生成PRP
Use the template from as the base structure, and populate it with:
assets/prp_template.md-
Metadata Section
- Feature name
- Timeline estimate
- Confidence score (1-10)
- Creation date
-
Executive Summary
- 2-3 sentences describing the feature
- Core value proposition
-
Research Findings
- Codebase analysis results (with file:line references)
- External research (with specific URLs and sections)
- Document EVERYTHING discovered in Phase 2 and 3
-
Technical Specification
- Architecture overview
- Component breakdown
- Data models
- API endpoints (if applicable)
-
Implementation Blueprint
- Prerequisites
- Step-by-step implementation (with pseudocode)
- File-by-file changes
- Reference patterns from codebase
- Error handling strategy
- Edge cases
-
Testing Strategy
- Unit test approach
- Integration test approach
- Manual testing checklist
-
Validation Gates Must be EXECUTABLE commands:bash
# Type checking npm run type-check # Linting npm run lint # Tests npm run test # Build npm run build -
Success Criteria
- Clear, measurable completion criteria
- Checklist format
以中的模板为基础,填充以下内容:
assets/prp_template.md-
元数据部分
- 功能名称
- 时间预估
- 置信度评分(1-10)
- 创建日期
-
执行摘要
- 2-3句话描述功能
- 核心价值主张
-
研究结果
- 代码库分析结果(包含file:line引用)
- 外部研究(包含具体URL和章节)
- 记录阶段2和3中发现的所有内容
-
技术规格
- 架构概述
- 组件拆分
- 数据模型
- API端点(如适用)
-
实施蓝图
- 前置条件
- 分步实施指南(包含伪代码)
- 逐文件变更说明
- 参考代码库中的模式
- 错误处理策略
- 边缘情况
-
测试策略
- 单元测试方案
- 集成测试方案
- 手动测试清单
-
验证关卡 必须是可执行的命令:bash
# Type checking npm run type-check # Linting npm run lint # Tests npm run test # Build npm run build -
成功标准
- 清晰、可衡量的完成标准
- 清单格式
Phase 6: Quality Scoring
阶段6:质量评分
Score the PRP on a scale of 1-10 for one-pass implementation success:
Scoring Criteria:
- 9-10: Exceptionally detailed, all context included, clear path, executable gates
- 7-8: Very good, minor gaps, mostly clear implementation path
- 5-6: Adequate, some ambiguity, may require clarification
- 3-4: Incomplete research, missing context, unclear path
- 1-2: Insufficient for implementation
If score is below 7: Go back and improve the PRP before delivering it.
为PRP的一次性实现成功率打分(1-10分):
Scoring Criteria:
- 9-10: Exceptionally detailed, all context included, clear path, executable gates
- 7-8: Very good, minor gaps, mostly clear implementation path
- 5-6: Adequate, some ambiguity, may require clarification
- 3-4: Incomplete research, missing context, unclear path
- 1-2: Insufficient for implementation
If score is below 7: Go back and improve the PRP before delivering it.
Phase 7: Save and Deliver
阶段7:保存与交付
-
Determine Feature Name
- Use kebab-case
- Be descriptive but concise
- Example: "user-authentication", "dark-mode-toggle", "data-export"
-
Save the PRP
Save to: PRPs/[feature-name].mdIf PRPs directory doesn't exist, create it:bashmkdir -p PRPs -
Deliver Summary to User Provide:
- Brief summary of the feature
- Location of saved PRP
- Confidence score and rationale
- Next steps recommendation
-
Determine Feature Name
- Use kebab-case
- Be descriptive but concise
- Example: "user-authentication", "dark-mode-toggle", "data-export"
-
Save the PRP
Save to: PRPs/[feature-name].mdIf PRPs directory doesn't exist, create it:bashmkdir -p PRPs -
Deliver Summary to User Provide:
- Brief summary of the feature
- Location of saved PRP
- Confidence score and rationale
- Next steps recommendation
Quality Checklist
Quality Checklist
Before delivering the PRP, verify:
- Feature requirements fully understood
- Codebase analysis completed with specific file references
- External research completed with URLs and versions
- All similar patterns identified and documented
- Coding conventions documented
- Test patterns identified
- Implementation steps clearly defined
- Validation gates are executable (not pseudo-code)
- Error handling strategy documented
- Edge cases identified
- Success criteria defined
- Confidence score 7+ (if not, improve the PRP)
- No assumptions left undocumented
- Integration points clearly identified
- PRP saved to correct location
Before delivering the PRP, verify:
- Feature requirements fully understood
- Codebase analysis completed with specific file references
- External research completed with URLs and versions
- All similar patterns identified and documented
- Coding conventions documented
- Test patterns identified
- Implementation steps clearly defined
- Validation gates are executable (not pseudo-code)
- Error handling strategy documented
- Edge cases identified
- Success criteria defined
- Confidence score 7+ (if not, improve the PRP)
- No assumptions left undocumented
- Integration points clearly identified
- PRP saved to correct location
Common Pitfalls to Avoid
Common Pitfalls to Avoid
-
Vague References
- ❌ "There's a similar component somewhere"
- ✅ "See UserProfile at src/components/UserProfile.tsx:45-67"
-
Missing Version Information
- ❌ "Use React Query"
- ✅ "Use @tanstack/react-query v5.28.0"
-
Non-Executable Validation Gates
- ❌ "Run tests and make sure they pass"
- ✅ "npm run test && npm run build"
-
Generic Best Practices
- ❌ "Follow React best practices"
- ✅ "Use named exports (see src/components/Button.tsx:1)"
-
Incomplete Research
- ❌ Skipping codebase analysis
- ✅ Thoroughly document existing patterns
-
Missing Gotchas
- ❌ Assuming smooth implementation
- ✅ Document known issues and edge cases
-
Vague References
- ❌ "There's a similar component somewhere"
- ✅ "See UserProfile at src/components/UserProfile.tsx:45-67"
-
Missing Version Information
- ❌ "Use React Query"
- ✅ "Use @tanstack/react-query v5.28.0"
-
Non-Executable Validation Gates
- ❌ "Run tests and make sure they pass"
- ✅ "npm run test && npm run build"
-
Generic Best Practices
- ❌ "Follow React best practices"
- ✅ "Use named exports (see src/components/Button.tsx:1)"
-
Incomplete Research
- ❌ Skipping codebase analysis
- ✅ Thoroughly document existing patterns
-
Missing Gotchas
- ❌ Assuming smooth implementation
- ✅ Document known issues and edge cases
Example Usage
Example Usage
User Request:
"Create a PRP for adding dark mode support to the application"
Your Response:
- Clarify: "Should dark mode preference persist across sessions? Should it respect system preferences?"
- Research codebase for theme-related code
- Research external resources (dark mode best practices, library options)
- Ultra-think about implementation approach
- Generate comprehensive PRP using template
- Score the PRP
- Save to
PRPs/dark-mode-support.md - Deliver summary with confidence score
User Request:
"Create a PRP for adding dark mode support to the application"
Your Response:
- Clarify: "Should dark mode preference persist across sessions? Should it respect system preferences?"
- Research codebase for theme-related code
- Research external resources (dark mode best practices, library options)
- Ultra-think about implementation approach
- Generate comprehensive PRP using template
- Score the PRP
- Save to
PRPs/dark-mode-support.md - Deliver summary with confidence score
Resources
Resources
Template
Template
- - Base template for all PRPs
assets/prp_template.md
- - Base template for all PRPs
assets/prp_template.md
References
References
- - Detailed research guidance and best practices
references/research_methodology.md
- - Detailed research guidance and best practices
references/research_methodology.md
Notes
Notes
- Research is mandatory: Never skip codebase or external research
- Be specific: Always include file paths, line numbers, URLs, versions
- Think deeply: Phase 4 (Ultra-Thinking) is critical for success
- Validate everything: All validation gates must be executable
- Score honestly: If confidence is below 7, improve the PRP
- Context is king: The implementer only has what you put in the PRP
- Research is mandatory: Never skip codebase or external research
- Be specific: Always include file paths, line numbers, URLs, versions
- Think deeply: Phase 4 (Ultra-Thinking) is critical for success
- Validate everything: All validation gates must be executable
- Score honestly: If confidence is below 7, improve the PRP
- Context is king: The implementer only has what you put in the PRP