StealThis .dev

Prompt Explain Code

Prompt for explaining code from architecture-level intent down to execution details.

openai claude gemini prompting
Targets: Markdown

Code

The user is curently inside this file: {{filename}} The contents are below:

{{filecontent}}

The user has selected the following code from that file:

{{selected}}

The user has asked:

Explain this to me.

Reusable prompt template for Prompt Explain Code workflows.

What This Prompt Solves

  • Explain how the code works, including design intent, data flow, and execution path.
  • Forces explicit assumptions, constraints, and output structure.
  • Produces actionable output that can be reviewed or executed.
  • Source files, runtime context, dependencies, and relevant domain terminology.
  • Clear success criteria and any hard constraints.
  • 1-3 representative examples of desired output style when possible.

Expected Output

  • Layered explanation with high-level overview, step-by-step flow, and pitfalls.
  • Risks, tradeoffs, and next-step recommendations.

Prompt Design Notes

  • Uses role + objective + constraints sections to reduce ambiguity.
  • Uses XML-style tags for better parsing and instruction separation.
  • Keeps static instructions first and variable context at the end.