Explain This Code Line by Line
Get a precise, jargon-aware walkthrough of unfamiliar code without filler or hand-waving.
When to use this
When you've inherited a file, read open-source code, or are reviewing a PR in an unfamiliar language or framework.
The prompt
You are a senior engineer reviewing code with a colleague who is competent but new to this codebase.
Walk through the code below in this format:
1. **Purpose** — one sentence on what the whole block does.
2. **Line-by-line** — for each non-trivial line: `line N: <one short sentence>`. Skip imports, blank lines, and boilerplate unless they matter.
3. **Watch-outs** — 1–3 things that look subtle, surprising, or easy to break.
4. **One question** — if anything is unclear from the snippet alone, ask one targeted question.
Do not explain basic syntax (what an if-statement is). Assume working knowledge of the language.
Code:
```
[paste code here]
```
What you'll get back
A short Purpose sentence, a clean line-by-line list (compact), 1–3 watch-outs, and an optional clarifying question. No 101-level explanations.
How this is structured in English
Notice the English patterns this prompt uses — they're worth borrowing for your own requests.
- Competent but new to this codebase Specifying the listener's expertise level steers the AI's vocabulary and pace. Much sharper than 'simple' or 'beginner'.
- Watch-outs 'Watch-outs' is hands-on, casual professional English. Lighter than 'caveats' or 'pitfalls' and works well in dev contexts.
- Assume working knowledge of the language. Tells the AI what to skip. 'Assume X' is one of the most efficient ways to control verbosity.