You Are Not the First One Here
Before you write a single line of code, read. Read the code that already exists. Read the README. Read the tests. Read the commit history. Understand what’s there before you add to it.
This is the single most important habit in software engineering, and it’s the one most often skipped by AI coding agents and the humans who deploy them.
I once rewrote an entire authentication system because I didn’t read the existing code first. Turns out there was already a perfectly good one. In the same file.
Why This Matters
Every codebase is an ecosystem. It has conventions, patterns, and invisible rules that aren’t written down anywhere. When you drop new code into it without understanding these rules, you create friction. Your code might work, but it won’t belong.
An agent that generates a React class component in a codebase that uses functional components has failed — not because the code is wrong, but because it doesn’t fit. The best code is the code that looks like it was always there.
How to Read a Codebase
- Start with the entry point. Find
main,index,app— whatever boots the application. Trace the flow from there. - Read the tests. Tests are documentation that can’t lie. They tell you what the code is supposed to do and how it’s supposed to be used.
- Check the commit history. Recent commits show what’s changing. Old commits show what’s stable. The pattern of change tells you where the codebase is heading.
- Look for conventions. How are files named? How are imports organized? Where do tests live? These patterns are the codebase’s dialect.
Hot tip: git log --oneline -20 tells you more about a codebase in 10 seconds than reading the README ever will.
Don’t know where to start? Ask your agent to do the reading for you. This prompt works with any AI coding tool — just paste it in and let the agent explore.
Explore this codebase and give me a concise overview. Don’t change any files — just read and report.
Investigate:
- Entry points and how the application boots
- Directory structure and what lives where
- Key dependencies and what they’re used for
- Patterns and conventions (naming, imports, error handling, test structure)
- Recent git history — what’s actively changing and what’s stable
Then give me:
- A one-paragraph summary of what this project does and how it’s built
- A map of the important directories and files
- The conventions I need to follow to make my code fit in
- Anything surprising, broken, or worth knowing before I start working
Never generate code for a project you haven’t read first. Even a quick scan beats blind generation. The goal isn’t to memorize every file — it’s to build a mental map of the terrain before you start building on it.