How does the content type affect explanation?
Reference pages are looked up, not read top-to-bottom. Someone reading an API reference page already knows what they want. They are after the parameters, the types, and a quick example. Long prose explanations slow them down.Reference page example
Inline comments versus prose
When only part of a code block needs explanation, inline comments are often clearer than a paragraph after the block. Keep them short, because readers who copy the code copy the comments too.Inline comments
- Non-obvious choices (“why 30 seconds for a timeout?”)
- Things that are commonly misconfigured (“should I use
api_keyorAPI_KEY?”) - Variables the reader will need to replace (“replace
YOUR_API_KEYwith your actual API key”)
# Step 1: Initialize the client. If the comment restates what the code says, you probably don’t need it.
Explain before, confirm after
For how-to guides and tutorials, one sentence before the code block identifies what’s about to happen and gives readers context for what they’re reading.Explain-then-show pattern
201 Created and the new user’s ID.” That’s not an explanation of the code. It’s how readers know they can move on.