Artificial Intelligence (AI) · Intermediate level

Intermediate level · Module 3: Prompt Engineering · Lesson 1 of 3

Structuring Prompts

Write prompts with clear roles, instructions, context and output requirements.

In this lesson you will

  • Structure a prompt into its parts
  • Write precise instructions and constraints

Key concepts

role and instructionscontext and delimitersconstraintsoutput format

The lesson

A well-structured prompt states the role ('You answer questions about school registration for parents'), the task, the rules ('Use only the provided documents'), the context and the output format.

Separate instructions from content with clear markers, such as headings or tags around documents, so the model does not confuse a document's text with your instructions.

Be specific about what to do when information is missing: 'If the documents do not contain the answer, say you do not know and suggest contacting the school office.'

Step by step

  1. Write a first structured prompt for the FAQ assistant.
  2. Separate instructions and documents with markers.
  3. Add rules for missing information.
  4. Test it on five questions.

Practice activity

Write version 1 of the FAQ assistant prompt.

Expected result: A structured prompt tested on five questions.

Check your understanding

  1. Why separate instructions from documents with markers?

    Show answer

    So the model does not treat document text as instructions.

  2. What should a prompt say about missing information?

    Show answer

    What the assistant should do when the answer is not available.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.