A prompt for explaining what code does
Copy this into ChatGPT, Claude, Gemini or any other AI. It is the professional version of a request most people type in a few words.
1What most people type
“explain what this code does”
2The professional prompt
I'd like you to explain what the code below does. I'll paste it at the end of this message. Please start with one or two sentences summarizing its overall purpose, then walk through it in logical order, section by section or function by function, describing what each part does and how the parts fit together. Mention the inputs it expects and the output or side effects it produces. If anything looks unusual, risky, or likely to be a bug, point it out briefly.
I'm not sure how much programming background to assume, so please use plain language, explain any technical terms the first time they appear, and keep the explanation as short as clarity allows. If you can't tell what the code is meant to do because it depends on something not shown, such as an external library, a file, or other parts of the program, say so and state your assumption instead of guessing. If the language or my goal for understanding it is unclear, ask me before you begin.
[paste the code here]
Before you use it, replace each [highlighted part] with your own details.
Why this version works
- A short summary first lets you grasp the purpose before the details.
- Asking for inputs, outputs and side effects tells the AI what to cover.
- Telling the AI to flag assumptions stops it from confidently guessing at missing context.
- The placeholder reminds you to paste the code, which the AI needs to answer.
Make it even better
- Paste the full code you want explained, including any imports or helper functions it depends on.
- Say what programming language it is and how much experience you have, so the explanation fits your level.
- Describe what you hope to learn, such as the overall purpose, a tricky line, or why it was written that way.
Free · no sign-up
Need something different?
Say what you want in your own words and the Prompt Translator writes the professional prompt for you.
More prompts for coding
This prompt was written by an AI through our Prompt Translator, exactly as a visitor would get it. Read it and adjust it before you use it. See the whole prompt library.