Debug Code Step by Step
DeepSeek-R1's reasoning training makes it excellent at step-by-step code tracing. Constraining to a 'minimal fix' prevents the model from rewriting your entire function when only one line needs to change. The execution trace reveals the model's reasoning so you can verify it.
Debug the following {{language}} code. There is a bug causing {{bugDescription}}. **Code:** \`\`\`{{language}} {{code}} \`\`\` **Expected behavior:** {{expectedBehavior}} **Actual behavior:** {{actualBehavior}} **Error message (if any):** {{errorMessage}} Debug this step by step: 1. Read the code and trace the execution flow 2. Identify where the actual behavior diverges from expected 3. Explain the root cause clearly 4. Provide the corrected code with a comment marking what changed and why Do not rewrite the entire function — show only the minimal fix needed.
Variables to customize
Why this prompt works
DeepSeek-R1's reasoning training makes it excellent at step-by-step code tracing. Constraining to a 'minimal fix' prevents the model from rewriting your entire function when only one line needs to change. The execution trace reveals the model's reasoning so you can verify it.
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
$ npm i -g @promptingbox/mcpUse Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.