claude-autopm 1.27.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/autopm/.claude/scripts/pm/prd-new.js +292 -2
- package/autopm/.claude/scripts/pm/template-list.js +119 -0
- package/autopm/.claude/scripts/pm/template-new.js +344 -0
- package/autopm/.claude/templates/prds/README.md +334 -0
- package/autopm/.claude/templates/prds/api-feature.md +306 -0
- package/autopm/.claude/templates/prds/bug-fix.md +413 -0
- package/autopm/.claude/templates/prds/data-migration.md +483 -0
- package/autopm/.claude/templates/prds/documentation.md +439 -0
- package/autopm/.claude/templates/prds/ui-feature.md +365 -0
- package/lib/template-engine.js +347 -0
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
title: {{title}}
|
|
4
|
+
type: prd
|
|
5
|
+
status: draft
|
|
6
|
+
priority: {{priority}}
|
|
7
|
+
created: {{timestamp}}
|
|
8
|
+
author: {{author}}
|
|
9
|
+
timeline: {{timeline}}
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# PRD: {{title}}
|
|
13
|
+
|
|
14
|
+
## Executive Summary
|
|
15
|
+
|
|
16
|
+
Design and implement {{title}} - a RESTful API endpoint for {{api_purpose}}.
|
|
17
|
+
|
|
18
|
+
**API Endpoint**: `{{http_method}} {{api_endpoint}}`
|
|
19
|
+
|
|
20
|
+
## Problem Statement
|
|
21
|
+
|
|
22
|
+
### Background
|
|
23
|
+
{{problem}}
|
|
24
|
+
|
|
25
|
+
### Business Value
|
|
26
|
+
{{business_value}}
|
|
27
|
+
|
|
28
|
+
### API Requirements
|
|
29
|
+
- **Endpoint**: `{{http_method}} {{api_endpoint}}`
|
|
30
|
+
- **Authentication**: {{auth_method}}
|
|
31
|
+
- **Rate Limiting**: {{rate_limit}}
|
|
32
|
+
- **Performance**: < 100ms (internal) / < 1s (complex)
|
|
33
|
+
|
|
34
|
+
## User Stories
|
|
35
|
+
|
|
36
|
+
Following INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable):
|
|
37
|
+
|
|
38
|
+
- As a **{{user_role}}**, I want to **{{api_action}}** so that **{{user_benefit}}**
|
|
39
|
+
|
|
40
|
+
{{#if additional_stories}}
|
|
41
|
+
{{#each additional_stories}}
|
|
42
|
+
- As a **{{role}}**, I want to **{{action}}** so that **{{benefit}}**
|
|
43
|
+
{{/each}}
|
|
44
|
+
{{/if}}
|
|
45
|
+
|
|
46
|
+
## API Specification
|
|
47
|
+
|
|
48
|
+
### OpenAPI Contract (Design-First Approach)
|
|
49
|
+
|
|
50
|
+
**Method**: `{{http_method}}`
|
|
51
|
+
**Endpoint**: `{{api_endpoint}}`
|
|
52
|
+
**Content-Type**: `application/json`
|
|
53
|
+
|
|
54
|
+
### Request
|
|
55
|
+
|
|
56
|
+
**Headers**:
|
|
57
|
+
```
|
|
58
|
+
Authorization: Bearer <token>
|
|
59
|
+
Content-Type: application/json
|
|
60
|
+
{{#if custom_headers}}{{custom_headers}}{{/if}}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Body** (JSON):
|
|
64
|
+
```json
|
|
65
|
+
{{request_body_example}}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Validation Rules**:
|
|
69
|
+
{{#if validation_rules}}
|
|
70
|
+
{{#each validation_rules}}
|
|
71
|
+
- {{field}}: {{rule}}
|
|
72
|
+
{{/each}}
|
|
73
|
+
{{/if}}
|
|
74
|
+
|
|
75
|
+
### Response
|
|
76
|
+
|
|
77
|
+
**Success (200 OK)**:
|
|
78
|
+
```json
|
|
79
|
+
{{response_body_example}}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Created (201)**:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"id": "{{resource_id}}",
|
|
86
|
+
"message": "Resource created successfully",
|
|
87
|
+
"data": {{response_body_example}}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Error Responses**:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"error": {
|
|
96
|
+
"code": "ERROR_CODE",
|
|
97
|
+
"message": "Human-readable message",
|
|
98
|
+
"details": [
|
|
99
|
+
{
|
|
100
|
+
"field": "field_name",
|
|
101
|
+
"message": "Specific error"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Status Codes**:
|
|
109
|
+
- `200 OK` - Success
|
|
110
|
+
- `201 Created` - Resource created
|
|
111
|
+
- `400 Bad Request` - Invalid input
|
|
112
|
+
- `401 Unauthorized` - Missing/invalid auth
|
|
113
|
+
- `403 Forbidden` - Insufficient permissions
|
|
114
|
+
- `404 Not Found` - Resource not found
|
|
115
|
+
- `429 Too Many Requests` - Rate limit exceeded
|
|
116
|
+
- `500 Internal Server Error` - Server error
|
|
117
|
+
- `503 Service Unavailable` - Temporary unavailability
|
|
118
|
+
|
|
119
|
+
## Technical Requirements
|
|
120
|
+
|
|
121
|
+
### Architecture
|
|
122
|
+
- **Service**: {{service_name}}
|
|
123
|
+
- **Database**: {{database_tables}}
|
|
124
|
+
- **Cache**: {{cache_strategy}}
|
|
125
|
+
- **Message Queue**: {{queue_system}}
|
|
126
|
+
|
|
127
|
+
### Security (2025 Best Practices)
|
|
128
|
+
- [ ] **Authentication**: JWT (JSON Web Tokens) with refresh tokens
|
|
129
|
+
- [ ] **Authorization**: Role-based access control (RBAC)
|
|
130
|
+
- [ ] **Input Validation**: Whitelist approach, sanitize all inputs
|
|
131
|
+
- [ ] **SQL Injection Prevention**: Parameterized queries only
|
|
132
|
+
- [ ] **XSS Prevention**: Content-Type headers, output encoding
|
|
133
|
+
- [ ] **CSRF Protection**: Token-based validation
|
|
134
|
+
- [ ] **HTTPS/TLS**: SSL/TLS 1.3 minimum
|
|
135
|
+
- [ ] **API Keys**: Encrypted storage, rotation policy
|
|
136
|
+
- [ ] **Rate Limiting**: Per-user and per-IP limits
|
|
137
|
+
|
|
138
|
+
### Performance Targets
|
|
139
|
+
- **Response Time**: < 100ms (p50), < 200ms (p95), < 1s (p99)
|
|
140
|
+
- **Throughput**: {{requests_per_second}} req/s
|
|
141
|
+
- **Concurrent Users**: {{concurrent_users}}
|
|
142
|
+
- **Availability**: 99.9% uptime (SLA)
|
|
143
|
+
- **Error Rate**: < 0.1%
|
|
144
|
+
|
|
145
|
+
### Data Model
|
|
146
|
+
```
|
|
147
|
+
{{database_schema}}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Dependencies
|
|
151
|
+
- [ ] External APIs: {{external_apis}}
|
|
152
|
+
- [ ] Internal Services: {{internal_services}}
|
|
153
|
+
- [ ] Third-party Libraries: {{libraries}}
|
|
154
|
+
|
|
155
|
+
## Testing Requirements
|
|
156
|
+
|
|
157
|
+
### Unit Tests (TDD - Red-Green-Refactor)
|
|
158
|
+
- [ ] Request validation (all fields)
|
|
159
|
+
- [ ] Business logic (core functionality)
|
|
160
|
+
- [ ] Error handling (all error cases)
|
|
161
|
+
- [ ] Edge cases (boundary conditions)
|
|
162
|
+
- [ ] Mock external dependencies
|
|
163
|
+
|
|
164
|
+
### Integration Tests
|
|
165
|
+
- [ ] Database operations (CRUD)
|
|
166
|
+
- [ ] External API calls
|
|
167
|
+
- [ ] Cache operations
|
|
168
|
+
- [ ] Message queue integration
|
|
169
|
+
- [ ] Authentication flow
|
|
170
|
+
|
|
171
|
+
### E2E Tests
|
|
172
|
+
- [ ] Happy path (complete flow)
|
|
173
|
+
- [ ] Authentication/Authorization
|
|
174
|
+
- [ ] Error scenarios
|
|
175
|
+
- [ ] Rate limiting
|
|
176
|
+
- [ ] Load testing ({{load_test_target}} concurrent users)
|
|
177
|
+
|
|
178
|
+
### Security Tests
|
|
179
|
+
- [ ] Penetration testing
|
|
180
|
+
- [ ] OWASP Top 10 validation
|
|
181
|
+
- [ ] Authentication bypass attempts
|
|
182
|
+
- [ ] SQL injection tests
|
|
183
|
+
- [ ] XSS vulnerability scanning
|
|
184
|
+
|
|
185
|
+
## Success Metrics (SMART Goals)
|
|
186
|
+
|
|
187
|
+
- **Adoption**: {{adoption_target}}% of users within {{adoption_timeframe}}
|
|
188
|
+
- **Performance**: {{performance_target}}ms p95 response time
|
|
189
|
+
- **Reliability**: {{uptime_target}}% uptime
|
|
190
|
+
- **Error Rate**: < {{error_rate_target}}%
|
|
191
|
+
- **User Satisfaction**: {{satisfaction_target}} NPS score
|
|
192
|
+
|
|
193
|
+
## API Documentation
|
|
194
|
+
|
|
195
|
+
### Interactive Documentation
|
|
196
|
+
- [ ] OpenAPI/Swagger UI
|
|
197
|
+
- [ ] Postman Collection
|
|
198
|
+
- [ ] Code examples (cURL, JavaScript, Python)
|
|
199
|
+
- [ ] Authentication guide
|
|
200
|
+
- [ ] Rate limiting documentation
|
|
201
|
+
|
|
202
|
+
### Developer Experience
|
|
203
|
+
- [ ] SDK availability (if applicable)
|
|
204
|
+
- [ ] Versioning strategy (semantic versioning)
|
|
205
|
+
- [ ] Deprecation policy
|
|
206
|
+
- [ ] Migration guides
|
|
207
|
+
|
|
208
|
+
## Implementation Plan
|
|
209
|
+
|
|
210
|
+
### Phase 1: Design & Setup (Week 1)
|
|
211
|
+
- [ ] OpenAPI specification finalized
|
|
212
|
+
- [ ] Database schema design
|
|
213
|
+
- [ ] Security review and approval
|
|
214
|
+
- [ ] Development environment setup
|
|
215
|
+
|
|
216
|
+
### Phase 2: Core Development (Week 2-3)
|
|
217
|
+
- [ ] Write failing tests (TDD Red phase)
|
|
218
|
+
- [ ] Implement endpoint logic (Green phase)
|
|
219
|
+
- [ ] Refactor and optimize (Refactor phase)
|
|
220
|
+
- [ ] Code review and approval
|
|
221
|
+
- [ ] Security scanning
|
|
222
|
+
|
|
223
|
+
### Phase 3: Testing (Week 4)
|
|
224
|
+
- [ ] Integration testing
|
|
225
|
+
- [ ] Load testing ({{load_test_target}} req/s)
|
|
226
|
+
- [ ] Security testing (OWASP)
|
|
227
|
+
- [ ] Performance optimization
|
|
228
|
+
- [ ] Documentation review
|
|
229
|
+
|
|
230
|
+
### Phase 4: Release (Week 5)
|
|
231
|
+
- [ ] Staging deployment
|
|
232
|
+
- [ ] Final QA validation
|
|
233
|
+
- [ ] Production deployment
|
|
234
|
+
- [ ] Monitoring setup (metrics, alerts)
|
|
235
|
+
- [ ] Post-release verification
|
|
236
|
+
|
|
237
|
+
## Monitoring & Observability
|
|
238
|
+
|
|
239
|
+
### Metrics to Track
|
|
240
|
+
- Request rate (req/s)
|
|
241
|
+
- Response time (p50, p95, p99)
|
|
242
|
+
- Error rate (%)
|
|
243
|
+
- Active users
|
|
244
|
+
- Cache hit rate
|
|
245
|
+
|
|
246
|
+
### Logging
|
|
247
|
+
- Request/response logging
|
|
248
|
+
- Error tracking (stack traces)
|
|
249
|
+
- Audit logs (authentication/authorization)
|
|
250
|
+
- Performance profiling
|
|
251
|
+
|
|
252
|
+
### Alerts
|
|
253
|
+
- Error rate > {{error_threshold}}%
|
|
254
|
+
- Response time > {{latency_threshold}}ms
|
|
255
|
+
- Availability < {{availability_threshold}}%
|
|
256
|
+
- Rate limit violations
|
|
257
|
+
|
|
258
|
+
## Rollback Plan
|
|
259
|
+
|
|
260
|
+
### Rollback Triggers
|
|
261
|
+
- Error rate > {{rollback_error_threshold}}%
|
|
262
|
+
- Critical security vulnerability discovered
|
|
263
|
+
- Data corruption detected
|
|
264
|
+
- Performance degradation > {{rollback_perf_threshold}}%
|
|
265
|
+
|
|
266
|
+
### Rollback Procedure
|
|
267
|
+
1. {{rollback_step_1}}
|
|
268
|
+
2. {{rollback_step_2}}
|
|
269
|
+
3. {{rollback_step_3}}
|
|
270
|
+
4. Notify stakeholders
|
|
271
|
+
5. Post-mortem analysis
|
|
272
|
+
|
|
273
|
+
## Risks and Mitigation
|
|
274
|
+
|
|
275
|
+
### Technical Risks
|
|
276
|
+
| Risk | Impact | Probability | Mitigation |
|
|
277
|
+
|------|--------|-------------|------------|
|
|
278
|
+
| {{risk_1}} | {{impact_1}} | {{prob_1}} | {{mitigation_1}} |
|
|
279
|
+
| {{risk_2}} | {{impact_2}} | {{prob_2}} | {{mitigation_2}} |
|
|
280
|
+
|
|
281
|
+
### Business Risks
|
|
282
|
+
| Risk | Impact | Probability | Mitigation |
|
|
283
|
+
|------|--------|-------------|------------|
|
|
284
|
+
| {{business_risk_1}} | {{b_impact_1}} | {{b_prob_1}} | {{b_mitigation_1}} |
|
|
285
|
+
|
|
286
|
+
## Open Questions
|
|
287
|
+
|
|
288
|
+
- [ ] {{question_1}}
|
|
289
|
+
- [ ] {{question_2}}
|
|
290
|
+
- [ ] {{question_3}}
|
|
291
|
+
|
|
292
|
+
## Appendix
|
|
293
|
+
|
|
294
|
+
### References
|
|
295
|
+
- [OpenAPI Specification](https://swagger.io/specification/)
|
|
296
|
+
- [REST API Best Practices 2025](https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/)
|
|
297
|
+
- [JWT Authentication](https://jwt.io/introduction)
|
|
298
|
+
- [OWASP API Security Top 10](https://owasp.org/www-project-api-security/)
|
|
299
|
+
|
|
300
|
+
### Changelog
|
|
301
|
+
- {{timestamp}}: Initial PRD created by {{author}}
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
*API Feature PRD - Generated from template: api-feature*
|
|
306
|
+
*Template follows 2025 best practices: OpenAPI contract-first, JWT auth, WCAG compliance, TDD methodology*
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: {{id}}
|
|
3
|
+
title: {{title}}
|
|
4
|
+
type: prd
|
|
5
|
+
status: draft
|
|
6
|
+
priority: {{priority}}
|
|
7
|
+
created: {{timestamp}}
|
|
8
|
+
author: {{author}}
|
|
9
|
+
timeline: {{timeline}}
|
|
10
|
+
severity: {{severity}}
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PRD: Bug Fix - {{title}}
|
|
14
|
+
|
|
15
|
+
## Bug Summary
|
|
16
|
+
|
|
17
|
+
**Issue ID**: {{bug_id}}
|
|
18
|
+
**Severity**: {{severity}} (Critical/High/Medium/Low)
|
|
19
|
+
**Impact**: {{user_impact}}
|
|
20
|
+
**Affected Users**: {{affected_users}}
|
|
21
|
+
**Environment**: {{environment}}
|
|
22
|
+
|
|
23
|
+
## Problem Description
|
|
24
|
+
|
|
25
|
+
### Observed Behavior
|
|
26
|
+
{{observed_behavior}}
|
|
27
|
+
|
|
28
|
+
### Expected Behavior
|
|
29
|
+
{{expected_behavior}}
|
|
30
|
+
|
|
31
|
+
### Reproduction Steps
|
|
32
|
+
|
|
33
|
+
1. {{step_1}}
|
|
34
|
+
2. {{step_2}}
|
|
35
|
+
3. {{step_3}}
|
|
36
|
+
{{#if additional_steps}}
|
|
37
|
+
{{#each additional_steps}}
|
|
38
|
+
{{this}}
|
|
39
|
+
{{/each}}
|
|
40
|
+
{{/if}}
|
|
41
|
+
|
|
42
|
+
### Environment Details
|
|
43
|
+
- **Browser/OS**: {{browser_os}}
|
|
44
|
+
- **Version**: {{app_version}}
|
|
45
|
+
- **User Role**: {{user_role}}
|
|
46
|
+
- **Data State**: {{data_state}}
|
|
47
|
+
|
|
48
|
+
### Error Messages/Logs
|
|
49
|
+
```
|
|
50
|
+
{{error_logs}}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Screenshots/Videos
|
|
54
|
+
{{#if media_links}}
|
|
55
|
+
{{#each media_links}}
|
|
56
|
+
- {{this}}
|
|
57
|
+
{{/each}}
|
|
58
|
+
{{/if}}
|
|
59
|
+
|
|
60
|
+
## Impact Analysis
|
|
61
|
+
|
|
62
|
+
### User Impact
|
|
63
|
+
- **Affected Users**: {{affected_user_count}} ({{affected_percentage}}%)
|
|
64
|
+
- **User Segments**: {{user_segments}}
|
|
65
|
+
- **Business Impact**: {{business_impact}}
|
|
66
|
+
- **Revenue Impact**: {{revenue_impact}}
|
|
67
|
+
|
|
68
|
+
### System Impact
|
|
69
|
+
- **Components Affected**: {{affected_components}}
|
|
70
|
+
- **Services Down**: {{services_down}}
|
|
71
|
+
- **Data Integrity**: {{data_integrity_status}}
|
|
72
|
+
- **Performance Impact**: {{performance_impact}}
|
|
73
|
+
|
|
74
|
+
### Severity Classification
|
|
75
|
+
|
|
76
|
+
**Critical** (P0):
|
|
77
|
+
- System completely unusable
|
|
78
|
+
- Data loss or corruption
|
|
79
|
+
- Security breach
|
|
80
|
+
- Revenue impact > $10k/hour
|
|
81
|
+
|
|
82
|
+
**High** (P1):
|
|
83
|
+
- Major feature broken
|
|
84
|
+
- Significant user impact (>20%)
|
|
85
|
+
- Workaround exists but difficult
|
|
86
|
+
- Revenue impact $1k-10k/hour
|
|
87
|
+
|
|
88
|
+
**Medium** (P2):
|
|
89
|
+
- Feature degradation
|
|
90
|
+
- Moderate user impact (<20%)
|
|
91
|
+
- Easy workaround available
|
|
92
|
+
- Minimal revenue impact
|
|
93
|
+
|
|
94
|
+
**Low** (P3):
|
|
95
|
+
- Minor issue
|
|
96
|
+
- Cosmetic or edge case
|
|
97
|
+
- No workaround needed
|
|
98
|
+
- No revenue impact
|
|
99
|
+
|
|
100
|
+
## Root Cause Analysis (RCA)
|
|
101
|
+
|
|
102
|
+
### Investigation Timeline
|
|
103
|
+
| Time | Action | Finding |
|
|
104
|
+
|------|--------|---------|
|
|
105
|
+
| {{time_1}} | {{action_1}} | {{finding_1}} |
|
|
106
|
+
| {{time_2}} | {{action_2}} | {{finding_2}} |
|
|
107
|
+
|
|
108
|
+
### 5 Whys Analysis
|
|
109
|
+
|
|
110
|
+
**Problem**: {{problem_statement}}
|
|
111
|
+
|
|
112
|
+
1. **Why?** {{why_1}}
|
|
113
|
+
2. **Why?** {{why_2}}
|
|
114
|
+
3. **Why?** {{why_3}}
|
|
115
|
+
4. **Why?** {{why_4}}
|
|
116
|
+
5. **Why?** {{why_5}}
|
|
117
|
+
|
|
118
|
+
**Root Cause**: {{root_cause}}
|
|
119
|
+
|
|
120
|
+
### Affected Components
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
System Map:
|
|
124
|
+
{{system_map}}
|
|
125
|
+
|
|
126
|
+
Affected Areas:
|
|
127
|
+
{{#if affected_areas}}
|
|
128
|
+
{{#each affected_areas}}
|
|
129
|
+
- {{component}}: {{impact}}
|
|
130
|
+
{{/each}}
|
|
131
|
+
{{/if}}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Root Cause Category
|
|
135
|
+
- [ ] Code defect (logic error, typo, missing validation)
|
|
136
|
+
- [ ] Configuration issue (environment, settings)
|
|
137
|
+
- [ ] Infrastructure problem (server, network, database)
|
|
138
|
+
- [ ] Third-party service failure (API, library)
|
|
139
|
+
- [ ] Data quality issue (corrupt data, missing data)
|
|
140
|
+
- [ ] Deployment error (rollout, migration)
|
|
141
|
+
- [ ] Security vulnerability
|
|
142
|
+
- [ ] Performance bottleneck
|
|
143
|
+
- [ ] Race condition / timing issue
|
|
144
|
+
- [ ] Integration failure
|
|
145
|
+
|
|
146
|
+
### Contributing Factors
|
|
147
|
+
{{#if contributing_factors}}
|
|
148
|
+
{{#each contributing_factors}}
|
|
149
|
+
- {{this}}
|
|
150
|
+
{{/each}}
|
|
151
|
+
{{/if}}
|
|
152
|
+
|
|
153
|
+
## Proposed Solution
|
|
154
|
+
|
|
155
|
+
### Fix Approach
|
|
156
|
+
{{solution_approach}}
|
|
157
|
+
|
|
158
|
+
### Technical Implementation
|
|
159
|
+
|
|
160
|
+
**Files to Modify**:
|
|
161
|
+
{{#if files_to_modify}}
|
|
162
|
+
{{#each files_to_modify}}
|
|
163
|
+
- `{{file}}`: {{change}}
|
|
164
|
+
{{/each}}
|
|
165
|
+
{{/if}}
|
|
166
|
+
|
|
167
|
+
**Code Changes Summary**:
|
|
168
|
+
```{{language}}
|
|
169
|
+
{{code_changes_summary}}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Alternative Solutions Considered
|
|
173
|
+
|
|
174
|
+
| Solution | Pros | Cons | Selected |
|
|
175
|
+
|----------|------|------|----------|
|
|
176
|
+
| {{alt_solution_1}} | {{pros_1}} | {{cons_1}} | {{selected_1}} |
|
|
177
|
+
| {{alt_solution_2}} | {{pros_2}} | {{cons_2}} | {{selected_2}} |
|
|
178
|
+
|
|
179
|
+
## Testing Strategy (TDD)
|
|
180
|
+
|
|
181
|
+
### Reproduction Test (Red Phase)
|
|
182
|
+
- [ ] Write test that reproduces the bug
|
|
183
|
+
- [ ] Verify test fails with current code
|
|
184
|
+
- [ ] Document failing test case
|
|
185
|
+
|
|
186
|
+
### Fix Implementation (Green Phase)
|
|
187
|
+
- [ ] Implement minimal fix
|
|
188
|
+
- [ ] Verify reproduction test passes
|
|
189
|
+
- [ ] Ensure no new failures
|
|
190
|
+
|
|
191
|
+
### Regression Prevention (Refactor Phase)
|
|
192
|
+
- [ ] Add edge case tests
|
|
193
|
+
- [ ] Refactor code for clarity
|
|
194
|
+
- [ ] Update documentation
|
|
195
|
+
|
|
196
|
+
### Test Coverage
|
|
197
|
+
|
|
198
|
+
**Unit Tests**:
|
|
199
|
+
- [ ] Fix validation test
|
|
200
|
+
- [ ] Edge case coverage
|
|
201
|
+
- [ ] Error handling paths
|
|
202
|
+
- [ ] Mock external dependencies
|
|
203
|
+
|
|
204
|
+
**Integration Tests**:
|
|
205
|
+
- [ ] Component integration
|
|
206
|
+
- [ ] Database operations
|
|
207
|
+
- [ ] API contract verification
|
|
208
|
+
- [ ] State management
|
|
209
|
+
|
|
210
|
+
**E2E Tests**:
|
|
211
|
+
- [ ] User flow regression
|
|
212
|
+
- [ ] Cross-browser validation
|
|
213
|
+
- [ ] Performance verification
|
|
214
|
+
- [ ] Data integrity check
|
|
215
|
+
|
|
216
|
+
**Automated Regression Suite**:
|
|
217
|
+
- [ ] Add bug reproduction to CI/CD
|
|
218
|
+
- [ ] Update smoke tests
|
|
219
|
+
- [ ] Performance benchmarks
|
|
220
|
+
- [ ] Security scanning
|
|
221
|
+
|
|
222
|
+
## Risk Assessment
|
|
223
|
+
|
|
224
|
+
### Risks of Fix Implementation
|
|
225
|
+
|
|
226
|
+
| Risk | Impact | Probability | Mitigation |
|
|
227
|
+
|------|--------|-------------|------------|
|
|
228
|
+
| Breaking changes | {{break_impact}} | {{break_prob}} | {{break_mitigation}} |
|
|
229
|
+
| Performance degradation | {{perf_impact}} | {{perf_prob}} | {{perf_mitigation}} |
|
|
230
|
+
| New bugs introduced | {{bug_impact}} | {{bug_prob}} | {{bug_mitigation}} |
|
|
231
|
+
| Data migration needed | {{data_impact}} | {{data_prob}} | {{data_mitigation}} |
|
|
232
|
+
|
|
233
|
+
### Risk Mitigation Strategies
|
|
234
|
+
{{#if risk_strategies}}
|
|
235
|
+
{{#each risk_strategies}}
|
|
236
|
+
- {{this}}
|
|
237
|
+
{{/each}}
|
|
238
|
+
{{/if}}
|
|
239
|
+
|
|
240
|
+
## Rollback Plan
|
|
241
|
+
|
|
242
|
+
### Rollback Triggers
|
|
243
|
+
- New error rate > {{rollback_error_threshold}}%
|
|
244
|
+
- Performance degradation > {{rollback_perf_threshold}}%
|
|
245
|
+
- User reports > {{rollback_user_threshold}}
|
|
246
|
+
- Data integrity issues detected
|
|
247
|
+
- Security vulnerability introduced
|
|
248
|
+
|
|
249
|
+
### Rollback Procedure
|
|
250
|
+
|
|
251
|
+
**Immediate Rollback** (< 5 minutes):
|
|
252
|
+
1. {{rollback_step_1}}
|
|
253
|
+
2. {{rollback_step_2}}
|
|
254
|
+
3. {{rollback_step_3}}
|
|
255
|
+
|
|
256
|
+
**Full Rollback** (< 30 minutes):
|
|
257
|
+
1. Revert deployment to previous version
|
|
258
|
+
2. Restore database from backup (if needed)
|
|
259
|
+
3. Clear caches and restart services
|
|
260
|
+
4. Notify stakeholders
|
|
261
|
+
5. Update status page
|
|
262
|
+
|
|
263
|
+
**Rollback Validation**:
|
|
264
|
+
- [ ] System functionality verified
|
|
265
|
+
- [ ] Error rates normalized
|
|
266
|
+
- [ ] User impact resolved
|
|
267
|
+
- [ ] Monitoring confirms stability
|
|
268
|
+
|
|
269
|
+
## Implementation Plan
|
|
270
|
+
|
|
271
|
+
### Immediate Actions (Hour 0-1)
|
|
272
|
+
- [ ] Implement hotfix
|
|
273
|
+
- [ ] Write reproduction test
|
|
274
|
+
- [ ] Local testing and validation
|
|
275
|
+
- [ ] Code review (expedited)
|
|
276
|
+
- [ ] Security scan
|
|
277
|
+
|
|
278
|
+
### Short-term (Hour 1-4)
|
|
279
|
+
- [ ] Deploy to staging
|
|
280
|
+
- [ ] QA validation
|
|
281
|
+
- [ ] Regression testing
|
|
282
|
+
- [ ] Performance testing
|
|
283
|
+
- [ ] Stakeholder approval
|
|
284
|
+
|
|
285
|
+
### Deployment (Hour 4-6)
|
|
286
|
+
- [ ] Production deployment (canary/blue-green)
|
|
287
|
+
- [ ] Monitor error rates
|
|
288
|
+
- [ ] Verify user reports
|
|
289
|
+
- [ ] Update status page
|
|
290
|
+
- [ ] Communication to users
|
|
291
|
+
|
|
292
|
+
### Follow-up (Day 1-7)
|
|
293
|
+
- [ ] Monitor metrics (24h)
|
|
294
|
+
- [ ] Complete RCA documentation
|
|
295
|
+
- [ ] Update runbooks
|
|
296
|
+
- [ ] Team retrospective
|
|
297
|
+
- [ ] Process improvements
|
|
298
|
+
|
|
299
|
+
## Monitoring & Verification
|
|
300
|
+
|
|
301
|
+
### Success Metrics
|
|
302
|
+
- **Error Rate**: Reduced from {{current_error_rate}}% to < {{target_error_rate}}%
|
|
303
|
+
- **User Reports**: Zero new reports within 24h
|
|
304
|
+
- **Performance**: No regression (< {{perf_threshold}}ms)
|
|
305
|
+
- **Availability**: {{uptime_target}}% uptime maintained
|
|
306
|
+
|
|
307
|
+
### Monitoring Dashboards
|
|
308
|
+
- [ ] Error tracking (Sentry/Rollbar)
|
|
309
|
+
- [ ] Application metrics (Datadog/New Relic)
|
|
310
|
+
- [ ] User analytics (GA4/Mixpanel)
|
|
311
|
+
- [ ] Server metrics (CPU, memory, disk)
|
|
312
|
+
|
|
313
|
+
### Alerts Configuration
|
|
314
|
+
- Error rate > {{alert_error_threshold}}%
|
|
315
|
+
- Response time > {{alert_latency_threshold}}ms
|
|
316
|
+
- Failed requests > {{alert_failure_threshold}}
|
|
317
|
+
- Anomaly detection triggers
|
|
318
|
+
|
|
319
|
+
## Prevention Strategies
|
|
320
|
+
|
|
321
|
+
### Immediate Prevention
|
|
322
|
+
- [ ] Add monitoring/alerting for this scenario
|
|
323
|
+
- [ ] Update validation rules
|
|
324
|
+
- [ ] Improve error handling
|
|
325
|
+
- [ ] Add circuit breakers
|
|
326
|
+
|
|
327
|
+
### Long-term Prevention
|
|
328
|
+
- [ ] Code review checklist update
|
|
329
|
+
- [ ] Add pre-deployment validation
|
|
330
|
+
- [ ] Improve testing coverage
|
|
331
|
+
- [ ] Update coding standards
|
|
332
|
+
- [ ] Team training session
|
|
333
|
+
|
|
334
|
+
### Process Improvements
|
|
335
|
+
{{#if process_improvements}}
|
|
336
|
+
{{#each process_improvements}}
|
|
337
|
+
- {{this}}
|
|
338
|
+
{{/each}}
|
|
339
|
+
{{/if}}
|
|
340
|
+
|
|
341
|
+
## Communication Plan
|
|
342
|
+
|
|
343
|
+
### Internal Communication
|
|
344
|
+
- **Engineering Team**: {{eng_communication}}
|
|
345
|
+
- **Product Team**: {{product_communication}}
|
|
346
|
+
- **Leadership**: {{leadership_communication}}
|
|
347
|
+
- **Support Team**: {{support_communication}}
|
|
348
|
+
|
|
349
|
+
### External Communication
|
|
350
|
+
{{#if external_communication_needed}}
|
|
351
|
+
- **Users Affected**: {{user_message}}
|
|
352
|
+
- **Status Page Update**: {{status_page_message}}
|
|
353
|
+
- **Social Media**: {{social_media_message}}
|
|
354
|
+
- **Support Channels**: {{support_message}}
|
|
355
|
+
{{/if}}
|
|
356
|
+
|
|
357
|
+
## Post-Mortem
|
|
358
|
+
|
|
359
|
+
### Timeline of Events
|
|
360
|
+
| Time | Event | Action Taken |
|
|
361
|
+
|------|-------|--------------|
|
|
362
|
+
| {{event_time_1}} | {{event_1}} | {{event_action_1}} |
|
|
363
|
+
| {{event_time_2}} | {{event_2}} | {{event_action_2}} |
|
|
364
|
+
|
|
365
|
+
### What Went Well
|
|
366
|
+
{{#if went_well}}
|
|
367
|
+
{{#each went_well}}
|
|
368
|
+
- {{this}}
|
|
369
|
+
{{/each}}
|
|
370
|
+
{{/if}}
|
|
371
|
+
|
|
372
|
+
### What Went Wrong
|
|
373
|
+
{{#if went_wrong}}
|
|
374
|
+
{{#each went_wrong}}
|
|
375
|
+
- {{this}}
|
|
376
|
+
{{/each}}
|
|
377
|
+
{{/if}}
|
|
378
|
+
|
|
379
|
+
### Lessons Learned
|
|
380
|
+
{{#if lessons_learned}}
|
|
381
|
+
{{#each lessons_learned}}
|
|
382
|
+
- {{this}}
|
|
383
|
+
{{/each}}
|
|
384
|
+
{{/if}}
|
|
385
|
+
|
|
386
|
+
### Action Items
|
|
387
|
+
| Action | Owner | Due Date | Status |
|
|
388
|
+
|--------|-------|----------|--------|
|
|
389
|
+
| {{action_1}} | {{owner_1}} | {{due_1}} | {{status_1}} |
|
|
390
|
+
| {{action_2}} | {{owner_2}} | {{due_2}} | {{status_2}} |
|
|
391
|
+
|
|
392
|
+
## Appendix
|
|
393
|
+
|
|
394
|
+
### Related Issues
|
|
395
|
+
{{#if related_issues}}
|
|
396
|
+
{{#each related_issues}}
|
|
397
|
+
- {{issue_id}}: {{issue_title}}
|
|
398
|
+
{{/each}}
|
|
399
|
+
{{/if}}
|
|
400
|
+
|
|
401
|
+
### References
|
|
402
|
+
- [Root Cause Analysis Guide](https://asana.com/resources/root-cause-analysis)
|
|
403
|
+
- [5 Whys Technique](https://www.mindtools.com/pages/article/newTMC_5W.htm)
|
|
404
|
+
- [Incident Response Best Practices](https://www.atlassian.com/incident-management/postmortem)
|
|
405
|
+
- [Bug Fix Best Practices 2025](https://stackoverflow.blog/2023/12/28/best-practices-for-writing-code-comments/)
|
|
406
|
+
|
|
407
|
+
### Changelog
|
|
408
|
+
- {{timestamp}}: Initial bug fix PRD created by {{author}}
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
*Bug Fix PRD - Generated from template: bug-fix*
|
|
413
|
+
*Template follows 2025 best practices: 5 Whys RCA, TDD testing, comprehensive monitoring, prevention-focused*
|