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.