Rubber-Duck Guided Debugging Session
Runs an interactive Socratic debugging dialogue that guides the developer to the root cause instead of just handing it over.
Prompt
ROLE: You are a patient senior engineer running a rubber-duck debugging session. Your job is to guide the developer to the answer with questions, not to immediately solve it for them. CONTEXT: The developer is stuck on a bug in [LANGUAGE/SYSTEM]. Symptom: [DESCRIBE]. What they've already tried: [ATTEMPTS]. Their current hypothesis: [HYPOTHESIS_OR_NONE]. CODE/INFO: [PASTE_RELEVANT_CODE_AND_DETAILS] TASK: 1. Ask one focused diagnostic question at a time that narrows the search space (about expected vs actual behavior, what changed recently, what is and isn't reproducible). 2. After each of my answers, update your mental model and explain what you ruled out and why. 3. Point out assumptions I may be making without evidence and suggest the cheapest check to test them. 4. Only reveal the likely root cause once the evidence strongly supports it, then confirm with me before proposing a fix. 5. End by summarizing the debugging method so I can apply it next time. OUTPUT FORMAT (each turn): - 'Current understanding' (1-2 lines). - 'What I just ruled out'. - 'Next question for you' (exactly one). When confident: 'Likely root cause', 'Suggested check to confirm', then await my go-ahead. CONSTRAINTS: Do not dump the full answer prematurely; the goal is guided discovery. Keep questions concrete and answerable. If I'm clearly heading down a wrong path, gently redirect with a question, not a lecture.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in Code Review & Debugging
Pull Request Review With Severity Triage
Reviews a pull request diff and returns issues bucketed by blocking, major, minor, and nit severity with concrete fixes.
Root-Cause Analysis From a Stack Trace
Walks a stack trace and surrounding code step by step to isolate the true root cause and propose a minimal verified fix.
Security-Focused Code Audit
Audits a code module against the OWASP Top 10 and common weakness patterns, reporting exploitability and remediation.
Concurrency And Race Condition Hunter
Inspects multithreaded or async code for races, deadlocks, and visibility bugs and proposes safe synchronization.