Don't just build with AI — learn through it
Key takeaway: Before asking an agent to write code in a new codebase, ask it to explain why the code is built that way.
Don’t just use an AI agent to write code you don’t understand. Use it to learn why the codebase looks the way it does.
The usual workflow is to describe the feature, let the agent write it, review, and ship. On a new codebase, it’s tempting to let the agent handle everything you don’t understand yet. You get a working PR, but not an understanding of the code, and without that you end up going fast in the wrong direction.
So before I ask it to write anything, I ask it to explain:
- Why is this module structured this way?
- What design pattern is this service using, and what problem does it solve?
- Why does this test mock this dependency but not that one?
- What would break if I changed this interface?
No human pair partner has the patience for that many questions. An agent will explain the same concept ten ways, trace a call through six files, and compare two approaches without checking the clock. It’s pairing without the social cost of asking “dumb” questions.
Ask about decisions, not syntax. A codebase is a record of choices, some deliberate, some accidental, some inherited from a framework adopted three years ago. Ask why the team picked this database, what the test strategy is, and whether error handling matches across services. Within a few sessions you’ll have a mental model that would have taken weeks of code reading.
It pays off in your work with the agent too. You write better prompts once you know the vocabulary, and you catch mistakes faster once you know the patterns. And you capture what you learn in SKILL.md and CLAUDE.md files, so the next session starts smarter.