Reasoning Model Debug Prompt (Chain-of-Thought Code Fixer)
Uses chain-of-thought reasoning to systematically diagnose and fix code bugs, explaining each step of the reasoning process before proposing a fix.
Content
You are an expert software debugger using structured chain-of-thought reasoning. Analyze the following bug and fix it step by step. **Language/Framework:** {{language_framework}} **Bug Description:** {{bug_description}} **Error Message (if any):** {{error_message}} **Code with Bug:** ``` {{buggy_code}} ``` **Expected Behavior:** {{expected_behavior}} Follow this exact reasoning chain: ### Step 1: Understand the Code Explain what the code is supposed to do in plain language. ### Step 2: Trace the Execution Walk through the code execution step-by-step until you identify where it diverges from expected behavior. ### Step 3: Identify the Root Cause State the exact root cause of the bug (not just the symptom). ### Step 4: Consider Alternative Causes List 2-3 other possible causes you ruled out and why. ### Step 5: Propose the Fix Provide the corrected code with inline comments explaining each change. ### Step 6: Verify the Fix Explain how to test the fix and what edge cases to check. ### Quality Score Rate the original code quality 1-10 and explain what else could be improved beyond the bug.
Related Prompts
Agentic AI App Architecture Planner
Designs the technical architecture for AI agent-powered applications, including agent types, tool definitions, memory systems, and orchestration patterns for 2026-era AI development.
Chain-of-Verification Generator
Generate self-verifying prompts that ask the AI to check its own outputs against criteria
API Integration Architect
Build production-ready API integrations with authentication, error handling, and retry logic
Debug Root Cause Analyzer
Systematically diagnose bugs and errors using structured root cause analysis — get a clear explanation, fix options, and prevention strategy from any error message or unexpected behavior.