debug
Use when encountering any bug, error, or unexpected behavior in a fullstack project — enforces root-cause-first debugging discipline before any fix attempts
What this skill does
# Debugging Discipline ## The Iron Law **NO FIXES WITHOUT UNDERSTANDING THE ROOT CAUSE FIRST.** Not "try this and see." Not "it might be X." You trace it, you understand it, then you fix it. Violating the letter of this rule is violating the spirit. ## When to Use - Any error, exception, or stack trace - Unexpected behavior (wrong output, missing data, UI not updating) - Performance degradation (slow endpoint, high memory, timeout) - Flaky behavior (works sometimes, fails sometimes) - Something that "should work" but doesn't ## The Process Four phases. Sequential. No skipping. ``` REPRODUCE → INVESTIGATE → FIX → VERIFY ``` ### Phase 1: REPRODUCE Confirm the bug exists. Get a reliable way to trigger it. - Run the failing code / hit the failing endpoint / reproduce the user's steps - Capture the exact error output, status code, or wrong behavior - Note the environment: which service, which endpoint, what input - If you cannot reproduce it, you cannot fix it — investigate why reproduction fails first **Gate:** You have a repeatable reproduction before moving to Phase 2. ### Phase 2: INVESTIGATE Understand what is happening and why. This is where the real work lives. - Read the full stack trace — not just the error message, the entire call chain - Trace the data flow from input to failure point - Find where expectations diverge from reality (expected X, got Y) - Check recent changes: `git log --oneline -10 -- <file>` on the failing path - Use the debug agents as operational tools: | Symptom | Agent | |---------|-------| | Stack trace / exception | `/debug error` | | Slow response / timeout | `/debug performance` | | 4xx/5xx / CORS / auth issues | `/debug api` | | Recurring patterns in logs | `/debug logs` | **Gate:** You can explain the root cause in one sentence before moving to Phase 3. ### Phase 3: FIX Minimal, targeted change. One fix per root cause. - Fix the root cause, not the symptom - Change only what is necessary — no drive-by refactoring - If the fix requires changing more than 3 files, pause and verify you're fixing the right thing - If the fix is a try/except or error suppression, you are not fixing — you are hiding ### Phase 4: VERIFY Confirm the fix works. Confirm nothing else broke. - Re-run the exact reproduction from Phase 1 — it must pass - Run related tests: `pytest <test_file>` or the relevant test suite - If the bug was in an API: hit the endpoint again, check the response - If the bug was visual: reload the page, verify the UI - If you cannot verify, the fix is not complete **Gate:** Fresh evidence that the fix works before claiming completion. ## Red Flags — STOP and Return to Phase 1 If any of these are true, you have left the process: - Each fix reveals a new problem in a different place - You are changing code you don't fully understand - You are adding try/except or error suppression instead of fixing the cause - The fix works but you cannot explain why - You have applied 3+ attempted fixes without success - You are editing files not in the stack trace **ALL of these mean: STOP. Go back to Phase 2. Re-investigate.** ## Common Rationalizations | Excuse | Reality | |--------|---------| | "Let me just try changing this" | That's guessing, not debugging | | "It works now, ship it" | If you can't explain why, it's not fixed | | "I'll investigate properly next time" | This IS next time | | "The error message is misleading" | Read the stack trace, not just the message | | "It's probably a library bug" | It's almost never a library bug | | "This is too complex to trace" | Break it into smaller steps. Trace each one | | "I'll add logging and try again" | Add logging AND read existing logs first | ## Quick Reference ``` Phase 1: REPRODUCE → Can you trigger it reliably? Phase 2: INVESTIGATE → Can you explain the root cause in one sentence? Phase 3: FIX → Minimal change, root cause only Phase 4: VERIFY → Fresh evidence it works, no regressions ``` ## Impact From debugging sessions following this discipline: - Systematic approach: 15-30 minutes to resolution - Guessing approach: 2-3 hours of thrashing - First-time fix rate with discipline: ~90% - First-time fix rate without: ~40% - Regressions introduced: near zero vs. common
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.