🐛 Debugging Prompts
The most time-consuming part of programming is finding and fixing bugs. These prompts turn ChatGPT into a systematic debugger rather than a vague suggestions machine.
The Full Debug Request
Here is my [Python/JavaScript/language] code:
[paste your code]
It should [expected behaviour].
Instead it [actual error or wrong behaviour].
Debug it step by step. Explain every issue you find, where in the code it occurs, and why it causes the problem. Then show the corrected version with inline comments explaining each fix.
Error Message Explainer
I am getting this error:
[paste exact error message and stack trace]
Explain: 1) What this error means in plain language, 2) The most common causes, 3) How to fix it in my specific context. My code is: [paste relevant code section]
Logic Bug Finder
My code runs without errors but produces wrong output.
Input: [example input]
Expected output: [what it should produce]
Actual output: [what it actually produces]
Code: [paste code]
Walk through the logic execution step by step and identify where it diverges from the expected behaviour.
Off-by-One Error Checker
Review this loop and indexing code specifically for off-by-one errors, boundary conditions, and edge cases (empty list, single element, last element). Explain each potential issue:
[paste loop or array code]
🔍 Code Review Prompts
Full Professional Code Review
Review this [language] code like a senior developer doing a pull request review. Check for:
1. Bugs or potential runtime errors
2. Security vulnerabilities
3. Performance issues
4. Readability and naming conventions
5. Best practices violations
6. Missing edge case handling
Be specific — mention line numbers or function names. Explain WHY each issue matters.
[paste code]
Security Audit Prompt
Audit this code for security vulnerabilities. Look specifically for: SQL injection, XSS, CSRF, insecure data handling, exposed secrets, improper authentication checks, and input validation gaps. For each issue found, explain the risk and show the secure alternative.
[paste code]
Refactor for Readability
Refactor this code to improve readability without changing functionality. Rename vague variables, break large functions into smaller ones, remove redundancy, and follow [Python PEP 8 / JavaScript standard] style. Explain each change you make.
[paste code]
Performance Optimisation
Analyse this code for performance bottlenecks. Identify: unnecessary loops, O(n²) operations that can be O(n), redundant database/API calls, memory inefficiencies, and caching opportunities. Show the optimised version and explain the complexity improvement.
[paste code]
📚 Learning & Explanation Prompts
ChatGPT's greatest value for students is its ability to explain the same concept 10 different ways until one clicks — something no static tutorial can do.
Explain Like I'm a Beginner
Explain [concept: recursion / closures / decorators / async/await / pointers] to me like I'm a complete beginner. Use a simple real-world analogy first, then show a minimal code example in [Python/JavaScript], then explain what each line does. Avoid jargon.
Concept with Multiple Analogies
Explain [concept] using 3 different analogies aimed at 3 different types of people: a child, someone from a non-technical background, and a programmer learning it for the first time. Then show a code example.
Generate Practice Problems
Give me 5 [Python/JavaScript] practice problems for [topic: loops / dictionaries / OOP / APIs]. Start easy and increase difficulty with each one. For each problem: describe what to build, list the concepts it tests, and tell me what a good solution would do (without giving the answer yet).
Quiz Me on a Topic
Quiz me on [Python data structures / JavaScript closures / SQL joins / machine learning concepts]. Ask me one question at a time. Wait for my answer before revealing if it's correct. After I answer, explain why I was right or wrong and give the full correct explanation. Then ask the next question.
What Does This Code Do?
Explain what this code does line by line. Assume I understand basic [language] syntax but not the specific pattern being used here. After explaining, tell me when and why a developer would write code like this.
[paste code]
🔨 Project Building Prompts
Project Scaffolding
I want to build a [project description] using [Python / Django / React / etc]. I am a [beginner / intermediate] developer. Give me: 1) A file structure, 2) The main components/modules needed, 3) A build order (what to implement first), 4) The first function or component I should write. Don't write all the code — help me plan it.
Stuck on a Feature
I'm building a [brief project description]. I'm stuck on how to implement [specific feature]. Here is what I have so far:
[paste relevant code or description]
Don't write the full solution yet — walk me through the approach and the key steps. I'll try to implement it and ask for help if I get stuck.
Write a README for My Project
Write a professional GitHub README for my project. Here are the details:
- Project name: [name]
- What it does: [description]
- Technologies used: [list]
- How to run it: [steps]
- Why I built it: [motivation]
Use proper Markdown, include a Features section, Installation section, and Usage section. Make it look professional for a portfolio.
🎯 Interview Prep Prompts
LeetCode-Style Problem Walkthrough
I am solving this coding problem: [paste problem]. My current approach is: [describe approach or paste attempt]. Don't give me the answer yet. Ask me clarifying questions, hint at the right data structure or algorithm, and guide me toward the solution like a good interviewer would.
Mock Technical Interview
Conduct a 20-minute mock technical interview for a [junior Python developer / frontend developer / data scientist] role. Ask me: 2 conceptual questions, 1 coding problem, and 1 system design question appropriate for a junior role. Evaluate my answers honestly. Tell me what a strong answer looks like after I respond.
Big-O Complexity Explainer
Explain the time and space complexity of this code. Use Big-O notation and explain what the notation actually means for real performance — not just the symbol. Tell me if there's a more efficient approach.
[paste code]
🐍 Python-Specific Prompts
Rewrite as Pythonic Code
Rewrite this code to be more Pythonic. I wrote it thinking like a [Java / C++ / JavaScript] programmer. Show me how a Python developer would write this using list comprehensions, generators, context managers, or other Python idioms. Explain why each change is more Pythonic.
[paste code]
Explain a Python Library
Teach me how to use [pandas / numpy / requests / Flask / FastAPI] for the first time. Give me: 1) What it does and when to use it, 2) Installation command, 3) The 5 most important functions or methods with examples, 4) A small practical project I can build to practise it in 30 minutes.
Write Unit Tests for My Code
Write comprehensive unit tests for this Python function using pytest. Cover: normal cases, edge cases (empty input, None, max values), and expected failure cases. Explain what each test is checking and why that case matters.
[paste function]
🤖 AI & Machine Learning Prompts
Explain a Machine Learning Concept
Explain [overfitting / gradient descent / attention mechanism / transformer architecture / backpropagation] to me. I know basic Python and have used scikit-learn. Start with the intuition, use a visual or table if helpful, then show how it appears in code. Focus on what I need to understand to use it, not the mathematical derivation.
Debug a Machine Learning Model
My machine learning model has [low accuracy / is overfitting / is underfitting / training loss not decreasing]. Here is my setup:
- Model: [architecture or algorithm]
- Dataset: [brief description, size]
- Training accuracy: [value]
- Validation accuracy: [value]
- Code: [paste training code]
Diagnose the problem and give me 5 specific things to try, in order of likelihood to help.
📋 Quick Reference: All 50 Prompt Categories
| Category | Prompts | Best For |
|---|---|---|
| 🐛 Debugging | #1–4 | Fixing broken code faster |
| 🔍 Code Review | #5–8 | Improving code quality |
| 📚 Learning | #9–13 | Understanding concepts deeply |
| 🔨 Project Building | #14–16 | Structuring and planning projects |
| 🎯 Interview Prep | #17–19 | Preparing for technical interviews |
| 🐍 Python Specific | #20–22 | Writing better Python |
| 🤖 AI & ML | #23–24 | Machine learning projects |
| 📝 Documentation | #25–28 | Writing docstrings and comments |
| 🌐 Web Dev | #29–35 | HTML, CSS, JavaScript, React |
| 🗄️ Databases | #36–40 | SQL queries and optimisation |
| 🚀 DevOps / Deployment | #41–45 | Docker, cloud, CI/CD |
| 📐 System Design | #46–50 | Architecture and scalability |
🔑 The Golden Rule of AI Prompting
The more context you give, the better the answer. Always include: the programming language, your experience level, what you expected to happen, what actually happened, and your code. A vague question gets a generic answer. A specific question gets a specific, useful answer.
Frequently Asked Questions
📚 Related Articles
Irfana teaches AI, Python, and web development at BitWithBite — where the focus is on building real things from day one. She uses AI tools daily in her own development work and has tested these prompts extensively with students across different skill levels.