2 Chat: "Explain this code" is the worst prompt in AI
When people first use AI to understand code, they often ask a vague question like “What does this do?” and get back a bland summary that feels useless. The chapter argues that the failure is usually the prompt, not the model, and shows that a single sharp follow-up can reveal more than many generic requests. Using nanoGPT as the example codebase, it demonstrates how a small, readable repository is ideal for learning how to interrogate code with chat, especially when you want to uncover a real design choice rather than a surface-level description.
The core method is to replace vague, abstract prompting with concrete constraints and targeted curiosity. Instead of asking for categories, ask for one specific person and story; instead of asking for adjectives like “simple,” ask for numeric limits; instead of asking for prose, ask for a toy example with actual values. The chapter also shows how to make a whole repository pasteable by serializing relevant source files into one text dump, while filtering out noise such as dependencies, tests, build outputs, and binaries. That lets you ask end-to-end questions about how files connect, how training works, and what the important dependency chain looks like.
Because memory fades quickly, the chapter adds a learning-note routine: let AI draft a short outline, refine it in your own words, follow up on anything unclear, and quiz yourself until gaps become obvious. This active process turns a one-time chat session into lasting understanding and helps prevent “comprehension debt.” It ends by placing chat in context: chat is best for exploring a few files deeply, workflows are better for repeating the same task across many files, and agents are better when you want the tool to decide its own next step. Each approach has limits, and the right one depends on whether you need depth, scale, or autonomous action.
Paste code, get a generic wall of text. Follow up on the one line that surprises you. Constrain the output with numbers instead of adjectives. Write a learning note to prevent forgetting.
Paste the files relevant to your question. A question about a single file's internals needs only that file. An end-to-end question needs the whole pipeline. A deployment question needs infrastructure files.
A vague question gets a vague answer. Ask "what are the features?" and the AI fills the board with fancy-sounding categories that leave you no wiser; ask it to trace one real story end-to-end, or to prove a claim with a toy example and actual numbers, and the same model finally makes it click.
Fifteen cluttered nodes, emojis, tensor shapes, and multi-line labels that overwhelm the reader.
"At most 10 nodes, 2-4 words each" produces 9 clean nodes that a beginner could memorize in 60 seconds.
From shallow to deep learning: passive reading (base), active questioning (climb), and building (summit). The learning note here is an example of the "climb" stage.
The learning note cycle: skeleton from AI, follow-up questions, rewrite in your own words, then self-quiz. Each round sharpens the note and deepens your understanding.
Chat explores deeply but only a few files at a time. A workflow asks the same question across every file and generates documentation. An agent takes that documentation as a map and decides which file to read next. Each tool's weakness is the next tool's strength.
Summary
- Start with a single file, a single question, and a follow-up. Your first prompt will be simple. The initial answer is often generic, but a good follow-up question can reveal design choices you wouldn't discover by just reading the code.
- Choose your files carefully. While a short script can serialize a repo into a single pasteable file, including irrelevant code not only dilutes the answer but can also actively mislead the model.
- Frame your questions precisely. How you ask matters more than the model you use. Ask for specific formats: "stories" (sequences of events) instead of "categories," "numbers" instead of "adjectives," and "toy examples" instead of abstract prose.
- Document what you learn immediately. You'll forget two-thirds of new information within 24 hours. Counter this "forgetting curve" by creating a learning note, iterating through cycles of outlining, asking follow-up questions, rewriting answers, and quizzing yourself.
- Treat chat as your first step. Chat mode, where you manually paste files and guide the conversation, doesn't scale for large codebases. However, the manual effort forces you to think deeply, which builds understanding. This makes it ideal for your initial learning reps. Later, you'll move to Workflow mode, which automates repetitive tasks, and Agent mode, which explores independently, often using Workflow output as its guide.
Crack Any Codebase with AI ebook for free