Skip to content

Writing a good prompt

A good prompt includes the topic (what to explain), the audience (who's learning and what they already know), and the slide types (how the lesson should show things). Depth comes mainly from the teacher you pick, though the prompt can amplify it.

That's the whole model. You don't design the lesson, since Explain decides the structure and layout. All three parts fit in one sentence:

why a closure keeps a variable alive after the function returns, for someone coming from Python, with a diagram of the scope chain

Topic can be a single word, but a question beats a word because it says what you're stuck on. closures gets a general lesson; the prompt above gets a lesson about your actual confusion.

Audience is the part people skip. Saying what you already know matters as much as saying what you don't, as in ...I understand the syntax, it's the "why" I'm missing, so the lesson skips what would bore you.

Slide types are the layout control you have: diagrams for structure, animations for processes, diffs for changes, a quiz to check yourself. And you can be specific about what a slide should do, not just which type it is:

...use pointer references heavily when explaining the code...animate a graph with arrows pointing at the inflection points

The line is between what to show (yours) and where it sits on the slide (Explain's).

This is also how you push depth beyond what the teacher gives you. The teaching style sets the baseline, but the prompt can demand more:

...use the pointer to highlight every line of code and explain each one in detail, don't skip any

Image style

Explainers with image slides pick one art style for the whole lesson, and you can name it in the prompt. Ask for hand-drawn and the lesson looks like a sketchbook; ask for photorealistic and it looks like a documentary:

...hand-drawn illustrations, like a sketchbook
A hand-drawn illustration of the Library of Alexandria
docs.scrimba.com
...photorealistic images, like a documentary
A photographic server room at night
docs.scrimba.com

Whatever style you name (watercolor, pixel art, blueprint) applies to every image in the lesson, so it plays like one film.

Context

The other half of a good prompt is what you give it to teach from. By default Explain teaches from its own knowledge; the more context you hand it, the more the lesson is about your thing instead of the general topic. Paste code straight into the prompt, attach documents such as a spec, an article, or your notes, or use a coding agent, which has your whole repository as context.

And a bare topic is still a fine prompt. Watch the lesson, see what's missing, and make the second prompt the precise one.