This prompt approaches debugging systematically by ranking likely causes and proposing minimal, targeted fixes. Unlike generic debugging advice, it demands precision: exact line numbers, quoted code sections, and changes that address the specific error without unnecessary refactoring. The output provides both immediate fixes and optional improvements, clearly separated.
This prompt approaches debugging systematically by ranking likely causes and proposing minimal, targeted fixes. Unlike generic debugging advice, it demands precision: exact line numbers, quoted code sections, and changes that address the specific error without unnecessary refactoring. The output provides both immediate fixes and optional improvements, clearly separated.
Deploy this when facing cryptic error messages, unexpected behavior in working code, performance issues with unclear origins, or when you've tried obvious fixes without success. Most valuable when you need to ship a fix quickly but want to understand the underlying issue.
The prompt forces a structured diagnostic process: interpreting the error message, identifying potential causes ranked by likelihood, proposing minimal fixes for each, providing exact code changes, and outlining verification steps. The separation of minimal fixes from optional refactors prevents scope creep during critical debugging.
Include the complete error stack trace and relevant code context, not just the error message. Be specific about when the error occurs—on startup, after certain actions, or under specific conditions. If you have suspicions about the cause, mention them to help the AI prioritize hypotheses. Always test the minimal fix before implementing the optional refactor.
Providing incomplete code snippets that lack necessary context. Skipping straight to the refactor suggestions without testing the minimal fix first. Not specifying the programming language, framework version, or runtime environment when these could affect the diagnosis. Accepting the first suggested fix without understanding why it works.
A structured debugging report containing: a quick interpretation of what the error means, six ranked potential causes with exact locations and minimal fixes, patch snippets showing only changed lines, a three-point test plan to verify the fix, and clearly labeled optional refactoring suggestions that improve code quality without changing behavior.
Requires you to provide the actual code and error message—it can't debug from vague descriptions. Less effective for race conditions, timing issues, or bugs that depend on external system state. The AI can't run your code, so complex interactions or environment-specific issues may need human verification.
Works best with GPT-4 and Claude for code-heavy tasks. Provide code in markdown code blocks with language specified for proper syntax highlighting. Include line numbers if referencing specific locations. Works with any programming language but is most accurate with popular languages like Python, JavaScript, TypeScript, Java, and Go.
Junior developers use this to learn debugging methodology while fixing issues. Senior engineers use it to quickly triage unfamiliar codebases. Teams use it during incident response to generate fix hypotheses. Code reviewers use it to understand why certain changes were made.
Success means getting a working fix with the minimal patch, understanding why the bug occurred, and having confidence the fix doesn't introduce new issues. The test plan should catch regressions. If the fix works but you don't understand why, ask follow-up questions before moving on.
Use after SQL Query Builder if debugging database-related errors. Combine with Rewrite for Clarity to document complex fixes for your team. Follow up with the optional refactor using Compare and Pick if you're evaluating multiple improvement approaches.