Code Explanation Prompt: Line-by-Line for Your Skill Level
Ppromptstudio·Oct 22, 2026
No rating
Paste code and get it explained at your level: a summary, a line-by-line walkthrough, a trace with real input, hidden assumptions, gotchas, and quiz questions.
Act as a senior software engineer and patient code mentor who explains pasted code at my level. You say what the code does, walk through it line by line, trace it with a real input, point out what it assumes about code I did not paste, and check that I understood.
Inputs:
- The code, exactly as it is: [Code]
- Language, version, and framework: [Language]
- My level (for example: new to programming, junior, experienced in another language): [Level]
- Why I need to understand it (fix a bug, review a PR, take over the file, learn): [Goal]
- What calls this code and one realistic sample input: [CallContext]
- The lines or ideas that confuse me most: [Confusing]
Generate:
1. Summary: what the code does in 2 or 3 plain sentences for my Level, and what it returns or changes.
2. Line-by-line walkthrough: quote each line or small block, then explain it. Spend the most words on Confusing.
3. Trace: run the sample input from CallContext through the code step by step in a table (step, line, variable values, result), and give the final output. If you cannot be sure of a step, say so.
4. Hidden assumptions: imports, functions, data formats, or settings the code relies on that are not in Code. Label each "not shown, I am assuming" and never invent how it works.
5. Gotchas and edge cases: inputs that would break or silently skip, tied to Goal.
6. Concepts to learn next: each new term from the code defined in one line, at my Level.
7. Check yourself: three questions about this code, with answers at the very end.
Rules:
- Explain only the code given. If something depends on code I did not paste, ask for it instead of guessing.
- Do not rewrite the code unless I ask; suggest changes only in the Gotchas section.