Setup loaded. Click Generate Explanation Prompt.

Coding Workflows

Code Explanation Prompt

"Explain this code" gets line-by-line narration. Pick an explanation mode, an audience, and a learning depth — and get an understanding contract: six explanation strategies with different educational objectives, audience profiles that change the assumptions (not just the wording), and an honesty rule where intent is labeled as inference, never narrated as fact. Runs entirely in your browser.

What code, explained for what purpose? E.g. "Explain the order processing module to a developer who joined this week."

Explanation Mode

Each mode is a different educational objective with its own strategy, flow, and learning notes.

Audience

The audience changes the assumptions: a senior gets rationale, a manager gets behavior and risk.

Learning Depth

Deep Dive demands rationale, tradeoffs, and alternatives — and forbids fabricated design stories.

What the system is for — the context "explain this code" always loses. One or two sentences.

Paste it and the prompt carries it verbatim in a fenced block — or leave empty for a paste-here placeholder.

Explanation Preview (live — the contract's shape, not the output)

            

AI Resource Library

Resources for this tool

View All Resources →
Engineering

Explain a Regex

Build a prompt that breaks a regular expression down piece by piece in plain language — what it matches, what each part does, and what it rejects.

View Resource →

Workflow Playbooks

Playbooks that use this tool

All Playbooks →
Coding Workflows · 5 steps

AI Code Review Workflow

A complete AI-assisted review pass — not one prompt — that ends with ranked findings, tests guarding behavior, and a refactor plan when one is warranted.

View Playbook →
Coding Workflows · 5 steps

AI Debugging Workflow

The order that actually finds bugs instead of guessing at them — so you end with a verified fix, not a plausible one that quietly returns next week.

View Playbook →
Coding Workflows · 4 steps

AI Production Incident Workflow

Work a live production incident in the right order — triage and stabilize first, then find the cause, then write the summary and postmortem — so the fire is out before the writeup begins.

View Playbook →
Documentation Workflows · 3 steps

AI Code Documentation Workflow

Generate documentation that matches the code instead of drifting from it — have AI explain what the code really does, write it up as structured docs, then validate the format holds.

View Playbook →

How it works

State the explanation objective, pick the mode — High-Level Overview, Function Walkthrough, Architecture Explanation, Legacy Code Analysis, Algorithm Breakdown, or Beginner Friendly — and choose the audience and learning depth. Each mode is a different educational objective with its own strategy, execution-flow treatment, and learning notes; each audience changes the assumptions, not the wording — a senior developer gets rationale instead of narration, a technical manager gets behavior and risk with minimal code. Optionally add the business context that "explain this code" always loses, and paste the code itself (carried verbatim in a fenced block). The live Explanation Preview shows the contract's shape. Click Generate Explanation Prompt for the full understanding contract: strategy, key concepts, execution flow, design decisions, an assumptions discipline where intent is labeled as inference, tradeoffs scaled to the chosen depth, and learning notes. Nothing leaves your browser.

Use cases

  • Turning "explain this code" into a structured understanding contract
  • Onboarding a new team member into an unfamiliar module
  • Decoding legacy code whose authors and documentation are gone
  • Breaking down an algorithm with complexity and tradeoffs

Pro tips

  • Fill the Business / System Context field — it's the single highest-leverage input. "Explain this code" fails mostly because the model has no idea what the system is for; two sentences fix that.
  • Match the audience honestly. Sending a senior-developer explanation to a junior loses them; sending a junior explanation to a senior wastes their time. The contract calibrates every section to the audience you declare.
  • Use Legacy Code Analysis when names and comments can't be trusted — its strategy explicitly walks the actual behavior, not the apparent one, and treats oddities as evidence of forgotten requirements.
  • Read the ASSUMPTIONS and open-questions parts of the answer first. An explanation that admits what it cannot determine from the code is far more trustworthy than one that tells a smooth, complete story.

FAQ

Does this tool explain my code?

No — it builds the contract. The output is a prompt that tells an AI how to explain: which strategy to follow, what the reader already knows, how deep to go, and how to handle what it cannot determine. The flagship is the audience-aware system: the same code explained for a junior developer, a senior developer, and a technical manager produces three genuinely different explanations, because the assumptions differ — not just the tone.

Why is "explain this code" a weak prompt?

Because it produces line-by-line narration: a restatement of what the code visibly does, with no business context, no architecture context, and no learning value. The contract replaces narration with an educational objective — purpose and system role for an overview, contract and side effects for a walkthrough, likely intent and hidden assumptions for legacy code — plus an audience profile so the explanation lands at the right level.

How is this different from the Code Review Prompt Generator?

Different verbs. Review JUDGES — it asks "what is wrong?" and produces findings with severities. Explanation TEACHES — it asks "how does this work and why?" and produces understanding. The contract's non-goals state it directly: no findings, no severities, no verdicts. And in this category: Debugging investigates failures, Refactor transforms code, Test Case validates it — Explanation understands it.

What if the code I'm explaining looks buggy?

The contract tells the model to note it as a question for the team — and stop there. Investigating a failure is the Debugging Prompt Generator's job; explaining behavior is this tool's. The same discipline applies to legacy oddities: a strange special case is treated as evidence of a forgotten requirement, inferred carefully and labeled as an inference, never "fixed" in the retelling.

What does the audience selection actually change?

The assumptions. Junior: syntax is known, patterns and terms are not — everything defined on first use, concrete examples required. Senior: anything readable from the code is assumed understood — the explanation spends itself on rationale, constraints, and fragility, and is forbidden from line-by-line walking. New team member: strong engineer, zero codebase context — conventions and domain vocabulary explained like an onboarding buddy would. Technical manager: behavior, responsibilities, risks — minimal code, and what code appears gets translated into a business statement.

What makes Deep Dive different from Detailed?

Rationale. Detailed covers behavior and structure thoroughly. Deep Dive additionally demands, for every significant design decision: the rationale, the tradeoffs accepted, and at least one alternative approach with why it likely lost — plus the assumptions the design rests on and what breaks if they stop holding. And it carries the honesty rule that keeps it trustworthy: where rationale cannot be recovered from the code, say so — do not fabricate a design story.

Can I use this to write documentation?

To prepare for it, yes — the Documentation Preparation preset exists exactly for that: explain the subsystem thoroughly enough that its documentation could be written from the answer. But generating the documentation itself — README structure, API docs, changelogs — is the Markdown Output Builder's space. Explanation produces understanding; the Markdown Output Builder structures documents.