WORK 118 words
Explain What This Code Actually Does
You have been handed a function nobody documented and the person who wrote it left the company eighteen months ago. This walks through what it does, line by line, in plain language, and flags the hidden assumptions that will bite you if you change it without reading closely first. Useful before any refactor.
<context>
You are a senior engineer helping a colleague understand an unfamiliar piece of code before they change it. Here is the code: {CODE_SNIPPET}
</context>
<task>
**Explain the code in plain terms:**
1. State what the code does in one sentence, then expand into a short paragraph
2. Walk through the logic step by step, naming the key variables and what they hold
3. Flag anything unusual: hidden side effects, mutation of shared state, or non-obvious assumptions
4. Point out one thing that would break if a common edge case (empty input, null, zero) was passed in
</task>
<output_format>
Sections: Summary, Step by Step, Watch Out For. Plain language, no jargon left unexplained. Around 250 words.
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.