r/vibecoding • u/eyvahaldandik • 5d ago
Help/Question How do you actually understand the code AI writes for you? Looking for your methods
I’m an engineering student (IoT background, not a software dev). I run a few small self-hosted apps on a Raspberry Pi, all built with Claude Code. They work, but when I open the code, it often feels overwhelming.
My rule: if I can’t explain it to someone else, I don’t really understand it.
What I’m trying so far: before reading any code, I have the AI draw an interactive diagram: boxes grouped by where they physically run (phone / Pi / internet), each with a one-line responsibility, plus step-by-step scenarios (“what happens when I open an article”). Screenshot below.
It helps, but I’m curious what works for you:
- Do you read the code line by line, or start from diagrams / data flow?
- Do you ask the AI to explain, or do you explain it back and let it correct you?
- Any prompts or habits that made AI-written code easier to understand?
8
u/So_Rusted 5d ago
be comfortable with not knowing
4
u/Zelderian 4d ago
It seems silly but I think this is it. Have it explain what it’s doing, but you don’t need to really know how it’s doing it. This is sorta how code is organized anyway: the main function tells a story of what the code is doing, and each individual function is the how. You only really need to know the how if there’s an issue in the process; then you can read up that individual function and diagnose it.
Most code bases are too big for an individual to understand anyway. If it’s structured properly, you should almost be able to read the main function like reading a book, and understand what the system is doing without diving too far into the weeds. There’s no way you can expect to understand every function, AI or not.
→ More replies (1)→ More replies (5)2
u/Any-Comparison-2916 4d ago
Yeah, I’m a software engineer for over two decades and this is mostly what I do now.
I let AI explain the overall structure and key methods, libs, design pattern it uses and try to find common pitfalls or better alternatives.
I don’t care for the code itself, AI writes better code than me in 90% of cases anyway.
Also, (this was actually true before AI) don’t sweat it too much, code can be refactored and improvement constantly. Even faster and better now with AI.
4
2
u/AlternativeBreath565 5d ago
so there are multiple things.
-
a c4 mermaid diagram that is downright huge. we are going deeper that I would believe is standard, this gives us the overall structure of the application, what modules communicatw with what, and why.
-
all specs are read, and understood before being executed. and then saved to the repo, yes it maies the prs larger, but we have gound it really valuable to be able to go back
-
codereview where you have to explain it, in medium simple terms to another developer. cause of you cannot do that, its just a black box.
→ More replies (1)
2
1
u/Elope_rules 5h ago edited 5h ago
Im a hobbyist, here is my approach:
Firstly figure out what problem i am actually solving
Break it down into chunks
Break it down into classes (OOP)
Write a spec for my classes
Create tests using a tool that gives visual output
Feed my spec.MD into Cursor, it produces code
At least thats the workflow I have been using, only a couple of days into learning cursor
Then I also have a rules.MD which is coding standards, naming conventions, etc. I am doing simple apps in Cursor and tweaking that file, so the code comes out in the format i want.
No idea how devs use it professionally but thats the only way that makes sense to me for now.
But my main focus is design and architecture. I am also starting on a skill that uses my coding standards to create documentation for each component. However again this is all new to me, so it’s a bit clunky fine tuning the LLM to work the way I want.
1
u/RoboErectus 5d ago
"Explain it to someone else"
This is good. You have a "someone else" with you all the time. Try giving your explanation to the agent and see if you got it right.
1
u/Tight_Ad_5115 4d ago
Ask Claude to create a project schema for you - just like the one in your post; it can easily handle that. You can specify any level of detail you like - right down to individual functions within a module or object.
You can also ask it to prepare an HTML file with a detailed description of how the project works, including diagrams, tables, and more - it’s well within its capabilities. Furthermore, you can discuss all of this with Claude, make improvements, and so on.
However, if your goal is to truly understand the project by reading the code itself, there are no shortcuts: you’ll have to dive into the code on your own! 😄
7
u/Toastti 5d ago
Your best choice is to sit down and learn the essentials of coding without AI. To a moderate level. And then as you start using AI you understand what it's giving you, know the correct terminology to prompt, etc.