agent coding skill risk: low
Phase-Gated Code Debugging Protocol
Instructs the model to follow a strict 5-phase debugging protocol (Reproduce, Isolate, Root Cause, Fix, Verify) that blocks all source code edits until the root cause is confirmed…
SKILL 1 file
SKILL.md
--- name: antigravity-awesome-skills-phase-gated-debugging-d79c272b description: "Use when debugging any bug. Enforces a 5-phase protocol where code edits are blocked until root cause is confirmed. Prevents premature fix attempts." --- # Phase-Gated Debugging ## Overview AI coding agents see an error and immediately edit code. They guess at fixes, get it wrong, and spiral. This skill enforces a strict 5-phase protocol where you CANNOT edit source code until the root cause is identified and confirmed. Based on [claude-debug](https://github.com/krabat-l/claude-debug) (full plugin with PreToolUse hook enforcement). ## When to Use Use this skill when: - a bug keeps getting "fixed" without resolving the underlying issue - you need to slow an agent down and force disciplined debugging before code edits - the failure is intermittent, a regression, performance-related, or otherwise hard to isolate - you want an explicit user confirmation checkpoint before any fix is applied ## The Protocol ### Phase 1: REPRODUCE Run the failing command/test. Capture the exact error. Run 2-3 times for consistency. - Do NOT read source code - Do NOT hypothesize - Do NOT edit any files ### Phase 2: ISOLATE Read code. Add diagnostic logging marked `// DEBUG`. Re-run with diagnostics. Binary search to narrow down. - Only `// DEBUG` marked logging is allowed - Do NOT fix the bug even if you see it ### Phase 3: ROOT CAUSE Analyze WHY at the isolated location. Use "5 Whys" technique. Remove debug logging. State: "This is my root cause analysis: [explanation]. Do you agree, or should I investigate further?" **WAIT for user confirmation. Do NOT proceed without it.** ### Phase 4: FIX Remove all `// DEBUG` lines. Apply minimal change addressing confirmed root cause. - Only edit files related to root cause - Do NOT refactor unrelated code ### Phase 5: VERIFY Run original failing test — must pass. Run related tests. For intermittent bugs, run 5+ times. If verification fails: root cause was wrong, go back to Phase 2. ## Bug-Type Strategies | Type | Technique | |------|-----------| | Crash/Panic | Stack trace backward — trace the bad value to its source | | Wrong Output | Binary search — log midpoint, halve search space each iteration | | Intermittent | Compare passing vs failing run logs — find ordering divergence | | Regression | `git bisect` — find the offending commit | | Performance | Timing at stage boundaries — find the bottleneck | ## Key Rules 1. NEVER edit source code in phases 1-3 (except `// DEBUG` in phase 2) 2. NEVER proceed past phase 3 without user confirmation 3. ALWAYS reproduce before investigating 4. ALWAYS verify after fixing ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
REQUIRED CONTEXT
- failing command or test
- exact error output
OPTIONAL CONTEXT
- bug type (crash, intermittent, regression, etc.)
ROLES & RULES
- Do NOT read source code
- Do NOT hypothesize
- Do NOT edit any files
- Only `// DEBUG` marked logging is allowed
- Do NOT fix the bug even if you see it
- State: "This is my root cause analysis: [explanation]. Do you agree, or should I investigate further?"
- WAIT for user confirmation. Do NOT proceed without it
- NEVER edit source code in phases 1-3 (except `// DEBUG` in phase 2)
- NEVER proceed past phase 3 without user confirmation
- ALWAYS reproduce before investigating
- ALWAYS verify after fixing
EXPECTED OUTPUT
- Format
- plain_text
- Schema
- markdown_sections · Overview, When to Use, The Protocol, Phase 1: REPRODUCE, Phase 2: ISOLATE, Phase 3: ROOT CAUSE, Phase 4: FIX, Phase 5: VERIFY, Bug-Type Strategies, Key Rules, Limitations
- Constraints
- never edit source code in phases 1-3 except for // DEBUG logging in phase 2
- explicitly state root cause and wait for user confirmation before phase 4
- follow the exact 5-phase sequence and bug-type strategies
SUCCESS CRITERIA
- Reproduce the failing command/test before investigating
- Isolate root cause with diagnostic logging only
- Obtain user confirmation after root cause analysis
- Apply minimal fix addressing confirmed root cause
- Verify fix by running tests including related and intermittent cases
FAILURE MODES
- May be used outside intended debugging scope
- May require clarification on missing inputs or boundaries
QUALITY
- OVERALL
- 0.82
- CLARITY
- 0.90
- SPECIFICITY
- 0.85
- REUSABILITY
- 0.80
- COMPLETENESS
- 0.75
IMPROVEMENT SUGGESTIONS
- Add explicit placeholders (e.g., {{bug_description}}) to increase reusability as a template.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR AGENT
- Rapid App MVP Prototyperagentcoding
- AI-First Design Handoff Specs Generatoragentcoding
- Test-Driven Development Workflow Rulesagentcoding
- Structured Autonomy Implementation Agentagentcoding
- PROGRESS.md Manager for Agentic Codingagentcoding
- Hard Bug Diagnosis Disciplineagentcoding
- Git Development Branch Finisheragentcoding
- Code Review Feedback Reception Protocolagentcoding
- Systematic Debugging Process Guideagentcoding
- Matplotlib Python Plotting Guideagentcoding
- LaTeX Paper PDF Compileragentcoding
- Full Output Enforcement for Code Generationagentcoding
- PyTorch Geometric GNN Implementation Guideagentcoding
- Premium React UI Design Architectagentcoding
- Astropy Python Astronomy Library Guideagentcoding
- Book SFT Style Transfer Pipelineagentcoding
- Event Sourcing and CQRS Architectagentcoding
- FluidSim Python CFD Simulation Guideagentcoding
- NetworkX Python Graph Analysis Toolkitagentcoding
- Phase-Gated Debugging Protocol Enforceragentcoding
- SimPy Discrete-Event Simulation Guideagentcoding
- Phase-Gated Code Debugging Protocolagentcoding
- Biopython Molecular Biology Toolkit Guideagentcoding
- Haskell Advanced Type Systems Expertagentcoding
- Anime.js Complex Animation Workflowagentcoding