.claude/skills/systematic-debugging/SKILL.md
Systematically diagnose and fix bugs using evidence-driven root cause analysis
npx skillsauth add ChooJeongHo/MovieFinder systematic-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Debug $ARGUMENTS using evidence-driven root cause analysis. No guessing — follow the evidence.
git log --oneline -20 to find what changed last| Class | Symptoms | First place to look |
|-------|----------|---------------------|
| Crash | Stack trace, ANR | Exception type + top frame |
| Wrong state | UI shows stale/incorrect data | ViewModel StateFlow, UseCase output |
| Race condition | Intermittent, rotation-sensitive | Mutex, scope, shared mutable state |
| Compile error | Build fails | Error line, import, API mismatch |
| Test failure | Red CI | Test assertion vs actual value, mock setup |
| Performance | Jank, slow load | onDraw, database query on Main thread |
Form 2-3 competing hypotheses before reading code. Example:
Then eliminate each with evidence:
H1: Read DAO query → ORDER BY correct ✅ eliminated
H2: Read mapper → field mapping correct ✅ eliminated
H3: Read Fragment → collecting uiState2 instead of uiState ❌ BUG FOUND
Crash on rotation?
SavedStateHandle for ViewModel args_binding not null-checked in callbacks after onDestroyView()Stale UI / not updating?
StateFlow collected outside repeatOnLifecycle(STARTED) → stops on backgroundstateIn(Eagerly) instead of WhileSubscribed → replays old valueListAdapter.submitList() called with same list reference (use .toList() copy)Intermittent crash (coroutine)?
CancellationException swallowed in catch (e: Exception)GlobalScope or detached scope outliving Fragmentfinally { mutex.unlock() })Nothing happens on button click?
receiveAsFlow() vs consumeAsFlow())onCreateView but binding re-created in onViewCreatedTest failure: mock not called?
coEvery needed for suspend functions (not every)lateinit not set in @Before)any() to isolate)Build/compile error?
kotlin.time.Clock vs kotlinx.datetime.Clock (0.7.x migration)@file:OptIn(kotlin.time.ExperimentalTime::class) missing in call chainkotlinOptions block, use compileOptions onlyBefore marking fixed:
./gradlew testDebugUnitTest)# Quick verification
./gradlew testDebugUnitTest --tests "*.AffectedClassTest"
# Full check before push
./gradlew testDebugUnitTest
./gradlew :app:detekt
## Debug Report: [Bug Description]
### Evidence Collected
- Error: [exact message/stacktrace line]
- Reproduces: [always / intermittent / on rotation / etc.]
- Last relevant change: [git commit]
### Hypotheses
| # | Hypothesis | Evidence | Status |
|---|-----------|----------|--------|
| H1 | ... | checked file:line | ✅ Eliminated |
| H2 | ... | checked file:line | ❌ ROOT CAUSE |
### Root Cause
[One clear sentence: "X happens because Y at file:line"]
### Fix
[Minimal code change — file path, before/after]
### Verification
[How to confirm the fix works + which tests cover it]
testing
Write and fix Unit, Hilt integration, and Espresso tests following MovieFinder patterns
tools
Diagnose and fix Kotlin coroutine race conditions, Flow issues, and thread safety bugs
development
Optimize Gradle build speed with Configuration Cache, parallel execution, and AGP 9 tuning
development
Enforce Clean Architecture and Offline-first patterns in this MovieFinder codebase