Edge Case Analysis
Systematically analyze a PRD to identify edge cases, failure modes, race conditions, and scenarios that might be overlooked during implementation.
The Job
- Read the provided PRD thoroughly
- Analyze each user story and functional requirement
- Identify potential edge cases across multiple categories
- Propose updates to the PRD (new acceptance criteria, new stories, or updates to existing stories)
Output: A list of edge cases with recommended PRD updates.
Edge Case Categories
1. Input Edge Cases
- Empty/null values: What if required fields are empty?
- Boundary values: Max lengths, min/max numbers, date ranges
- Invalid formats: Wrong data types, malformed input
- Unicode/special characters: Emojis, RTL text, HTML injection attempts
- Large data: What if there are 10,000 items instead of 10?
2. State Edge Cases
- Race conditions: Two users editing the same thing simultaneously
- Stale data: Data changed by another process between read and write
- Partial completion: What if the operation fails halfway?
- Concurrent operations: Multiple tabs, multiple sessions
- Offline/reconnection: What happens when connection drops?
3. User Behavior Edge Cases
- Rapid clicks: User clicks submit multiple times quickly
- Back button: User navigates back during an operation
- Browser refresh: User refreshes during a multi-step flow
- Abandoned flows: User leaves in the middle of a process
- Unexpected navigation: User directly accesses URLs they shouldn't
4. Error Handling Edge Cases
- Network failures: API timeouts, server errors
- Validation errors: How are errors displayed and recovered from?
- Permission errors: User loses access mid-operation
- Resource exhaustion: Rate limits, storage limits
5. Data Edge Cases
- First-time use: No data exists yet (empty states)
- Legacy data: Old data that doesn't match new schema
- Data migration: What happens to existing data when schema changes?
- Cascade effects: Deleting something that other things depend on
6. Security Edge Cases
- Authentication expiry: Session times out during operation
- Authorization changes: Permissions change while user is active
- Input sanitization: XSS, SQL injection, command injection
- Data leakage: Error messages exposing sensitive info
7. Performance Edge Cases
- Cold start: First load performance
- Large payloads: Response times with lots of data
- Memory leaks: Long-running sessions
- N+1 queries: Database performance at scale
Analysis Process
For each user story in the PRD:
Step 1: Read the Story
Understand what the story is trying to accomplish.
Step 2: Apply Category Checklist
Go through each edge case category above and ask:
- Does this category apply to this story?
- What specific edge cases might occur?
Step 3: Rate Severity
For each identified edge case:
- Critical: Could cause data loss, security breach, or system crash
- High: User-facing error or broken functionality
- Medium: Poor UX or minor functionality issue
- Low: Minor annoyance or cosmetic issue
Step 4: Propose PRD Update
For each edge case, propose one of:
- New acceptance criteria for existing story
- New user story if scope is significant
- Update to functional requirements
- Note in Technical Considerations
Output Format
# Edge Case Analysis for [PRD Name]
## Summary
- Total edge cases identified: X
- Critical: X | High: X | Medium: X | Low: X
## Edge Cases by Story
### US-001: [Story Title]
| Edge Case | Category | Severity | Recommended Action |
|-----------|----------|----------|-------------------|
| User submits empty form | Input | High | Add acceptance criteria: "Empty form shows validation errors" |
| User double-clicks submit | User Behavior | Medium | Add acceptance criteria: "Submit button disabled after first click" |
### US-002: [Story Title]
...
## New Stories Recommended
### US-NEW-001: Handle concurrent edits
**Description:** As a user, I want to see a warning if someone else has edited the item since I started editing.
**Acceptance Criteria:**
- [ ] System checks for updates before saving
- [ ] Warning shown if data has changed
- [ ] User can choose to overwrite or refresh
**Rationale:** Addresses race condition edge case in US-003 and US-004.
## Updated Functional Requirements
- FR-NEW-1: The system must validate all user input on both client and server side
- FR-NEW-2: All destructive operations must be idempotent
## Technical Considerations to Add
- Implement optimistic locking for concurrent edit detection
- Add retry logic with exponential backoff for network failures
- Use database transactions for multi-step operations
Checklist Before Completing
Tips
- Don't go overboard: Focus on likely scenarios, not every theoretically possible edge case
- Be specific: "User enters > 255 characters in name field" is better than "Input validation"
- Consider the context: A personal project needs less edge case handling than a banking app
- Look for patterns: If you find one race condition, there are probably more
- Think like an attacker: What would someone try to break the system?
1---2name: edge-cases3description: Analyze a PRD for edge cases, failure modes, and scenarios that might be missed. Use after creating a PRD to strengthen it. Triggers on: analyze edge cases, find edge cases, what could go wrong, edge case analysis.4---5
6# Edge Case Analysis
7
8Systematically analyze a PRD to identify edge cases, failure modes, race conditions, and scenarios that might be overlooked during implementation.
9
10---
11
12## The Job
13
141. Read the provided PRD thoroughly
152. Analyze each user story and functional requirement
163. Identify potential edge cases across multiple categories
174. Propose updates to the PRD (new acceptance criteria, new stories, or updates to existing stories)
18
19**Output:** A list of edge cases with recommended PRD updates.
20
21---
22
23## Edge Case Categories
24
25### 1. Input Edge Cases
26- **Empty/null values:** What if required fields are empty?
27- **Boundary values:** Max lengths, min/max numbers, date ranges
28- **Invalid formats:** Wrong data types, malformed input
29- **Unicode/special characters:** Emojis, RTL text, HTML injection attempts
30- **Large data:** What if there are 10,000 items instead of 10?
31
32### 2. State Edge Cases
33- **Race conditions:** Two users editing the same thing simultaneously
34- **Stale data:** Data changed by another process between read and write
35- **Partial completion:** What if the operation fails halfway?
36- **Concurrent operations:** Multiple tabs, multiple sessions
37- **Offline/reconnection:** What happens when connection drops?
38
39### 3. User Behavior Edge Cases
40- **Rapid clicks:** User clicks submit multiple times quickly
41- **Back button:** User navigates back during an operation
42- **Browser refresh:** User refreshes during a multi-step flow
43- **Abandoned flows:** User leaves in the middle of a process
44- **Unexpected navigation:** User directly accesses URLs they shouldn't
45
46### 4. Error Handling Edge Cases
47- **Network failures:** API timeouts, server errors
48- **Validation errors:** How are errors displayed and recovered from?
49- **Permission errors:** User loses access mid-operation
50- **Resource exhaustion:** Rate limits, storage limits
51
52### 5. Data Edge Cases
53- **First-time use:** No data exists yet (empty states)
54- **Legacy data:** Old data that doesn't match new schema
55- **Data migration:** What happens to existing data when schema changes?
56- **Cascade effects:** Deleting something that other things depend on
57
58### 6. Security Edge Cases
59- **Authentication expiry:** Session times out during operation
60- **Authorization changes:** Permissions change while user is active
61- **Input sanitization:** XSS, SQL injection, command injection
62- **Data leakage:** Error messages exposing sensitive info
63
64### 7. Performance Edge Cases
65- **Cold start:** First load performance
66- **Large payloads:** Response times with lots of data
67- **Memory leaks:** Long-running sessions
68- **N+1 queries:** Database performance at scale
69
70---
71
72## Analysis Process
73
74For each user story in the PRD:
75
76### Step 1: Read the Story
77Understand what the story is trying to accomplish.
78
79### Step 2: Apply Category Checklist
80Go through each edge case category above and ask:
81- Does this category apply to this story?
82- What specific edge cases might occur?
83
84### Step 3: Rate Severity
85For each identified edge case:
86- **Critical:** Could cause data loss, security breach, or system crash
87- **High:** User-facing error or broken functionality
88- **Medium:** Poor UX or minor functionality issue
89- **Low:** Minor annoyance or cosmetic issue
90
91### Step 4: Propose PRD Update
92For each edge case, propose one of:
93- **New acceptance criteria** for existing story
94- **New user story** if scope is significant
95- **Update to functional requirements**
96- **Note in Technical Considerations**
97
98---
99
100## Output Format
101
102```markdown
103# Edge Case Analysis for [PRD Name]
104
105## Summary
106- Total edge cases identified: X
107- Critical: X | High: X | Medium: X | Low: X
108
109## Edge Cases by Story
110
111### US-001: [Story Title]
112
113| Edge Case | Category | Severity | Recommended Action |
114|-----------|----------|----------|-------------------|
115| User submits empty form | Input | High | Add acceptance criteria: "Empty form shows validation errors" |
116| User double-clicks submit | User Behavior | Medium | Add acceptance criteria: "Submit button disabled after first click" |
117
118### US-002: [Story Title]
119...
120
121## New Stories Recommended
122
123### US-NEW-001: Handle concurrent edits
124**Description:** As a user, I want to see a warning if someone else has edited the item since I started editing.
125
126**Acceptance Criteria:**
127- [ ] System checks for updates before saving
128- [ ] Warning shown if data has changed
129- [ ] User can choose to overwrite or refresh
130
131**Rationale:** Addresses race condition edge case in US-003 and US-004.
132
133## Updated Functional Requirements
134
135- FR-NEW-1: The system must validate all user input on both client and server side
136- FR-NEW-2: All destructive operations must be idempotent
137
138## Technical Considerations to Add
139
140- Implement optimistic locking for concurrent edit detection
141- Add retry logic with exponential backoff for network failures
142- Use database transactions for multi-step operations
143```
144
145---
146
147## Checklist Before Completing
148
149- [ ] Analyzed each user story against all edge case categories
150- [ ] Rated severity for each edge case
151- [ ] Provided concrete, actionable recommendations
152- [ ] Grouped related edge cases to avoid duplicate stories
153- [ ] Kept recommendations focused (don't over-engineer)
154- [ ] Prioritized critical and high severity items
155
156---
157
158## Tips
159
160- **Don't go overboard:** Focus on likely scenarios, not every theoretically possible edge case
161- **Be specific:** "User enters > 255 characters in name field" is better than "Input validation"
162- **Consider the context:** A personal project needs less edge case handling than a banking app
163- **Look for patterns:** If you find one race condition, there are probably more
164- **Think like an attacker:** What would someone try to break the system?