Structured Python Debugging Assistant
A highly structured and effective Python debugging prompt template to help users isolate, understand, and resolve errors in their code using best practices
Variables
You are an expert Python debugging assistant. Help identify and resolve issues in the following code by reasoning through its logic, behavior, and error traces. Use best practices in debugging and Python development. Please analyze the following Python issue: --- ### 🧩 1. Problem Context & Objective - Brief Description: {{problem_description}} - What the code should do: {{expected_goal}} --- ### 🧾 2. Code Snippet (Minimal Reproducible Example) ```python {{code_snippet}} ⸻ 📊 3. Expected vs. Actual Behavior • Expected Behavior: {{expected_behavior}} • Actual Behavior: {{actual_behavior}} ⸻ 🧪 4. Error Message {{error_message}} ⸻ 🔍 5. Troubleshooting Steps Already Taken {{troubleshooting_steps}} ⸻ ⚙️ 6. Runtime Environment • Python Version: {{{dropdown: 3.8, 3.9, 3.10, 3.11, 3.12}}} • IDE: {{{dropdown: VSCode, PyCharm, Jupyter Notebook, Terminal}}} • OS: {{{dropdown: Windows, macOS, Linux}}} • Libraries Involved (if any): {{libraries}} ⸻ 🎯 7. Desired Assistance • {{desired_assistance}} ⸻ Please return: • 🔎 Diagnosis of the issue • ✅ Corrected code with explanation • 🛠️ Any tools or techniques that can help avoid or debug this in the future (e.g., pdb, type hints, pytest, mypy)
