| name | bug-fix |
| description | Systematic workflow for verifying bug fixes to ensure quality and prevent regres... |
| version | 1.0.0 |
| tags | [] |
| progressive_disclosure | {"entry_point":{"summary":"Systematic workflow for verifying bug fixes to ensure quality and prevent regres...","when_to_use":"When working with bug-fix or related functionality.","quick_start":"1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."}} |
Bug Fix Verification
Systematic workflow for verifying bug fixes to ensure quality and prevent regressions.
When to Use This Skill
Use this skill when:
- Fixing a reported bug
- Creating PR for bug fix
- Need to document bug fix verification
- Want to ensure fix doesn't introduce regressions
- Need structured approach to bug resolution
Why Bug Fix Verification Matters
Problems It Solves
- โ Fixing symptoms instead of root cause
- โ Introducing new bugs while fixing old ones
- โ Incomplete testing of edge cases
- โ No proof that bug is actually fixed
- โ Poor documentation of fix reasoning
Benefits
- โ
Confirms bug is truly fixed (not masked)
- โ
Documents root cause analysis
- โ
Prevents regression with tests
- โ
Provides clear evidence for stakeholders
- โ
Improves team knowledge of codebase
Bug Fix Workflow
Step 1: Reproduce Before Fix
Critical: Never fix a bug without first reproducing it.
Reproduction Checklist
Reproduction Documentation Template
## Bug Reproduction
### Steps to Reproduce
1. Navigate to `/dashboard`
2. Click "Export Data" button
3. Select date range: Jan 1 - Dec 31
4. Click "Generate Report"
### Expected Behavior
- Report downloads as CSV file
- File contains all transactions for date range
- Download completes in < 5 seconds
### Actual Behavior
- Error appears: "Failed to generate report"
- Console error: `TypeError: Cannot read property 'map' of undefined`
- No file downloads
- Issue occurs 100% of the time
### Environment
- Browser: Chrome 120.0.6099.109
- OS: macOS 14.2
- User Role: Admin
- Data Size: ~10,000 transactions
### Screenshots


Step 2: Root Cause Analysis
Investigate WHY the bug occurs, not just WHAT happens.
Investigation Steps
- Review Error Logs: Check server logs, browser console, error tracking
- Trace Code Path: Follow execution from trigger point to error
- Identify Breaking Point: Find exact line/function where bug occurs
- Understand Context: Why does code behave this way?
- Check Recent Changes: Did recent commit introduce this?
- Review Related Code: Are there similar patterns elsewhere?
Root Cause Documentation
## Root Cause Analysis
### Investigation
- Error occurs in `generateReport()` function at line 45
- Function assumes `transactions` array always exists
- When date range returns no results, backend returns `null`
- Frontend doesn't handle `null` case, tries to call `.map()` on `null`
### Root Cause
- Missing null check before array operations
- Backend API doesn't return consistent data structure (sometimes `[]`, sometimes `null`)
- No validation of API response shape
### Why This Wasn't Caught
- Unit tests only covered happy path (data exists)
- Integration tests didn't test empty result scenario
- Backend inconsistency not documented in API contract
Step 3: Implement Fix
Fix the root cause, not the symptom.
Fix Guidelines
- Minimal Change: Fix only what's necessary
- Defensive Coding: Add validation/guards
- Consistent Patterns: Follow existing error handling patterns
- Type Safety: Use types to prevent similar bugs
- Documentation: Comment non-obvious fixes
Example Fix
function generateReport(transactions) {
return transactions.map(t => ({
date: t.date,
amount: t.amount,
}));
}
function generateReport(transactions) {
if (!transactions || !Array.isArray(transactions)) {
console.warn('No transactions to export');
return [];
}
return transactions.map(t => ({
date: t.date,
amount: t.amount,
}));
}
Step 4: Verify Fix
Prove the bug is fixed through systematic testing.
Verification Checklist
Verification Documentation
## Fix Verification
### Testing Performed
1. โ
Followed original reproduction steps - bug no longer occurs
2. โ
Tested with empty date range - shows "No data to export" message
3. โ
Tested with valid date range - exports successfully
4. โ
Tested with large dataset (50k+ transactions) - works correctly
5. โ
Tested in Chrome, Firefox, Safari - all working
6. โ
Tested on staging environment - fix confirmed
### Edge Cases Tested
- Empty result set โ Shows appropriate message
- Null response from API โ Handled gracefully
- Single transaction โ Exports correctly
- Malformed transaction data โ Logs error, doesn't crash
### No New Issues
- โ
No console errors
- โ
No memory leaks
- โ
No performance degradation
- โ
Other export features still work
Step 5: Add Tests to Prevent Regression
Critical: Every bug fix must include tests.
Test Requirements
Common Pitfalls to Avoid
During Investigation
- โ Assuming you know the cause without verifying
- โ Fixing symptoms instead of root cause
- โ Not checking if similar bugs exist elsewhere
- โ Skipping reproduction in clean environment
During Implementation
- โ Making changes beyond fixing the bug
- โ Refactoring unrelated code in bug fix PR
- โ Adding features while fixing bugs
- โ Not handling all edge cases discovered
During Verification
- โ Only testing happy path after fix
- โ Not testing in multiple environments
- โ Skipping regression testing
- โ Not documenting what was tested
During Documentation
- โ Vague PR descriptions ("Fixed bug")
- โ Not explaining root cause
- โ Missing before/after evidence
- โ Not linking to original bug report
Bug Fix Quality Standards
Minimum Requirements
- โ
Root cause identified and documented
- โ
Fix is minimal and targeted
- โ
Tests added to prevent regression
- โ
Verification documented with evidence
- โ
No new bugs introduced
- โ
Works across all supported environments
Excellence Indicators
- โ
Similar patterns checked and fixed
- โ
Multiple edge cases tested
- โ
Performance impact measured
- โ
Team knowledge shared (wiki/docs updated)
- โ
Preventive measures suggested
Success Criteria
Bug Fix is Complete When
- โ
Bug can no longer be reproduced
- โ
Root cause is understood and documented
- โ
Fix is minimal and targeted
- โ
Tests prevent regression
- โ
Edge cases are handled
- โ
Works in all environments
- โ
PR documentation is comprehensive
- โ
No new issues introduced
Related Skills
universal-verification-pre-merge - Pre-merge verification checklist
universal-verification-screenshot - Visual verification for UI bugs
universal-debugging-systematic-debugging - Systematic debugging methodology
universal-debugging-root-cause-tracing - Root cause analysis techniques
universal-testing-testing-anti-patterns - Testing patterns to avoid