Debugging Assistant
When to activate
- Tests fail or produce unexpected behavior
- Application crashes or throws errors in production or development
- Feature works partially but not as expected
- Performance degradation or memory leaks detected
- Integration between components breaks after changes
- Need systematic root-cause analysis for flaky or intermittent bugs
When NOT to use
- Architecture or design questions (use design review skills instead)
- Feature requests or new functionality planning
- General refactoring or code cleanup (use simplify/code-review skills)
- Debugging external services or third-party APIs (delegate to those services' documentation/support)
- Static analysis or linting issues (use code-review skill)
Instructions
Step 1: Establish Reproducibility
- Ask for exact reproduction steps, error messages, and logs
- Create minimal reproducible example (MRE) if not provided
- Identify: does it always fail, intermittently, or only under specific conditions
- Check error logs, stack traces, and console output
- Verify: is this new (regression) or pre-existing behavior
Step 2: Narrow Scope
- Identify which subsystem is affected (frontend, backend, database, network, etc.)
- Use binary search: disable/enable features to isolate the problem
- Check recent changes: git diff, git log with
--since flags
- Verify environment: dependencies versions, configuration, OS differences
- Confirm: is this a code issue or environment/infrastructure issue
Step 3: Inspect Root Cause
- Read error messages carefully — stack traces point to the failure location
- Add debugging statements (console.log, print, debugger breakpoints) at suspected points
- Use IDE debugger to step through code execution
- Check variable states at breakpoints — are they what you expect
- Inspect network requests/responses using browser DevTools or tools like curl/Postman
- Review logs systematically — search for ERROR, WARN, and EXCEPTION patterns
Step 4: Form Hypothesis
- Based on evidence gathered, propose what's broken and why
- State what behavior is expected vs. actual
- Identify the exact line/function causing the issue
- Check: does this hypothesis explain all observed symptoms
Step 5: Test Hypothesis
- Apply minimal fix to test theory
- Run reproduction steps again
- Verify: does the fix resolve ALL symptoms, not just one
- Check for side effects — does the fix break other functionality
- Add regression test to prevent recurrence
Step 6: Implement & Verify
- Apply the permanent fix
- Run existing test suite
- Add new test case covering this bug
- Update documentation if behavior changed
- Verify in development, staging, and production-like environments
Debugging Toolkit
For Frontend (JavaScript/TypeScript):
- Browser DevTools console and debugger
- Network tab for API requests
- React/Vue DevTools extensions
- Performance profiler for memory leaks
For Backend (Node/Python/Java):
- Console/print statements with context
- IDE debugger with breakpoints and watch expressions
- Log aggregation tools (grep, tail, structured logging)
- APM tools for performance bottlenecks
- Database query logs for ORM issues
For Full Stack:
- Request/response inspection (curl, Postman, fetch)
- Environment variable verification
- Dependency version conflicts (package-lock.json, requirements.txt)
- Git blame for when behavior changed
- Docker logs and container state inspection
Example
Scenario: Authentication token expires mid-request
Problem: User gets "Unauthorized" error mid-workflow after 30 minutes of inactivity.
Step 1 — Reproducibility:
- Reproduction: Login, wait 30+ minutes, attempt API call
- Error: 401 Unauthorized from backend
- Logs show: Token validation failed
Step 2 — Scope:
- Affected: API requests from frontend
- Recent changes: Token refresh logic updated 2 commits ago
- Environment: Both dev and staging show issue
Step 3 — Root Cause Inspection:
- Added debugger to token refresh middleware
- Inspected localStorage: token expires at timestamp X
- Checked network: refresh endpoint returns 401 instead of new token
- Git diff shows: refresh endpoint authorization check added, but refresh itself requires valid token (circular dependency)
Step 4 — Hypothesis:
Refresh endpoint requires a valid token to refresh, but the token is expired. The circular dependency prevents token renewal.
Step 5 — Test Fix:
- Remove token requirement from refresh endpoint temporarily
- Retry reproduction: token refreshes successfully
- User workflow completes without 401
Step 6 — Permanent Fix:
- Use refresh token (separate, longer-lived token) for refresh endpoint
- Update token refresh logic to use refresh token, not access token
- Add test: verify token refreshes when access token expired but refresh token valid
- Deploy and verify in staging
1---2name: debugging-assistant3description: Debugging Assistant4---5# Debugging Assistant67## When to activate89- Tests fail or produce unexpected behavior10- Application crashes or throws errors in production or development11- Feature works partially but not as expected12- Performance degradation or memory leaks detected13- Integration between components breaks after changes14- Need systematic root-cause analysis for flaky or intermittent bugs1516## When NOT to use1718- Architecture or design questions (use design review skills instead)19- Feature requests or new functionality planning20- General refactoring or code cleanup (use simplify/code-review skills)21- Debugging external services or third-party APIs (delegate to those services' documentation/support)22- Static analysis or linting issues (use code-review skill)2324## Instructions2526### Step 1: Establish Reproducibility27- Ask for exact reproduction steps, error messages, and logs28- Create minimal reproducible example (MRE) if not provided29- Identify: does it always fail, intermittently, or only under specific conditions30- Check error logs, stack traces, and console output31- Verify: is this new (regression) or pre-existing behavior3233### Step 2: Narrow Scope34- Identify which subsystem is affected (frontend, backend, database, network, etc.)35- Use binary search: disable/enable features to isolate the problem36- Check recent changes: git diff, git log with `--since` flags37- Verify environment: dependencies versions, configuration, OS differences38- Confirm: is this a code issue or environment/infrastructure issue3940### Step 3: Inspect Root Cause41- Read error messages carefully — stack traces point to the failure location42- Add debugging statements (console.log, print, debugger breakpoints) at suspected points43- Use IDE debugger to step through code execution44- Check variable states at breakpoints — are they what you expect45- Inspect network requests/responses using browser DevTools or tools like curl/Postman46- Review logs systematically — search for ERROR, WARN, and EXCEPTION patterns4748### Step 4: Form Hypothesis49- Based on evidence gathered, propose what's broken and why50- State what behavior is expected vs. actual51- Identify the exact line/function causing the issue52- Check: does this hypothesis explain all observed symptoms5354### Step 5: Test Hypothesis55- Apply minimal fix to test theory56- Run reproduction steps again57- Verify: does the fix resolve ALL symptoms, not just one58- Check for side effects — does the fix break other functionality59- Add regression test to prevent recurrence6061### Step 6: Implement & Verify62- Apply the permanent fix63- Run existing test suite64- Add new test case covering this bug65- Update documentation if behavior changed66- Verify in development, staging, and production-like environments6768### Debugging Toolkit6970**For Frontend (JavaScript/TypeScript):**71- Browser DevTools console and debugger72- Network tab for API requests73- React/Vue DevTools extensions74- Performance profiler for memory leaks7576**For Backend (Node/Python/Java):**77- Console/print statements with context78- IDE debugger with breakpoints and watch expressions79- Log aggregation tools (grep, tail, structured logging)80- APM tools for performance bottlenecks81- Database query logs for ORM issues8283**For Full Stack:**84- Request/response inspection (curl, Postman, fetch)85- Environment variable verification86- Dependency version conflicts (package-lock.json, requirements.txt)87- Git blame for when behavior changed88- Docker logs and container state inspection8990## Example9192### Scenario: Authentication token expires mid-request9394**Problem:** User gets "Unauthorized" error mid-workflow after 30 minutes of inactivity.9596**Step 1 — Reproducibility:**97- Reproduction: Login, wait 30+ minutes, attempt API call98- Error: 401 Unauthorized from backend99- Logs show: Token validation failed100101**Step 2 — Scope:**102- Affected: API requests from frontend103- Recent changes: Token refresh logic updated 2 commits ago104- Environment: Both dev and staging show issue105106**Step 3 — Root Cause Inspection:**107- Added debugger to token refresh middleware108- Inspected localStorage: token expires at timestamp X109- Checked network: refresh endpoint returns 401 instead of new token110- Git diff shows: refresh endpoint authorization check added, but refresh itself requires valid token (circular dependency)111112**Step 4 — Hypothesis:**113Refresh endpoint requires a valid token to refresh, but the token is expired. The circular dependency prevents token renewal.114115**Step 5 — Test Fix:**116- Remove token requirement from refresh endpoint temporarily117- Retry reproduction: token refreshes successfully118- User workflow completes without 401119120**Step 6 — Permanent Fix:**121- Use refresh token (separate, longer-lived token) for refresh endpoint122- Update token refresh logic to use refresh token, not access token123- Add test: verify token refreshes when access token expired but refresh token valid124- Deploy and verify in staging