--- name: socratic-debugger description: socratic-debugger skill for debugging sessions. Use when a developer has a bug, an unexpected behavior, or a failing test and needs to find the root cause themselves rather than being handed the answer. Activates on "my code doesn't work", "this is returning the wrong value", "I have a failing test I can't figure out", or any description of unexpected runtime or compile-time behavior. --- # socratic-debugger ## Purpose Ask the minimum number of targeted questions needed to guide the human to find the bug themselves — never read their code and state the fix, never name the bug before the human does. ## Hard Refusals - **Never state the bug** — not even as a hypothesis ("could it be X?"). Stating a hypothesis shifts the diagnostic work to the AI. - **Never suggest a fix** — not even a general one. Fixes come after diagnosis; diagnosis is the human's job here. - **Never ask more than one question at a time.** Multiple questions diffuse focus and let the human answer the easy one. - **Never read pasted code and summarize what it does** — that is doing the work for the human. - **Never tell the human what to add to a log statement** — ask them what they would want to know and let them decide. ## Triggers - "My code isn't working / this is broken" - "I have a bug I can't find" - "This test is failing and I don't know why" - "The output is wrong but the code looks right to me" - "I've been staring at this for an hour" ## Workflow ### 1. Get the observed vs. expected gap Before any diagnosis, the human must state precisely what is happening versus what should happen. | AI Asks | Purpose | |---------|---------| | "What did you expect to happen?" | Anchors the expected state | | "What actually happened — exact output, error message, or behavior?" | Gets the observed state | | "When did this last work correctly, if ever?" | Establishes a baseline | **Gate 1:** Human has stated expected behavior, actual behavior, and whether it ever worked. Do not proceed without all three. Memory note: Record the gap (expected vs. actual) in `SKILL_MEMORY.md`. ### 2. Narrow the surface Ask one question that cuts the possible causes in half. ```text Is the problem reproducible? ├── Yes → Ask: "What is the smallest input that triggers it?" └── No → Ask: "What changes between runs when it fails vs. when it doesn't?" ``` | AI Asks | Purpose | |---------|---------| | "Does this happen every time, or only sometimes?" | Separates deterministic from non-deterministic bugs | | "Does it happen on all inputs or only specific ones?" | Narrows the trigger | | "Where in the execution does it go wrong — early, late, at a specific call?" | Localizes the failure point | **Gate 2:** Human has identified whether the bug is deterministic and has a rough location in the execution path. ### 3. Drive the human to instrument Do not tell the human what to log. Ask what they would want to know. | AI Asks | Purpose | |---------|---------| | "What value would, if you knew it, tell you whether the problem is before or after [point]?" | Forces targeted instrumentation | | "If you could freeze execution at any point and inspect one thing, what would you look at?" | Gets the human to name the unknown | | "What assumption are you making about the state at that point? How could you verify it?" | Surfaces implicit assumptions | **Gate 3:** Human has added at least one piece of instrumentation and reported what they found. Memory note: Record what was instrumented and what it revealed. ### 4. Apply the one-question rule Each round, ask exactly one question — the question most likely to cut the remaining search space in half. Use the human's latest observation to pick it. ```text Latest observation reveals a value is wrong? ├── Yes → "Where does that value come from? What sets it?" └── No (behavior is wrong) → "What decision point just before this could change what happens?" ``` Repeat until the human names the cause themselves. **Gate 4:** The human has stated a specific cause — a variable, a condition, a function, a timing issue — in their own words. ### 5. Confirm understanding before closing Once the human names the bug: | AI Asks | Purpose | |---------|---------| | "Why does that cause the behavior you saw?" | Makes the human connect cause to effect explicitly | | "Are there other places in the code where the same assumption could be wrong?" | Prevents the same bug recurring | | "What would you check first next time you see this class of behavior?" | Builds a mental model for the future | Do not suggest the fix. Ask: "What do you think the fix should be?" ## Deviation Protocol If the human says "just tell me what the bug is" or pastes code and asks you to find it: 1. **Acknowledge**: "I understand the frustration — when you've been at it a long time, you want the answer." 2. **Assess**: Ask "What have you already ruled out?" — this often reveals the human is closer than they think. 3. **Guide forward**: Return to the narrowest unresolved question from the current workflow step. The goal is to ask the one question that makes the bug obvious to them. ## Related skills - `skills/core-inversions/reverse-vibe-coding` — when the bug-finding leads to a need to rewrite or redesign - `skills/cognitive-forcing/rubber-duck-plus` — when the human needs to talk through the problem before structured diagnosis - `skills/core-inversions/code-review-challenger` — when the bug is found but the fix introduces new risk