How to Read Code (Not Just Write It)
Reading code is the skill that separates good developers from great ones. Here's a practical system for reading unfamiliar codebases without getting lost.
The Reading-Writing Imbalance
Most developers learn to write code but never deliberately practice reading it. This is backwards — engineers spend more time reading code than writing it. Reading a bug report, reviewing a PR, understanding an unfamiliar module, onboarding to a new codebase: all of these require reading as the primary skill. Vibe coders in particular are almost exclusively writers — they generate code via AI but rarely read what came out. This creates a specific blindness that shows up badly in team environments.
Start With the Entry Points
When approaching an unfamiliar codebase, most beginners start in the wrong place — they open random files and try to understand them in isolation. Instead, find the entry points: where does the application start? What's the first function called? For a web app this might be the server startup, the router definitions, or the React app root. Trace from there. You're building a map, not reading a novel — start with the big picture before the details.
// Entry point orientation for a Node/Express app:
// 1. Find server.js or app.js — this is where it starts
// 2. Look at the route definitions — these are the "chapters"
// 3. Pick one route and trace its handler end-to-end:
// router.get('/users/:id', authenticate, getUserById)
// ↓
// What does authenticate do? (middleware)
// ↓
// What does getUserById do? (handler)
// ↓
// What database calls does it make?
// ↓
// What does it return?
// You've now traced one complete path through the system.The Five-Pass Reading Method
Read any complex code file in passes, each with a different focus. Pass 1: Scan for structure — how many functions, what are they named, what do the names suggest? Pass 2: Identify the data — what are the main types and data structures being used? Pass 3: Trace one execution path — pick the most important function and read it start to finish. Pass 4: Look for the interesting decisions — what pattern was chosen and why might that be? Pass 5: Look for what could go wrong — what error cases aren't handled, what assumptions are being made?
Use the Tests as Documentation
Well-written tests are the best documentation of what code is supposed to do. Before reading a complex module, read its tests. Each test tells you: what input is expected, what output is expected, what edge cases matter. If the tests are clear, you'll understand the module's contract before you've read a line of its implementation. This also teaches you how to write useful tests yourself — tests that serve as executable documentation rather than just assertion gates.
Building the Habit: Reading Code Every Day
The practice: spend 15 minutes per day reading code you didn't write. Start with small utilities — lodash, date-fns, a simple npm package. Read the source code. Ask yourself why each function is written the way it is. What could it have done differently? What trade-offs did the author make? Over time, expand to larger projects. Read the React source code, the Express source code, the Prisma source code. You won't understand everything, but you're building a reading vocabulary — recognizing patterns, idioms, and structures that will make all future reading faster. The code reading exercises in the Beyond Vibe Code curriculum are structured exactly this way.