Debugging
Task
Systematically debug issues using structured diagnostic paths before proposing fixes.
Instructions
- Identify the symptom category below
- Follow the diagnostic path for that category
- Isolate the root cause with evidence
- Propose a minimal fix
Diagnostic Paths
Data Processing Bugs
Symptoms: wrong output, missing items, incorrect computed state, unexpected values
- Check that all operations are producing the expected output at each step
- Verify the sequence of transformations matches the expected order
- Compare output against known-good inputs (use unit tests)
- Check that the final state matches the expected result type
- Verify any mappings or lookups reference accurate source data
- Test edge cases: empty input, single element, boundary conditions, worst case
Rendering Bugs
Symptoms: wrong styles, missing elements, animation glitches, layout issues
- Check the data driving the render — is the correct variant/type being passed?
- Verify the right component is selected for the given data shape
- Check animation configuration — timing, exit transitions, spring parameters
- Verify reduced-motion fallback works for users with motion preferences
- Check that design tokens are used consistently, not raw hardcoded values
- Test across relevant breakpoints (desktop, tablet, mobile)
State Machine Bugs
Symptoms: stuck state, wrong transitions, speed/timing not changing, reset not working
- Check state slice transitions — are all actions producing the correct next state?
- Verify the current index or cursor is within valid bounds
- Check timing logic (intervals, debounce, throttle) for correctness
- Look for stale selectors — are derived values memoized or recomputed correctly?
- Verify reset action fully clears all related state and side effects
Asset Loading Bugs
Symptoms: missing content, empty panels, wrong format displayed, misaligned content
- Verify the asset import or fetch returns content (not an empty object or undefined)
- Check file paths in glob patterns or import statements for correctness
- Verify content mappings reference accurate line numbers or offsets in the source
- Check that all required asset variants exist and are registered
- Test dynamic switching — does the UI update correctly when the active asset changes?
Form/Input Bugs
Symptoms: state not updating, validation gaps, values persisting across sessions or views
- Check that input state is stored in the expected location (component state vs. store)
- Verify no unintended persistence (localStorage, URL params, global variables)
- Check validation rules — are all invalid states correctly rejected?
- Check that mutually exclusive constraints are enforced (e.g., conflicting selections)
- Verify state resets correctly on view/context switch
Build / Import Bugs
Symptoms: module not found, circular dependencies, tree-shaking issues
- Check path alias resolution in the project's compiler/bundler config (e.g.,
tsconfig.json, pyproject.toml, go.mod, Cargo.toml)
- Verify no circular dependencies between modules
- Check glob patterns or dynamic imports — are paths statically analyzable? (no string interpolation)
- Run the project's type checker or compiler to surface type errors
- Check barrel exports or package entry points for missing or incorrect re-exports
Rules
- Diagnose before fixing — understand the root cause first
- One fix at a time — don't combine multiple changes
- Write a failing test that reproduces the bug before fixing
- Verify the fix doesn't break other tests