-
-
CodeBuddy: understand public GitHub repos and learn from errors with three levels of hints.
-
Home screen: load a public GitHub repo, ask a question, or press Run demo with no key needed.
-
Run demo: a guided walkthrough with captions, a progress bar, and recorded sample answers.
-
Explain mode: a plain-language answer on what the repo does, where to start, and how to run it.
-
Hint level 1: a gentle nudge about the kind of problem, without giving away the fix.
-
Hint level 2: points to the file and line to check, still without the full answer.
-
Hint level 3: a full explanation of the cause, with corrected code to learn from.
Inspiration
When you are new to programming, two things are hard: opening an unfamiliar GitHub project and knowing where to start, and hitting an error message you do not understand. Most tools answer both by handing you the result, which teaches very little. I wanted a helper that explains clearly and then lets you do the thinking.
What it does
CodeBuddy is a beginner-friendly chatbot with two modes:
- Explain mode: paste a public GitHub link, then ask what the project does, where to start reading, or how to run it. It answers in plain language using the repository's real README and files.
- Debug mode: paste a Python error. Instead of dumping the fix, CodeBuddy gives three levels of hints. Level 1 is a gentle nudge about the kind of problem. Level 2 points to the file and line to check. Level 3 explains the cause and shows corrected code.
Debugging is repo-aware: it matches the traceback to the real file in the loaded repository. When the pasted error does not match the code, it says so instead of inventing an explanation.
There is also a Run demo button that plays a nine-step walkthrough with no setup and no API key, and an optional field where anyone can paste their own free Gemini key for live answers.
How I built it
- Python and Streamlit for the app, the GitHub REST API to read repositories, and the Gemini API for the AI.
- A small custom Gemini client tries a chain of models (
gemini-3.1-flash-lite, thengemini-3.5-flash-lite, thengemini-3.5-flash), retries when a model is overloaded, and shows honest error messages. - The system prompts enforce beginner language and the graduated hints, and I wrote automated checks that the level 1 hint does not leak the answer.
- The demo replays sample responses recorded from live runs of the bot, and the app says so on screen. The optional narration clips were generated once with edge-tts.
- Deployed on Render's free tier, with the keys kept in environment variables and out of the repository.
I directed and reviewed every step and tested it live. Codex wrote most of the code from prompts I verified, and Claude helped with planning and prompt writing.
Challenges
- Speed: my first repository loader downloaded every file just to check whether it was text. One mid-sized repo took over a minute. Switching to a single GitHub tree request and fetching files only when needed brought it to about 1.5 seconds.
- Hints that leaked the answer: my first level 1 hint named the line and the variable. I rewrote the prompt and added checks for leaked details.
- Overloaded free-tier models: live calls sometimes returned errors or timed out, so I measured several models and added retries and a fallback chain.
- Made-up explanations: when an error did not match the code, the model invented a story. I added a rule so it says they do not match.
- Captions that promised too much: one demo caption described a slider that never moved. Captions now describe only what is visible on screen.
- Audio on free hosting: in-app narration dropped clips on the free host. Browser logs showed slow clip loads and the page falling behind the server, so narration stays optional and the voice-over lives in the demo video.
- GitHub rate limits: shared hosting hit GitHub's request limit, so I added a token and a clearer error message.
What I learned
Getting a model to teach instead of tell takes testing, not just a good prompt. Free tiers are unreliable enough that retries, fallbacks, and honest error messages are part of the product. Measuring what is actually happening, such as timing the loader or logging events in the browser, was far better than guessing.
What's next
Support for more languages beyond Python tracebacks, private repositories, and a smoother narrated demo on faster hosting.
Built With
- claude
- codex
- edge-tts
- gemini-api
- github-rest-api
- python
- render
- streamlit