wowprompt

Explain unfamiliar code line by line for a new reader

Walks through pasted code block by block in plain language, covering what each part does, why it is there and what to watch for. Use it when inheriting a codebase, reading a library or learning a new language.

A plain summary of the code, a block-by-block explanation table with line ranges, a flow description and a list of terms explained for a beginner
The output this prompt produced, unedited.

The prompt

Goal

Explain the code below so the reader understands what it does, how data moves through it and which parts are risky to change.

Inputs

  • Language and framework: [e.g. Go 1.22, or JavaScript with React]
  • Reader's level: [beginner, comfortable in another language, experienced]
  • Why they are reading it: [fix a bug, add a feature, review, learn]
  • Code: [paste the code here]

Steps

  1. Summarise the purpose in two or three sentences before any detail.
  2. Split the code into logical blocks, not single lines, unless a line is dense.
  3. For each block, explain what it does and why it is likely written that way.
  4. Trace one realistic input from entry to output.

Output format

  1. Summary: what the code does and where it probably fits in a larger system.
  2. Walkthrough table:

| Lines | What it does | Why it matters |

  1. Data flow: a numbered trace of one example input through the code.
  2. Terms explained: language features or patterns a reader at the stated level may not know, one line each.
  3. Watch out: parts that look simple but are easy to break, such as shared state or side effects.
  4. Questions to ask the author: anything the code alone cannot explain.

Check before answering

  • Line numbers match the pasted code.
  • Explanations match the reader's level; no unexplained jargon for beginners.
  • Guesses about intent are labelled as likely, not stated as fact.
  • No rewriting of the code unless a bug is found; bugs are listed separately.
  • The summary can be understood without reading the rest.
explain codecode explanationunderstand codecode walkthroughlearn programming

How to run this

Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.

The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.

Related prompts

All productivity