Auto-activates when generating Product Requirements Prompt (PRP) documents from synthesized design outputs, providing structured templates and comprehensive implementation guidance.
allowed-tools
Write, Edit
Purpose
The prp-generator skill provides structured templates and methods for creating comprehensive Product Requirements Prompt (PRP) documents. PRPs serve as the primary input for Phase 3 (Implementation), containing all design information, library documentation, dependencies, implementation plans, testing strategies, and success criteria needed to implement features.
When to Use
This skill auto-activates when you:
Generate PRP documents from synthesized design
Create implementation guidance from architectural design
Structure design information for implementation phase
Define implementation plans with step-by-step guidance
Specify testing strategies and success criteria
Document architecture, libraries, and dependencies for implementers
Provided Capabilities
1. Structured PRP Generation
Standard Template: Consistent PRP structure across all features
Section Templates: Pre-defined templates for each PRP section
Completeness Checking: Ensure all required sections present
Format Validation: Validate markdown structure and linking
2. Implementation Planning
Phased Approach: Break implementation into logical phases
Step-by-Step Guidance: Detailed steps within each phase
Dependency Ordering: Ensure dependencies installed before use
Validation Checkpoints: Define validation at each phase
3. Testing Strategy Documentation
Test Types: Unit, integration, end-to-end testing approaches
Test Coverage: Specify coverage targets per component
Mock Strategies: Document how to mock library dependencies
Test Data: Provide test data and fixture guidance
4. Success Criteria Definition
Acceptance Criteria: Map from requirements analysis
## Executive Summary
This document provides comprehensive implementation guidance for [feature name],
which [high-level description of what feature does and why it's valuable].
**Architectural Approach**: [Brief description of architecture - e.g., "Service layer
pattern with FastAPI endpoints, SQLAlchemy ORM, and Redis caching"]
**Key Libraries**: [List 3-5 primary libraries - e.g., "FastAPI 0.95.0 for API
framework, SQLAlchemy 2.0.0 for ORM, PassLib 1.7.4 for password hashing"]
**Implementation Strategy**: [Brief description of implementation phases - e.g.,
"4-phase approach: (1) Data models and repository, (2) Service layer business logic,
(3) API endpoints, (4) Testing and validation"]
**Key Considerations**: [1-2 important considerations - e.g., "Security-first
approach with OWASP compliance, performance target of <200ms API response time"]
Example:
## Executive Summary
This document provides comprehensive implementation guidance for user authentication
system, which enables secure user login, session management, and access control for
the application.
**Architectural Approach**: Service layer pattern with FastAPI RESTful API endpoints,
SQLAlchemy ORM for user persistence, PassLib for secure password hashing, and JWT
tokens for session management.
**Key Libraries**: FastAPI 0.95.0 (API framework), SQLAlchemy 2.0.0 (ORM), PassLib
1.7.4 (password hashing), python-jose 3.3.0 (JWT tokens), pydantic 1.10.7 (validation).
**Implementation Strategy**: 4-phase approach: (1) User data model and repository
with SQLAlchemy, (2) Authentication service with PassLib and JWT, (3) FastAPI
endpoints with pydantic validation, (4) Comprehensive testing with pytest and mocks.
**Key Considerations**: OWASP Top 10 compliance for authentication vulnerabilities,
bcrypt with cost factor 12 for password hashing, rate limiting for brute force
protection, secure session token management with expiration.
Step 4: Document Requirements Reference
Link to analysis document and summarize key requirements:
from pydantic import BaseModel, Field
from [library] import [ValidationMixin]
class [ModelName](BaseModel):
field1: type = Field(..., description="...") # Validation
field2: type = Field(default=..., ge=..., le=...) # Range validation# ... more fields
Validation Rules:
[Field1]: [Validation description]
[Field2]: [Validation description]
Relationships:
[Related Model]: [Relationship type and description]
class [RequestModel](BaseModel):
field1: type
field2: type
Response:
class [ResponseModel](BaseModel):
field1: type
field2: type
Status Codes:
200: Success - [Description]
400: Bad Request - [Description]
401: Unauthorized - [Description]
404: Not Found - [Description]
500: Internal Server Error - [Description]
Implementation:
# FastAPI endpoint pattern from library docs@app.[method]("/path", response_model=[ResponseModel])defendpoint([params: RequestModel]):
# Implementation using service layer
...
[Repeat for each endpoint]
Data Flow
[Describe how data flows through system]
Example Flow: User Authentication
1. Client sends POST /auth/login with email/password
2. FastAPI endpoint validates request (Pydantic)
3. AuthenticationService.authenticate() called
4. UserRepository.get_by_email() queries database (SQLAlchemy)
5. PassLib.verify() checks password hash
6. JWT token generated (python-jose)
7. Token returned to client
Error Handling Strategy
Library Exception Mapping:
Library Exception
Architectural Exception
HTTP Status
User Message
[LibraryException]
[AppException]
[Code]
[Message]
Error Handling Pattern:
try:
# Library operationexcept LibraryException as e:
# Map to architectural exceptionraise AppException(...) from e
### Step 6: Document Library Documentation
Use library information from Documentation Researcher:
**Library Documentation Template**:
```markdown
## Library Documentation
### Library: [LibraryName] v[Version]
**Purpose**: [What library does]
**Documentation**: [Link to official docs]
**Repository**: [Link to GitHub/source]
**Installation**:
```bash
pip install [library-name]==[version]
Key APIs Used:
[API1]: [Description and purpose]
[API2]: [Description and purpose]
Integration Pattern:
# Example from library documentation
[Code example showing how to use library in this project]
Configuration:
# Configuration required for this library
[Configuration code or settings]
Best Practices (from library docs):
[Best practice 1]
[Best practice 2]
Known Issues:
[Issue 1 and workaround]
[Issue 2 and workaround]
Testing Notes:
Mocking: [How to mock this library in tests]
Test Containers: [If integration tests need real library instance]
[Repeat for each library]
Library Comparison (if alternatives considered)
Library
Version
Pros
Cons
Decision
[Lib A]
[Ver]
[Pros]
[Cons]
✅ Chosen
[Lib B]
[Ver]
[Pros]
[Cons]
❌ Not chosen
Selection Rationale: [Why chosen library was selected]
### Step 7: Document Dependencies
Use dependency information from Dependency Manager:
**Dependencies Template**:
```markdown
## Dependencies
### Dependency Tree
[Full dependency tree with versions]
[library-a]==[version]
├── [dep-1]==[version]
│ └── [sub-dep]==[version]
├── [dep-2]==[version]
└── [optional-dep] (optional)
### Installation Commands
**Install all dependencies**:
```bash
# Install using pip
pip install -r requirements.txt
# Or using uv (faster)
uv pip install -r requirements.txt
Purpose: [What this dependency provides]
Required By: [Libraries that need this dependency]
Version Constraint: [Why this specific version]
Alternatives: [Alternative versions/libraries considered]
[Repeat for key dependencies]
Compatibility Notes
Python Version: [Required Python version]
Operating System: [OS compatibility notes]
Database: [Database version requirements]
Other System Dependencies: [System-level requirements]
Dependency Conflicts and Resolutions
[If any conflicts were found and resolved]
Conflict: [Description]
Library A needs: [Constraint A]
Library B needs: [Constraint B]
Resolution: [How conflict was resolved]
Pinned Version: [Final version chosen]
### Step 8: Create Implementation Plan
Use `prp-template.md` implementation plan section:
**Implementation Plan Template**:
```markdown
## Implementation Plan
### Overview
This implementation follows a [N]-phase approach, progressing from foundation
(data models) to core functionality to integration to testing. Each phase builds
on the previous phase and has validation checkpoints.
### Phase 1: Foundation ([Estimated Time])
**Goal**: Create data models, repositories, and core utilities
**Tasks**:
1. **Data Models** ([Time])
- [ ] Create [Model1] Pydantic schema with validations
- [ ] Create [Model2] Pydantic schema with validations
- [ ] Add [Library]-specific validators
- [ ] Write unit tests for model validation
2. **Repository Layer** ([Time])
- [ ] Create [Repository1] with CRUD operations
- [ ] Implement [Library] ORM mappings
- [ ] Add query methods for common operations
- [ ] Write repository unit tests with mocks
3. **Configuration** ([Time])
- [ ] Create configuration classes (Pydantic BaseSettings)
- [ ] Add environment variable loading
- [ ] Configure [Library1], [Library2]
- [ ] Write configuration validation tests
**Validation Checkpoint**:
- [ ] All data models validate correctly
- [ ] All repository operations work with test database
- [ ] Configuration loads from environment
- [ ] Phase 1 tests pass (pytest)
### Phase 2: Core Implementation ([Estimated Time])
**Goal**: Implement business logic services using libraries
**Tasks**:
1. **Service Layer** ([Time])
- [ ] Create [Service1] with business logic
- [ ] Integrate [Library1] for [functionality]
- [ ] Implement error handling and exception mapping
- [ ] Add logging and monitoring
- [ ] Write service unit tests with mocked dependencies
2. **Library Integration** ([Time])
- [ ] Set up [Library2] client/connection
- [ ] Implement [Library2] operations
- [ ] Add retry logic for transient failures
- [ ] Write integration tests with test containers
**Validation Checkpoint**:
- [ ] All service methods work correctly
- [ ] Library integrations functioning
- [ ] Error handling covers all cases
- [ ] Phase 2 tests pass (pytest)
### Phase 3: Integration ([Estimated Time])
**Goal**: Connect components and create API endpoints
**Tasks**:
1. **API Endpoints** ([Time])
- [ ] Create [Endpoint1] with [Method] [/path]
- [ ] Add request/response validation (Pydantic)
- [ ] Integrate with service layer
- [ ] Add authentication/authorization
- [ ] Write endpoint integration tests
2. **Component Integration** ([Time])
- [ ] Connect [Component A] to [Component B]
- [ ] Implement data flow [Flow description]
- [ ] Add transaction handling
- [ ] Write integration tests for full flows
3. **Error Handling** ([Time])
- [ ] Add global exception handlers
- [ ] Map library exceptions to HTTP status codes
- [ ] Implement error response formatting
- [ ] Test error scenarios
**Validation Checkpoint**:
- [ ] All API endpoints respond correctly
- [ ] End-to-end flows work
- [ ] Error handling covers all endpoints
- [ ] Phase 3 tests pass (pytest)
### Phase 4: Testing & Validation ([Estimated Time])
**Goal**: Comprehensive testing and final validation
**Tasks**:
1. **Unit Test Coverage** ([Time])
- [ ] Achieve [X]% unit test coverage
- [ ] All components have isolated unit tests
- [ ] All edge cases covered
- [ ] Mock all external dependencies
2. **Integration Testing** ([Time])
- [ ] Test all API endpoints (end-to-end)
- [ ] Test library integrations with real instances
- [ ] Test error scenarios and recovery
- [ ] Performance testing ([targets])
3. **Security Validation** ([Time])
- [ ] OWASP Top 10 verification
- [ ] Input validation testing
- [ ] Authentication/authorization testing
- [ ] Secrets management verification
4. **Documentation** ([Time])
- [ ] Update API documentation
- [ ] Add code comments for complex logic
- [ ] Create user guide (if needed)
- [ ] Update README with new feature
**Final Validation**:
- [ ] All acceptance criteria met
- [ ] All tests pass (pytest)
- [ ] Coverage targets achieved
- [ ] Security validation complete
- [ ] Documentation complete
- [ ] Code review passed
### Phase 5: Deployment ([Estimated Time])
**Goal**: Deploy to production environment
**Tasks**:
1. **Pre-Deployment** ([Time])
- [ ] Review deployment checklist
- [ ] Verify environment configuration
- [ ] Database migrations tested
- [ ] Rollback plan documented
2. **Deployment** ([Time])
- [ ] Deploy to staging environment
- [ ] Run smoke tests in staging
- [ ] Deploy to production
- [ ] Monitor for errors
3. **Post-Deployment** ([Time])
- [ ] Verify production functionality
- [ ] Monitor performance metrics
- [ ] Check logs for errors
- [ ] Update documentation
**Deployment Validation**:
- [ ] Feature working in production
- [ ] No critical errors in logs
- [ ] Performance meets targets
- [ ] Monitoring dashboards updated
Step 9: Define Testing Strategy
Use prp-template.md testing section:
Testing Strategy Template:
## Testing Strategy### Overview
Comprehensive testing approach with [X]% code coverage target, including unit tests
(with mocks), integration tests (with test containers), and end-to-end tests (full
API flow).
### Unit Testing**Scope**: Individual functions, classes, methods in isolation
**Framework**: pytest
**Coverage Target**: [X]% for all modules
**Mocking Strategy**:
- Mock [Library1] using unittest.mock
- Mock [Library2] using [library-specific test fixtures]
- Mock database using SQLAlchemy in-memory database
**Test Structure**:
**Example Unit Test**:
```python
# Test with mocked library
from unittest.mock import Mock
import pytest
def test_service_method():
# Mock library dependency
mock_lib = Mock()
mock_lib.method.return_value = "expected"
# Test service with mock
service = MyService(mock_lib)
result = service.do_something()
assert result == "processed_expected"
mock_lib.method.assert_called_once()
Key Test Cases:
[Component1]: Test [key functionality]
[Component2]: Test [error handling]
[Model1]: Test [validation rules]
Integration Testing
Scope: Components working together with real library instances
tests/
├── integration/
│ ├── test_database_operations.py # Real DB tests
│ ├── test_cache_operations.py # Real Redis tests
│ └── test_library_integrations.py # Real library usage
Example Integration Test:
from testcontainers.postgres import PostgresContainer
deftest_repository_integration():
with PostgresContainer("postgres:15") as postgres:
# Create real database engine
engine = create_engine(postgres.get_connection_url())
# Test with real database
...
Key Test Cases:
[Integration1]: Test [data flow]
[Integration2]: Test [library interaction]
End-to-End Testing
Scope: Complete API flows from request to response
Framework: pytest with TestClient (FastAPI) or requests