Coding · Explain Code

Add Helpful Comments to Code for Beginners

Get your code back with clear notes on every section, so you or a learner can follow it later.

Prompt Code output

Please add comments to this [LANGUAGE] code so that a beginner can follow it: [CODE]. The person reading it later will be [READER]. Do not change how the code works; only add comments. Put a short note at the top explaining what the whole file is for and how to run it. Above each block, add a comment that says what it does and why, in simple words. Mark the places where someone would usually change values, such as file names, dates or amounts, with a clear note like CHANGE THIS. Keep comments short and friendly, and avoid stating the obvious on every single line.

Fill in the brackets

[LANGUAGE]
e.g. Python, JavaScript, Google Apps Script
[CODE]
Paste the code you want commented
[READER]
e.g. me in six months, my teenage son learning to code, a colleague with no coding experience

How to use

  1. Copy the prompt.
  2. Replace the text inside [BRACKETS] with your own details.
  3. Paste it into ChatGPT or another AI assistant.
  4. Read the result and ask for changes if needed.

Tip: Compare the commented version with your original to make sure only comments were added before you save it.