This project is an AI-powered debugging assistant built with Flask, LangChain, and Google Gemini.
It helps students debug Python code by giving structured hints, analysis, and debugging steps — without revealing the direct solution.
👉 Perfect for learning by doing rather than just copy-pasting fixes.
- 🐞 Buggy Code Analysis – Paste your Python code and get structured feedback.
- 🎯 Student Level Adaptation – Explanations adjust based on
beginner
,intermediate
, oradvanced
. - 📑 Formatted Markdown Output – Clear sections: Summary, Root Causes, Hints, Debugging Steps, Questions.
- ⚡ Gemini LLM Integration – Uses Google Gemini 2.5 Flash via
google-genai
. - 🌐 Web Interface – Simple Flask frontend with HTML/CSS for input and results.
- 🧠 LangChain PromptTemplate – Ensures consistent, structured responses.
- Backend: Flask
- AI Model: Google Gemini (
google-genai
) - Prompt Management: LangChain
- Environment Management: python-dotenv
- Frontend: HTML5 + CSS3 (responsive with simple styling)
This project is a Flask-based Python Debugger that allows users to paste buggy Python code, select their experience level, and receive personalized debugging suggestions powered by the Gemini API.
- ✍️ Code Input Box – Paste your buggy Python code.
- 🎚️ Skill Level Selection – Choose:
- Beginner → Detailed step-by-step explanations.
- Intermediate → Balanced hints + best practices.
- Advanced → Concise debugging + optimization tips.
- ⚡ Gemini API Integration – Analyzes the code and returns smart debugging feedback.
- 🎨 Dark-Themed UI – Developer-friendly interface with clear sections.
The index.html
file acts as the main input page for the debugger.
-
Header Section
- Title: Python Code Debugger
- Subtitle: Explains purpose (static analysis + debugging suggestions).
-
Code Input Area
- Large text editor for pasting buggy Python code.
- Preloaded example (e.g., Fibonacci function) for guidance.
-
Skill Level Selection
- Options: Beginner | Intermediate | Advanced.
- Ensures feedback is tailored to the user’s coding level.
-
Action Button
- “Analyze & Debug Code” (green button).
- On click → sends code + level choice to the Flask backend.
- User enters buggy code + selects level →
index.html
form submission. - Flask (
app.py
) captures inputs. - Code + level are sent to Gemini API.
- API response (debugging hints) is displayed in
result.html
.
index.html
→ Input page (buggy code + skill level).result.html
→ Output page (Gemini API debugging feedback).app.py
→ Flask backend (handles requests + API calls).
result.html
→ Display Gemini’s debugging feedback.

git clone https://github.com/your-username/gemini-debug-assistant.git
cd gemini-debug-assistant