Inspiration

Many beginners paste their bug into an AI tool, copy the fix, and learn nothing. Next time they are stuck again. I wanted an AI that teaches how to think and debug, not one that just gives answers.

What it does

CodeMentor AI has 3 pages:

  • Code Explainer: paste code and get a simple, line-by-line explanation in easy English.
  • Bug Detective: paste buggy code. You get 3 hints one by one. The first two do not give the fix. The full fix and a tip come last. If the code has no bug, it says so honestly.
  • Practice Generator: choose a language, topic and level, and get a small practice problem with a hint and a solution you open when you are ready.

It is made for students who are new to programming.

How I built it

  • Python and Streamlit for the web app, hosted on Streamlit Community Cloud.
  • Google Gemini API (google-genai) on the free tier. Main model: gemini-3.5-flash-lite, backup: gemini-3.1-flash-lite.
  • Each page sends one request with a system prompt that sets the tutor's rules. Bug Detective gets marked sections ([[HINT1]], [[HINT2]], [[HINT3]], [[FIX]]) in one answer, and the app shows them step by step.
  • If a model is busy or at its limit, the app retries and then switches to the backup model.
  • The API key is stored in Streamlit Secrets, never in the code or on GitHub. Budget: Rs 0.

Challenges I ran into

  • In my first test, Hint 2 gave the answer away. I reported it, and the prompt was rewritten to make the hints less direct.
  • Correct code still showed hints, because my file edit was not saved. I found this with a search command, and then I added a "No bug found" case.
  • The Practice Generator gave the same problem again and again. It now uses random themes and remembers recent problem titles.
  • Free-tier limits and busy servers (503 errors) made me add retries and a backup model.

Accomplishments that I'm proud of

  • The app is live and works for anyone with the link, with no login.
  • I tested Bug Detective with two different bugs (a math bug and a logic bug), and the hints did not give away the fix.
  • The whole project runs on the free tier with a budget of Rs 0, and my API key is not on GitHub.

What I learned

How to build a multi-page Streamlit app, call an AI API safely, write prompts that control the output format, test my own work, and use Git, GitHub and Streamlit Cloud to deploy.

What's next for CodeMentor AI

These are my ideas for the future, not features that exist today:

  • A Concept Explainer page for topics like recursion or loops.
  • A Code Improvement page that suggests cleaner code.
  • Saving a student's progress so they can see how they improve.

My contribution and AI help

I am Manasa T, an MCA student. I used Claude (Anthropic) as my guide, and it gave me the code and prompts step by step. I set up the project, created the files, ran every step, tested each page with my own buggy code, reported the problems I found, fixed my setup errors, and handled Git, GitHub and the deployment. Gemini is the AI inside the app.

Built With

Share this project:

Updates

Submission history