AI DebugMentor is an AI-Powered coding tutor built using Python, Flask and the OpenAI API. The application helps beginner programmers understand coding errors, debug problems, and learn programming concepts through guided explanations and hints instead of giving the full solutions.
The goal of this project is to create a beginner-friendly learning experience that encourages problem-solving, debugging skills and independent learning.
AI DebugMentor uses progressive hints to support learning:
- Hint 1 gives a small clue.
- Hint 2 gives more specific guidance.
- Full Solution stays hidden until the learner chooses to open it.
This helps learners practice debugging instead of copying answers immediately.
The tutor can generate short practice exercises based on the learner's question.
Learners can select Explain it simpler when they need a concept broken down in a more beginner-friendly way.
Instructor Mode creates teaching support such as:
- learning objectives
- discussion questions
- classroom teaching moves
- concept reinforcement ideas
AI DebugMentor can help explain common beginner issues such as:
SyntaxErrorIndentationErrorNameErrorModuleNotFoundError- API authentication errors
.envsetup problems- Git/GiHub mistakes
- Github push protection
The app also includes simple error-type detection to label the likely issue before showing the AI response.
- Python
- Flask
- OpenAI API
- Prompt Engineering
- HTML
- CSS
- Jinja Templates
- Git
- Github
- python-dotenv
- Virtual environments
ai-debugmentor/
│
├── app.py
├── requirements.txt
├── .gitignore
├── .env.example
├── README.md
│
├── templates/
│ └── index.html
│
└── static/
└── style.css
- The user enters:
- code
- an error message
- or a coding question
- User selects a skill level and tutor mode.
- Flask sends the request to the OpenAI API.
- The prompt instructs AI DebugMentor to respond as a beginner-friendly tutor.
- The Flask/Jinja frontend displays the response in sections, including collapsible hints.
AI DebugMentor includes multiple tutor modes:
- Debug my code
- Explain an error
- Explain a concept
- Give me hints
- Explain it simpler
- Generate practice exercise
- Instructor mode
- Ask for full solution
git clone https://www.github.com/lilvina/ai-debugmentor.gitcd ai-debugmentorMac/Linux:
python3 -m venv venvWindows:
python -m venv venvMac/Linux:
source venv/bin/activateWindows:
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the root directly:
OPENAI_API_KEY=your_api_key_here
Keep your real API key private. The .env file should never be committed to GitHub.
This project includes a .gitignore file that excludes:
.env
venv/
__pycache__/
*.pyc
.DS_Store
This helps prevent API keys and local environment files from being exposed.
python3 app.pyThen open:
http://127.0.0.1:5000
Why am I getting a SyntaxError?
Explain Python loops like I'm new to programming.
Why is my OPENAI_API_KEY not working?
Generate a beginner practice exercise about functions.
Create instructor notes for teaching Flask routes.
AI DebugMentor focuses on:
- guided learning
- debugging confidence
- scaffolding
- reducing beginner frustration
- active problem-solving
- technical communication
- instructor support
The app helps learners understand what went wrong and what to try next instead of simply generating answers.
Possible future additions:
- Code execution sandbox
- Saved conversation
- Student progress tracking
- Quiz system
- Multi-language support
- Voice tutoring
- Deployment on Render or Railway
This project demostrates:
- Flask development
- OpenAI API integration
- Prompt engineering
- AI-assisted education
- Backend development
- Technical curriculum thinking
- Debugging instruction
- Secure API key handling
- Davina Taylor
- Github: www.github.com/lilvina
- Link to website: ai-coding-tutor-project-production.up.railway.app