There’s an infinite inkwell high above the city. Dip the pen steadily, sing the melody. — Blue Scholars
I’ve recently noticed that my most beneficial vibe coding projects aren’t the ones where I generate the most code. They’re the ones where I spend an equal amount of time reading code.
Unlike traditional coding, where you spend most of your time writing code, AI-assisted coding transforms you into a reviewer. You’re no longer the sole author of every line; you’re now a curator, a critic, and a collaborator. So spend time reading the code that you generate.
That’s the tl;dr. Read on for a full explanation.
The Double-Edged Sword of AI Coding
Coding with AI agents is like Forrest Gump’s box of chocolates: you never know what you’re going to get.
Sometimes, it’s magic. I give the agent a vague idea, and it somehow understands exactly what I meant. It’s like the agent has a secret connection to my subconscious, and it pulls code straight out of my mind.
prompt: use that library that interpolates variables in strings
reply: sure, I’ll use the
glue
library
But just as often, I’ll find myself scratching my head as the agent misses what seems like the most obvious solution. It might generate complex, over-engineered code when a simple, straightforward approach would have been more elegant and correct. AI is powerful but it isn’t always the best judge of simplicity and clarity.
This contrast highlights why reading is so crucial. When the agent produces something magical, reading helps me understand why it worked so well - what patterns or approaches made it successful. And when it misses the mark, careful reading helps me identify where it went wrong and how to guide it toward better solutions.
Reasons to Read
Learn Through Observation
Reading AI-generated code is like having a conversation with thousands of developers at once. Each line might contain a technique, pattern, or approach I’ve never encountered before. Reading that code helps me learn as I go.
I’ve learned countless techniques from reading AI-generated code:
- Proper use of
html_attr
when extracting data from HTML with R - Using output variables in GitHub Actions to reuse STDOUT from previous steps
- Elegant ways to handle data transformations with the tidyverse pipe operator
- How to use multi-stage Dockerfiles
Just because you’re reading doesn’t mean you can’t use AI at all. You can enhance this learning by asking the AI to explain its choices (or yours!). In Cursor’s “Ask” mode, you can request an explanation of specific lines, for code reviews, or for critical analyses of the generated code.
But do ask for constructive criticism! An LLM will often provide a complimentary review at first but omit mentioning serious problems unless I specifically inquire about them.
Revise and Refine
AI agents are powerful, but they’re not perfect. They can make mistakes:
- Incorrect calculations
- Suboptimal data models
- Incorrect training/testing splits (or none at all)
- Unwanted edits
- Incomplete implementations
- Repeatedly trying the same three solutions, none of which work
Reading helps you identify and fix these issues. You can nudge the data model in a different direction, correct a few calculations, or remove unwanted changes.
Plan Your Next Move
Reading generated code helps you understand what you need to do next in your project. The AI might generate code for one part of your workflow, but reading it reveals the next logical steps:
- Extract additional data
- Build a predictive model
- Create visualizations
- Calibrate your model
- Improve accuracy
The generated code often contains clues about what’s missing or what could be improved.
Own Your Codebase
Ultimately, you’re still responsible for your code, even if you didn’t type every character. Reading ensures you understand, remember, and can personally explain your codebase.
This knowledge is crucial for:
- Debugging issues
- Onboarding new team members
- Refactoring or reusing code
- Making architectural decisions
And it saves money! I can easily use an API request or three every minute, which quickly eats through the 500
to 1500
requests included with a monthly subscription to Cursor.
Conclusion
In the age of AI-assisted coding, reading is not just a passive activity—it’s an active, essential part of the development process. By dedicating as much time to reading as to generating code, you’ll create better software, learn more, and maintain greater control over your projects.
So the next time you’re tempted to just run the generated code without reading it, remember: the real magic happens when you take the time to understand what you just created.
The most important part of programming is not writing lines of code; it’s understanding the problem and discovering solutions. — Zed Shaw
See also
- LLMs and Programming in the first days of 2024 - antirez
- https://wycats.substack.com/p/vibe-coding-the-right-way
- https://www.lucasaguiar.xyz/posts/vibe-coding-pitfalls/