Skip to main content

How to Structure a Prompt

Guide · about 7 min · refs checked 2026-11-03 (reference links and dates only)

"How to Ask AI" covers what to state before asking; this guide covers what shape to put it in: role, task, constraints, and format, written as separate blocks.

How to
Write in blocks, not one wall of prose: role and background in one block, the task in another, constraints in another, output format in another — models follow blocked instructions more reliably. Put standing rules (tone, boundaries) in the system prompt and the current task in the user message — each layer does its job; don't stuff one-off requests into the system prompt. Mark sections with headings or tags (e.g. "Background:", "Requirements:"), and on long inputs clearly separate the material to process from the instructions, so the model doesn't treat data as directives. Write constraints as checkable items: "under 300 words", "for absolute beginners", "cite sources" — these beat "shorter" or "more professional". Give the output format its own block plus one worked example: a single sample output beats three paragraphs describing it. Change one thing at a time when editing a prompt and compare results; change five at once and you can't tell which one worked.

Example and interpretation

A teaching scenario, not a measured or executed site test.

Use three blocks: source facts (Saturday 14:00, reading room, book exchange), constraints (no invented facts; unknown for missing facts), and format (title plus two sentences). An invented contact number violates the constraints block.

How to check your practice

Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.

For this topic, start with missing input · See all six scenarios and their reasoning

Sources
  • Anthropic Prompt engineering overview ↗
  • Anthropic Claude prompting best practices ↗
  • Google Gemini prompting strategies ↗
  • OpenAI Prompt engineering guide ↗