performing-systematic-debugging-for-stubborn-problems
Applies a modified Fagan Inspection methodology to systematically resolve persistent bugs and complex issues. Use when multiple previous fix attempts have failed repeatedly, when dealing with intricate system interactions, or when a methodical root cause analysis is needed. Do not use for simple troubleshooting. Triggers after multiple failed debugging attempts on the same complex issue.
What this skill does
# Systematic Debugging with Fagan Inspection This skill applies a modified Fagan Inspection methodology for systematic problem resolution when facing complex problems or stubborn bugs that have resisted multiple fix attempts. ## Process Overview Follow these four phases sequentially. Do not skip phases or attempt fixes before completing the inspection. ### Phase 1: Initial Overview Establish a clear understanding of the problem before analysis: - **Explain the problem** in plain language without technical jargon - **State expected behaviour** - what should happen - **State actual behaviour** - what is happening instead - **Document symptoms** - error messages, logs, observable failures - **Context** - when does it occur, how often, under what conditions **Output:** A clear problem statement that anyone could understand. ### Phase 2: Systematic Inspection Perform a line-by-line walkthrough as the "Reader" role in Fagan Inspection. **Identify defects without attempting to fix them yet** - this is pure inspection. Check against these defect categories: 1. **Logic Errors** - Incorrect conditional logic (wrong operators, inverted conditions) - Loop conditions (infinite loops, premature termination) - Control flow issues (unreachable code, wrong execution paths) 2. **Boundary Conditions** - Off-by-one errors - Edge cases (empty inputs, null values, maximum values) - Array/collection bounds 3. **Error Handling** - Unhandled exceptions - Missing validations - Silent failures (errors caught but not logged) - Incorrect error recovery 4. **Data Flow Issues** - Variable scope problems - Data transformation errors - Type mismatches or coercion issues - State management (stale data, race conditions) 5. **Integration Points** - API calls (incorrect endpoints, malformed requests, missing headers) - Database interactions (query errors, transaction handling) - External dependencies (version mismatches, configuration issues) - Timing issues (async/await problems, race conditions) **Think aloud** during this phase. For each section of code: - State what the code is intended to do - Identify any discrepancies between intent and implementation - Flag assumptions or unclear aspects - Use ultrathink to think deeper on complex sections **Output:** A categorised list of identified defects with line numbers and specific descriptions. ### Phase 3: Root Cause Analysis After identifying issues, trace back to find the fundamental cause - not just symptoms. **Five Whys Technique:** - Ask "why" repeatedly (at least 3-5 times) to get to the underlying issue - State each "why" explicitly in your analysis - Example: - Why did the API call fail? → Because the request was malformed - Why was it malformed? → Because the data wasn't serialised correctly - Why wasn't it serialised? → Because the serialiser expected a different type - Why did it expect a different type? → Because the schema was updated but code wasn't - Root cause: Schema versioning mismatch between services **Consider:** - Environmental factors (configuration, dependencies, runtime environment) - Timing and concurrency (race conditions, async issues) - Hidden assumptions in the code or system design - Historical context (recent changes, migrations, updates) **State assumptions explicitly:** - "I'm assuming X because..." - "This presumes that Y is always..." - Flag any assumptions that need verification **Output:** A clear statement of the root cause, the chain of reasoning that led to it, and any assumptions that need validation. ### Phase 4: Solution & Verification Now propose specific fixes for each identified issue. **For each proposed solution:** 1. **Describe the fix** - what code/configuration changes are needed 2. **Explain why it resolves the root cause** - connect it back to Phase 3 analysis 3. **Consider side effects** - what else might this change affect 4. **Define verification steps** - how to confirm the fix works **Verification Planning:** - Specific test cases that would have caught this bug - Manual verification steps - Monitoring or logging to add - Edge cases to validate **Output:** A structured list of fixes with verification steps. ## Important Guidelines - **Complete each phase thoroughly** before moving to the next - **Think aloud** - verbalise your reasoning throughout - **State assumptions explicitly** rather than making implicit ones - **Flag unclear aspects** rather than guessing - if something is uncertain, say so - **Use available tools** - read files, search code, run tests, check logs - **Focus on systematic analysis** over quick fixes - **Validate flagged aspects** - after completing all phases, revisit any unclear points and use the think tool with "ultra" depth if needed to clarify them ## Final Output After completing all four phases, provide: 1. **Summary of findings** - key defects and root cause 2. **Proposed solutions** - prioritised list with rationale 3. **Verification plan** - how to confirm fixes work 4. **Next steps** - unless the user indicates otherwise, proceed to implement the proposed solutions ## When This Skill Should NOT Be Used - For simple, obvious bugs with clear fixes - When the first debugging attempt is still underway - For new features (this is for debugging existing code) - When the problem is clearly environmental (config, infrastructure) and doesn't require code inspection
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.