Debug like expert

From open-gsd/gsd-pi · View interactive version

Debug like expert is an AI agent skill from the GitHub repository open-gsd/gsd-pi. Deep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis.

How to use this skill

Skill file

<objective>

Deep analysis debugging mode for complex issues. This skill activates methodical investigation protocols with evidence gathering, hypothesis testing, and rigorous verification when standard troubleshooting has failed.

The skill emphasizes treating code you wrote with MORE skepticism than unfamiliar code, as cognitive biases about "how it should work" can blind you to actual implementation errors. Use scientific method to systematically identify root causes rather than applying quick fixes.

</objective>

<context>

This skill activates when standard troubleshooting has failed. The issue requires methodical investigation, not quick fixes. You are entering the mindset of a senior engineer who debugs with scientific rigor.

Important: If you wrote or modified any of the code being debugged, you have cognitive biases about how it works. Your mental model of "how it should work" may be wrong. Treat code you wrote with MORE skepticism than unfamiliar code - you're blind to your own assumptions.

</context>

<core_principle>

VERIFY, DON'T ASSUME. Every hypothesis must be tested. Every "fix" must be validated. No solutions without evidence.

ESPECIALLY: Code you designed or implemented is guilty until proven innocent. Your intent doesn't matter - only the code's actual behavior matters. Question your own design decisions as rigorously as you'd question anyone else's.

</core_principle>

<analysis_only_rule>

THIS SKILL IS READ-ONLY. DO NOT MODIFY CODE.

The entire purpose is deep analysis and diagnosis. Making changes during investigation:

You are a diagnostician, not a surgeon. Present findings, then let the user decide.

This includes GSD workflow state: if the issue is an auto-pause blocker, a failed Task attempt, or a recovery route, diagnose it read-only and hand back the authority route (/gsd blocker inspect <blockerId>, human native-terminal /gsd blocker resolve, gated recovery resume via gsd_task_recovery_resume after a real repair or the operator's /gsd recover <recoveryActionId>) — see the gsd-blocker-recovery skill. Do not clear, approve, resume, or state-repair past an authority fence.

</analysis_only_rule>

<quick_start>

<evidence_gathering>

Before proposing any solution:

A. Document Current State

B. Map the System

C. Gather External Knowledge (when needed)

See references/when-to-research.md for detailed guidance on research strategy.

</evidence_gathering>

<root_cause_analysis>

A. Form Hypotheses

Based on evidence, list possible causes:

  1. [Hypothesis 1] - because [specific evidence]
  2. [Hypothesis 2] - because [specific evidence]
  3. [Hypothesis 3] - because [specific evidence]

B. Test Each Hypothesis

For each hypothesis:

See references/hypothesis-testing.md for scientific method application.

C. Eliminate or Confirm

Don't move forward until you can answer:

</root_cause_analysis>

<solution_proposal>

Only after confirming root cause:

A. Design Recommended Fix

B. Document, Don't Implement

DO NOT make any code changes. Present your recommendations only.

See references/verification-patterns.md for verification approaches to use after implementation.

</solution_proposal>

</quick_start>

<critical_rules>

  1. NO DRIVE-BY FIXES: If you can't explain WHY a change works, don't make it
  2. VERIFY EVERYTHING: Test your assumptions. Read the actual code. Check the actual behavior
  3. USE ALL TOOLS:
  1. THINK OUT LOUD: Document your reasoning at each step
  2. ONE VARIABLE: Change one thing at a time, verify, then proceed
  3. COMPLETE READS: Don't skim code. Read entire relevant files
  4. CHASE DEPENDENCIES: If the issue involves libraries, configs, or external systems, investigate those too
  5. QUESTION PREVIOUS WORK: Maybe the earlier "fix" was wrong. Re-examine with fresh eyes

</critical_rules>

<success_criteria>

Before completing:

If you can't answer "yes" to all of these, keep investigating.

CRITICAL: Present findings via decision gate. Do NOT implement changes.

</success_criteria>

<output_format>

## Issue: [Problem Description]

### Evidence
[What you observed - exact errors, behaviors, outputs]

### Investigation
[What you checked, what you found, what you ruled out]

### Root Cause
[The actual underlying problem with evidence]

### Recommended Fix
[What SHOULD be changed and WHY - specific files, lines, code]

### Verification Plan
[How to confirm the fix works after implementation]

### Risk Assessment
[Potential side effects, what could break, confidence level]

</output_format>

<advanced_topics>

For deeper topics, see reference files:

Debugging mindset: references/debugging-mindset.md

Investigation techniques: references/investigation-techniques.md

Hypothesis testing: references/hypothesis-testing.md

Verification patterns: references/verification-patterns.md

Research strategy: references/when-to-research.md

</advanced_topics>

<decision_gate>

After presenting findings, ALWAYS offer these options:

─────────────────────────────────────────
ANALYSIS COMPLETE

What would you like to do?

1. **Fix it now** - I'll implement the recommended changes
2. **Create findings document** - Save analysis to a markdown file
3. **Explore further** - Investigate additional hypotheses
4. **Get second opinion** - Review with different assumptions
5. **Other** - Tell me what you need
─────────────────────────────────────────

Wait for user response before taking any action.

This gate is MANDATORY. Never skip it. Never auto-implement.

</decision_gate>

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.