debug
Hypothesis-driven defect isolation — stack-trace forensics, breakpoint strategy, state inspection, and root-cause confirmation via minimal repro. Use when a defect surfaces (test failure, crash, exception, wrong output, intermittent flake) and the cause is not immediately obvious from the change set.
What this skill does
A bug is a falsified assumption. Find the assumption, falsify it deliberately, observe the divergence, narrow until one line owns the lie. No speculation, no shotgun edits, no "fix and rerun" guessing. ## When to Apply / NOT Apply: test fails and cause unclear; production stack trace; intermittent / flaky behavior; wrong output without crash; regression after known commit window; heisenbug. NOT apply: performance regression with correct outputs; security defect; symptom obvious from one-line read; architectural confusion. ## Anti-patterns - **Shotgun debugging**: editing several files hoping one fixes it. - **Print-and-rerun**: adding logs without a target observation. - **Premature fix**: patching symptom before isolating root cause. - **Ignoring the trace**: stack frames are evidence. - **Changing two variables at once**: defeats falsification. - **Deleting the failing test**: capturing the bug is the asset. ## Hypothesis Loop (language-neutral) 1. **Observe** — Reproduce the failure deterministically. 2. **Trace** — Read the failure artifact (stack, log, core dump). 3. **Hypothesize** — One falsifiable claim. Rank hypotheses by likelihood. 4. **Instrument** — Insert minimum probe (breakpoint, structured log, assertion). 5. **Run** — Execute the minimal repro. 6. **Confirm or refute** — If refuted, demote and pick next hypothesis. 7. **Narrow** — Binary-search the suspect range. Use `git bisect` for regressions. 8. **Confirm root cause** — Inverse test: removing/altering the cause must restore correctness. 9. **Hand off** — Forward to TDD: minimal repro becomes permanent failing test. ## Stack-Trace Reading - **Top frame is innermost**: the failure point. - **Cause vs context**: An exception's `caused by` chain encodes *why*; the stack encodes *where*. - **Async traces**: virtual stacks drop frames between awaits — capture causal context. - **Symbol fidelity**: Strip-mode binaries lose frame names. Build with debug info. - **Inlined / optimized frames**: `<inlined>` markers signal source-line-to-instruction map is approximate. ## Parallel Tooling | Family | Live debugger | Postmortem / record | Remote attach | |---|---|---|---| | Systems (C/C++/Rust) | `gdb`, `lldb`, `rust-gdb`, `rust-lldb` | `coredumpctl` + `gdb core`, `rr record/replay` | `gdb -p <pid>` / `lldb -p <pid>` | | Python | `pdb`, `ipdb`, `pdbpp`, `breakpoint()` | `faulthandler`, `py-spy dump`, traceback module | `debugpy --listen` | | Go | `dlv debug`, `dlv test`, `dlv attach <pid>` | `runtime/pprof`, GOTRACEBACK=crash | `dlv connect <addr>` | | Java/Kotlin | IntelliJ debugger, `jdb` | hs_err logs, JFR, heap dump (`jmap`) | JDWP `-agentlib:jdwp=...` | | JavaScript/TypeScript | `node --inspect`, Chrome DevTools | `--report-uncaught-exception` reports | `--inspect=0.0.0.0:9229` | | OCaml | `ocamldebug`, `Printexc.record_backtrace true` | core file + `ocaml-gdb`, memtrace | `ocamldebug -s <socket>` | Use `procs` (not `ps`) for PID. Use `bat -P -p -n` (not `cat`) for trace files. Use `git grep -n -C 3 'pattern'` (not `grep`) for callsites. ## Constitutional Rules 1. **Reproduce before fixing**. 2. **One hypothesis at a time**. 3. **Evidence over inference**. 4. **Capture the bug as a test** (hand to TDD). 5. **Confirm with inverse**. 6. **Bisect for regressions**. 7. **No silent edits**. ## Reasoning approach Before hypothesizing a fix, reason through the failure — SHORT-form KEYWORDS for trace notes, observe the symptoms, trace the execution path, break down where actual behavior diverges from expected, critically review each candidate cause, validate each hypothesis against the evidence. The root cause is the smallest explanation that accounts for all observed symptoms. For numeric calculation (timing math, bound arithmetic, off-by-N analysis), invoke `fend` per the baseline rule; never self-calculate. Causal reasoning and trace interpretation are in-head — they are not arithmetic. ## Pre-flight Check - Before writing a plan for a bug fix that touches multiple files - Whenever you notice that the previous attempt to fix a bug failed
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.