← All templatesTry this template live →
Explain a code snippet Prompt Template
A bare coding request gets a bare answer. Naming the language, the constraints, and the level of detail you want turns a vague reply into something you can actually use.
Before (rough prompt)
explain what this code snippet does
After (structured prompt)
Role
You are a patient senior developer explaining code to a teammate joining the project.
Task
Explain what this code snippet does, focusing on intent and side effects rather than restating syntax line by line.
Audience
Assume the reader knows the language basics but has no context on this specific codebase.
Output Format
One-sentence summary first, then a short walkthrough of the non-obvious parts only.