Kavvo Prompts

Code Explainer Prompt

November 29, 2026 · 3 min read · By the Kavvo Prompts team

What this prompt does

This prompt explains a piece of code in plain English, line by line, so you can understand code you did not write — or code you wrote months ago and have forgotten. It is designed for learners and for anyone picking up someone else’s project. The prompt asks the model to start with a one-sentence summary of what the code does overall, then explain each part in order, then name any tricky parts and what could go wrong.

The prompt

Act as a patient programming teacher who explains code in plain English.

Explain this code. I want to understand what it does, not just what each line says.

Programming language: [LANGUAGE, e.g. "Python"]
My level: [YOUR LEVEL, e.g. "I am learning Python and know the basics"]
What I already know: [WHAT YOU UNDERSTAND, e.g. "I know what a loop is, but not what a dictionary is"]

Code:
```
[PASTE YOUR CODE HERE]
```

Explain it in this structure:
1. What it does: one or two sentences saying what the code achieves overall.
2. Line by line: go through the code in order. For each important line or block, say what it does in plain English. Group short lines together where it helps.
3. Tricky parts: name any line or idea that is easy to misunderstand, and explain it with a simple example.
4. What could go wrong: 2-3 things that could break or behave unexpectedly, and what to look for.
5. One-sentence summary: what the code does, in your own words, so I can test my understanding.

Rules:
- Use plain English. Explain any technical term the first time you use it.
- Do not rewrite the code unless I ask. Explain the code I gave you.
- Keep the whole explanation under [WORD COUNT, e.g. 500 words].

Which model

Written for both ChatGPT and Claude. Paste it as one message, including the code. Claude is often stronger at explaining code clearly and catching edge cases; ChatGPT is also strong, especially for common languages.

How to use it

  1. Copy the prompt into ChatGPT or Claude as one message.
  2. Paste your code inside the code block where indicated. Paste the real code — a description of it will not work.
  3. Fill in the language and your level. “I know what a loop is but not what a dictionary is” helps the model pitch the explanation right.
  4. Send it and read the explanation in order. If one part is still unclear, ask about that part on its own.
  5. After reading, try the final test: explain what the code does in one sentence without looking. If you cannot, re-read the tricky parts.

Example

Input: A short Python function that takes a list of numbers and returns the average, with a check for an empty list. Level: learning Python, knows the basics.

Tips

    • Paste one function at a time. A whole file in one prompt gives you a shallow explanation of everything instead of a clear explanation of one thing.
  • If the explanation uses a word you do not know, ask what it means before moving on.