Explain unfamiliar code before you change it
Dropping into a legacy module, a third-party dependency, or a teammate's pull request means reading code with no context in your head. Developers now paste the function or file into a model and ask what it does and why — searching for answers (54%) and learning a codebase (33%) are among the most common AI tasks in the Stack Overflow survey. It is low-risk because you are reading, not shipping.
You are a senior engineer helping me understand code I did not write. I will paste a snippet; explain it so I can safely modify it. Language/framework: {{language}} Where this fits in the system: {{context}} Code: {{code}} Walk through: 1. Summary — what this code does, in two sentences. 2. Block by block — the purpose of each meaningful section, including any non-obvious language features or idioms. 3. Inputs, outputs, and side effects — what it reads, returns, mutates, or calls externally. 4. Assumptions and edge cases — what must be true for it to work, and where it would break. 5. Questions to verify — anything you are inferring rather than certain about. Rules: - Base every statement on the code I pasted. If behavior depends on code, config, or types I did not include, say it depends on something not shown instead of guessing. - Do not invent function names, libraries, or behavior that is not visible in the snippet. Flag anything ambiguous rather than resolving it silently. - Prefer plain language over jargon; when a term is unavoidable, define it once.
Fill in your details and the prompt updates live — then copy.
Summary: This function debounces calls to search() so it only fires 300 ms after the user stops typing, cancelling any pending call. Block by block: It keeps a timer id in a closure; each call clears the previous timer and schedules a new one, then forwards its arguments via ...args when the timer fires. Side effects: sets and clears a timer; calls search() with the latest arguments only. Assumptions: relies on a single shared timer variable in the enclosing scope. How search handles errors depends on code not shown. Questions to verify: is search async? If so, overlapping resolutions are not handled here.
The full workflow
- Paste only code you are allowed to share; strip secrets, keys, and internal identifiers first
- Give the model the surrounding context (framework, where it runs) so the explanation is accurate
- Read the explanation against the code and resolve every not-shown or ambiguous flag yourself
- Confirm your understanding by running or stepping through the code before you change it
Watch out for
Never paste proprietary source, credentials, API keys, or customer data into a consumer AI account — it may be retained and used to train the model. Samsung banned consumer ChatGPT in 2023 after employees leaked internal code, and surveys find most employees still paste company data in. Use an enterprise tier with training disabled, or share only non-sensitive snippets.
The model explains code confidently even when it is guessing about parts you did not show. Treat any behavior that depends on unseen code, config, or types as unverified until you check it yourself.
An explanation is not a test. Confirm behavior by running or stepping through the code, not by trusting the summary.
Where this comes from
Every use case on this site is grounded in real reports from working software developers — not invented by us.