Systematic debugging framework for any bug, test failure, or unexpected behavior. Use BEFORE proposing fixes...
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
Core principle: ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
Use for ANY technical issue:
Use ESPECIALLY when:
BEFORE attempting ANY fix:
Read Error Messages Carefully
Reproduce Consistently
# Run specific test
pnpm test src/features/workout/__tests__/specific.test.ts
# Run with verbose output
pnpm test --reporter=verbose
Check Recent Changes
git diff HEAD~5 --stat
git log --oneline -10
Gather Evidence in Multi-Component Systems
For Vue/Dexie issues, trace through layers:
Component → Composable → Repository → Dexie → IndexedDB
Add console.error at each layer to find where it breaks.
Trace Data Flow
See references/root-cause-tracing.md for the complete technique.
Find Working Examples
Compare Against References
testing-conventions skill for test patternsvue-integration-testing for browser mode patternsrepository-pattern for Dexie patternsIdentify Differences
await? Missing resetDatabase()?Form Single Hypothesis
Test Minimally
Verify Before Continuing
Create Failing Test Case
vue-integration-testing skill patternsImplement Single Fix
Verify Fix
pnpm test # All tests pass
pnpm type-check # No type errors
pnpm lint # No lint errors
If Fix Doesn't Work
Symptom: Test passes sometimes, fails in CI or under load.
Common causes:
await on async operationsexpect.poll()resetDatabase())See: references/condition-based-waiting.md
Symptom: Test passes alone, fails when run with others.
Root cause: Data from other tests polluting state.
Fix pattern:
beforeEach(async () => {
await resetDatabase() // ALWAYS first
})
See: references/defense-in-depth.md
Symptom: State updates but UI doesn't reflect changes.
Debug pattern:
import { nextTick } from 'vue'
// After state change
await nextTick()
// Now check DOM
If you think:
STOP. Return to Phase 1.
testing-conventions - Query priority, expect.poll(), gotchasvue-integration-testing - Page objects, browser mode patternsvitest-mocking - Test doubles and mocking patternsrepository-pattern - Dexie/database patternsIn references/ directory:
root-cause-tracing.md - Trace bugs backward through call stackdefense-in-depth.md - Validate at multiple layerscondition-based-waiting.md - Replace timeouts with expect.poll()In scripts/ directory:
find-polluter.sh - Find which test creates pollution| Phase | Activities | Success Criteria |
|---|---|---|
| 1. Root Cause | Read errors, reproduce, check changes | Understand WHAT and WHY |
| 2. Pattern | Find working examples, compare | Identify differences |
| 3. Hypothesis | Form theory, test minimally | Confirmed or new hypothesis |
| 4. Implementation | Create test, fix, verify | Bug resolved, tests pass |