diagnose — Diagnostic Debugging
- Trigger:
/diagnoseor keywords "diagnose this", "debug this", "what's wrong with" - Best for: Bug debugging, performance regressions, anomaly investigation
- Not for: Pure exploration, new features, code review
Overview
diagnose is Claude Code's general-purpose debugging Skill. It follows a rigorous diagnostic loop: "Reproduce → Narrow → Hypothesize → Instrument → Fix → Regression-test", ensuring every bug is systematically located and resolved.
Trigger Conditions
diagnose auto-triggers when you:
- Describe a bug or unexpected behavior
- Mention a performance regression or slowdown
- Say something is "broken" or "not working"
- Use the
/diagnosecommand
Examples
Example 1: API Latency Spike
/diagnose The /api/users endpoint P99 latency jumped from 50ms to 500msClaude will:
- Ask about recent deployments
- Check for N+1 queries
- Look for missing indexes or slow queries
- Check for cache invalidation
Example 2: Frontend Rendering Bug
/diagnose React list page goes blank after scrolling to bottom, Chrome latestClaude will:
- Determine if it's a render crash or data issue
- Inspect virtual list / infinite scroll implementation
- Check for memory leaks or key issues
Example 3: CI Build Failure
/diagnose CI build suddenly failing, works locally, error: 'Module not found'Example 4: Data Inconsistency
/diagnose Order status shows 'shipped' but tracking info is empty, intermittentExample 5: Flaky Test
/diagnose UsersService.test.ts fails intermittently, about 30% of runsWorkflow
- Reproduce — Collect reproduction conditions, frequency, environment
- Narrow — Use bisection, git bisect, or logs to locate suspicious code
- Hypothesize — Propose verifiable cause hypotheses based on code logic
- Instrument — Add logging/breakpoints/monitoring to validate
- Fix — Apply fix after confirming root cause
- Regression-test — Ensure fix doesn't introduce new issues
Notes
- Provide reproduction steps and environment info for faster diagnosis
- For hard-to-reproduce issues, describe trigger probability and known patterns
- Sanitize any sensitive production data
- This is not a code review tool — use
/reviewinstead - Complex performance issues may need actual profiling data