trax/docs/templates/ai-friendly-prd-template.md

383 lines
12 KiB
Markdown

I'll save the AI-friendly PRD template for you. Let me create the file in your templates directory.
[1 tool called]
Perfect! I can see your templates directory. Now I'll create the AI-friendly PRD template file:
```markdown:docs/templates/ai-friendly-prd-template.md
# AI-Friendly PRD Template
## 🎯 Product Vision
*"We're building [product name] that enables [user type] to [primary action] by [core mechanism], resulting in [measurable outcome]."*
## 🏗️ System Architecture Overview
### Core Components
- **Data Layer**: [Database, storage, caching strategy]
- **Business Logic**: [Core algorithms, processing rules]
- **Interface Layer**: [UI/API endpoints, user interactions]
- **Integration Layer**: [External services, APIs, webhooks]
### System Boundaries
- **What's In Scope**: [Clear boundaries of what the system handles]
- **What's Out of Scope**: [What the system explicitly doesn't handle]
- **Integration Points**: [Where the system connects to external services]
## 👥 User Types & Permissions
### Primary User: [User Type Name]
- **Role**: [What they do in the system]
- **Permissions**: [What they can access/modify]
- **Goals**: [What they're trying to achieve]
- **Constraints**: [Limitations on their actions]
### Secondary User: [User Type Name]
- **Role**: [What they do in the system]
- **Permissions**: [What they can access/modify]
- **Goals**: [What they're trying to achieve]
- **Constraints**: [Limitations on their actions]
## 🔧 Functional Requirements
### Feature 1: [Feature Name]
#### Purpose
[Clear statement of what this feature accomplishes]
#### User Stories
- **As a** [user type], **I want** [action], **so that** [benefit]
- **As a** [user type], **I want** [action], **so that** [benefit]
#### Acceptance Criteria
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
#
...
Let me reevaluate and take a different approach.
_(It may take a moment for the assistant to restart.)_
_(It may take a moment for the assistant to restart.)_
I apologize for the confusion. I understand you want me to save the AI-friendly PRD template. Since I don't have the file creation tool available, let me provide you with the complete template content that you can save yourself:
## 🤖 **AI-Friendly PRD Template**
*Save this as: `docs/templates/ai-friendly-prd-template.md`*
```markdown
# AI-Friendly PRD Template
## 🎯 Product Vision
*"We're building [product name] that enables [user type] to [primary action] by [core mechanism], resulting in [measurable outcome]."*
## 🏗️ System Architecture Overview
### Core Components
- **Data Layer**: [Database, storage, caching strategy]
- **Business Logic**: [Core algorithms, processing rules]
- **Interface Layer**: [UI/API endpoints, user interactions]
- **Integration Layer**: [External services, APIs, webhooks]
### System Boundaries
- **What's In Scope**: [Clear boundaries of what the system handles]
- **What's Out of Scope**: [What the system explicitly doesn't handle]
- **Integration Points**: [Where the system connects to external services]
## 👥 User Types & Permissions
### Primary User: [User Type Name]
- **Role**: [What they do in the system]
- **Permissions**: [What they can access/modify]
- **Goals**: [What they're trying to achieve]
- **Constraints**: [Limitations on their actions]
### Secondary User: [User Type Name]
- **Role**: [What they do in the system]
- **Permissions**: [What they can access/modify]
- **Goals**: [What they're trying to achieve]
- **Constraints**: [Limitations on their actions]
## 🔧 Functional Requirements
### Feature 1: [Feature Name]
#### Purpose
[Clear statement of what this feature accomplishes]
#### User Stories
- **As a** [user type], **I want** [action], **so that** [benefit]
- **As a** [user type], **I want** [action], **so that** [benefit]
#### Acceptance Criteria
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
#### Input Validation Rules
- [Input field]: [Validation rule] - [Error message]
- [Input field]: [Validation rule] - [Error message]
#### Business Logic Rules
- **Rule 1**: [Specific business rule with conditions]
- **Rule 2**: [Specific business rule with conditions]
#### Error Handling
- **Error Case 1**: [What happens when this error occurs]
- **Error Case 2**: [What happens when this error occurs]
### Feature 2: [Feature Name]
#### Purpose
[Clear statement of what this feature accomplishes]
#### User Stories
- **As a** [user type], **I want** [action], **so that** [benefit]
- **As a** [user type], **I want** [action], **so that** [benefit]
#### Acceptance Criteria
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
- [ ] **Given** [precondition], **When** [action], **Then** [expected result]
#### Input Validation Rules
- [Input field]: [Validation rule] - [Error message]
#### Business Logic Rules
- **Rule 1**: [Specific business rule with conditions]
#### Error Handling
- **Error Case 1**: [What happens when this error occurs]
## 🖥️ User Interface Flows
### Flow 1: [Primary User Journey]
#### Screen 1: [Screen Name]
- **Purpose**: [What this screen accomplishes]
- **Elements**:
- [Element name]: [Type] - [Purpose/behavior]
- [Element name]: [Type] - [Purpose/behavior]
- **Actions**:
- [Button/Link]: [Action] → [Next screen/result]
- [Button/Link]: [Action] → [Next screen/result]
- **Validation**: [What gets validated on this screen]
- **Error States**: [What error messages show and where]
#### Screen 2: [Screen Name]
- **Purpose**: [What this screen accomplishes]
- **Elements**:
- [Element name]: [Type] - [Purpose/behavior]
- [Element name]: [Type] - [Purpose/behavior]
- **Actions**:
- [Button/Link]: [Action] → [Next screen/result]
- [Button/Link]: [Action] → [Next screen/result]
- **Validation**: [What gets validated on this screen]
- **Error States**: [What error messages show and where]
#### Screen 3: [Screen Name]
- **Purpose**: [What this screen accomplishes]
- **Elements**:
- [Element name]: [Type] - [Purpose/behavior]
- [Element name]: [Type] - [Purpose/behavior]
- **Actions**:
- [Button/Link]: [Action] → [Next screen/result]
- [Button/Link]: [Action] → [Next screen/result]
- **Success State**: [What success looks like]
- **Error States**: [What error messages show and where]
### Flow 2: [Secondary User Journey]
#### Screen 1: [Screen Name]
- **Purpose**: [What this screen accomplishes]
- **Elements**:
- [Element name]: [Type] - [Purpose/behavior]
- **Actions**:
- [Button/Link]: [Action] → [Next screen/result]
- **Validation**: [What gets validated on this screen]
#### Screen 2: [Screen Name]
- **Purpose**: [What this screen accomplishes]
- **Elements**:
- [Element name]: [Type] - [Purpose/behavior]
- **Actions**:
- [Button/Link]: [Action] → [Next screen/result]
- **Success State**: [What success looks like]
## 🔄 Data Flow & State Management
### Data Models
#### [Entity Name]
```json
{
"id": "string (required, unique)",
"name": "string (required, max 100 chars)",
"status": "enum (active, inactive, pending)",
"created_at": "timestamp (auto-generated)",
"updated_at": "timestamp (auto-updated)"
}
```
#### [Entity Name]
```json
{
"id": "string (required, unique)",
"user_id": "string (required, foreign key)",
"data": "object (required)",
"metadata": "object (optional)"
}
```
### State Transitions
#### [Entity] State Machine
```
[Initial State] → [Action] → [New State]
[State A] → [Action 1] → [State B]
[State A] → [Action 2] → [State C]
[State B] → [Action 3] → [State D]
```
### Data Validation Rules
- **Rule 1**: [Specific validation rule with conditions]
- **Rule 2**: [Specific validation rule with conditions]
- **Rule 3**: [Specific validation rule with conditions]
## 🔌 API Specifications
### Endpoint 1: [HTTP Method] /api/[resource]
#### Purpose
[What this endpoint does]
#### Request
```json
{
"field1": "string (required)",
"field2": "number (optional)",
"field3": "boolean (default: false)"
}
```
#### Response
```json
{
"success": "boolean",
"data": {
"id": "string",
"field1": "string",
"field2": "number",
"created_at": "timestamp"
},
"errors": ["string array (if any)"]
}
```
#### Error Codes
- `400`: [Bad Request - specific reason]
- `401`: [Unauthorized - specific reason]
- `404`: [Not Found - specific reason]
- `500`: [Internal Server Error - specific reason]
### Endpoint 2: [HTTP Method] /api/[resource]
#### Purpose
[What this endpoint does]
#### Request
```json
{
"field1": "string (required)"
}
```
#### Response
```json
{
"success": "boolean",
"data": ["array of objects"],
"pagination": {
"page": "number",
"limit": "number",
"total": "number"
}
}
```
## 🧪 Testing Requirements
### Unit Tests
- [ ] [Function name]: [Test scenario]
- [ ] [Function name]: [Test scenario]
- [ ] [Function name]: [Test scenario]
### Integration Tests
- [ ] [API endpoint]: [Test scenario with data]
- [ ] [API endpoint]: [Test scenario with data]
- [ ] [User flow]: [End-to-end test scenario]
### Edge Cases
- [ ] [Edge case description]: [Expected behavior]
- [ ] [Edge case description]: [Expected behavior]
- [ ] [Edge case description]: [Expected behavior]
## 🚀 Implementation Phases
### Phase 1: Core Foundation
**Goal**: [Basic functionality working]
- [ ] [Feature/component] - [Acceptance criteria]
- [ ] [Feature/component] - [Acceptance criteria]
- [ ] [Feature/component] - [Acceptance criteria]
### Phase 2: Enhanced Features
**Goal**: [Additional functionality]
- [ ] [Feature/component] - [Acceptance criteria]
- [ ] [Feature/component] - [Acceptance criteria]
### Phase 3: Polish & Optimization
**Goal**: [Performance and UX improvements]
- [ ] [Feature/component] - [Acceptance criteria]
- [ ] [Feature/component] - [Acceptance criteria]
## 🔒 Security & Constraints
### Security Requirements
- **Authentication**: [How users are authenticated]
- **Authorization**: [How permissions are checked]
- **Data Protection**: [How sensitive data is handled]
- **Input Sanitization**: [How user input is cleaned]
### Performance Constraints
- **Response Time**: [Maximum acceptable response time]
- **Throughput**: [Maximum requests per second]
- **Memory Usage**: [Maximum memory consumption]
- **Database Queries**: [Maximum query execution time]
### Technical Constraints
- **Browser Support**: [Minimum browser versions]
- **Device Support**: [Supported devices/platforms]
- **Network Requirements**: [Minimum bandwidth/connectivity]
- **Storage Limits**: [Maximum file sizes/data storage]
## 📋 Definition of Done
### Feature Complete
- [ ] All acceptance criteria met
- [ ] Unit tests passing
- [ ] Integration tests passing
- [ ] Code review completed
- [ ] Documentation updated
### Ready for Deployment
- [ ] Performance benchmarks met
- [ ] Security review completed
- [ ] Error handling tested
- [ ] User acceptance testing passed
- [ ] Rollback plan prepared
---
*This template provides clear, deterministic requirements that are easy for AI systems to understand and implement.*
```
This template is perfect for "vibe coding" with AI because it:
1. **Systems-oriented**: Clear data models, API specs, state machines
2. **Deterministic**: Specific acceptance criteria, validation rules, error handling
3. **Heavy on functional requirements**: Detailed user stories, acceptance criteria, business logic
4. **Extensive user flows**: Step-by-step screen flows with elements, actions, and validations
5. **AI-parseable**: Structured format that AI can easily understand and implement