Lesson 1 of 2 Prompt Engineering and Prompt Libraries

Writing Prompt Engineering Guidelines

This lesson explains the elements of effective prompts and the techniques that improve them.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the goal, context, expectations and source elements.
  • Explain common prompt engineering techniques.
  • Explain how prompt principles apply to agent instructions.

Elements of an effective prompt

Microsoft's guidance for Copilot users describes four elements of a good prompt: the goal (what you want), the context (why you want it and who it is for), the expectations (format, length and tone) and the source (which information to use, such as a specific file or email). A prompt such as summarize this leaves the model to guess three of the four. A prompt such as Summarize the attached contract for a sales manager who must decide whether to renew; list the renewal date, price changes and termination terms as bullet points gives all four.

For system prompts and agent instructions, which the user does not see, the same elements apply at a higher level: the agent's role, its audience, its scope and limits, the order in which it should work, and the format of its responses.

Techniques

Several techniques improve reliability. The following list describes those that business guidelines should cover.

  • Be specific and positive: say what to do, not only what to avoid. Respond in three bullet points works better than do not be long.
  • Provide examples (few-shot prompting): one or more input and output pairs show the expected format and judgement more precisely than a description.
  • Separate instructions from content: use delimiters or headings so that the model distinguishes the task from the document it works on, which also reduces the risk of instructions hidden in content.
  • Ask for steps: for complex tasks, ask the model to work through steps or to check its answer against criteria before responding.
  • Specify the output format: a table, a JSON structure or a fixed template makes output usable by downstream tools.
  • Ground and restrict: instruct the model to answer only from the provided sources and to say when the answer is not available.
  • Iterate: refine prompts against a set of test inputs, changing one element at a time.

Instructions for agents

Agent instructions in Copilot Studio and Foundry are prompts that run on every turn, so their quality affects every conversation. Good instructions describe the agent's purpose and audience, list the steps it should follow, name the tools and knowledge it should use in each situation, define escalation and refusal behaviour, and set the response style. In Copilot Studio, instructions can reference tools, topics and knowledge sources by name, which helps the orchestrator choose them. Descriptions of tools and topics are also prompts in effect, because generative orchestration selects components from them.

Guidelines should also tell users and makers what not to put in prompts: secrets, personal data that the task does not need, and requests that the organization's acceptable use policy forbids. Output always needs human review in proportion to its impact.

Worked example

Improving an underperforming prompt

A Copilot Studio prompt summarizes customer complaints for a weekly management report. Managers say the summaries vary in length, sometimes include customer names, and miss the product involved. The current prompt is: Summarize these complaints. What changes should you recommend?

The prompt lacks context, expectations and explicit rules. The improved prompt states the audience (product managers), the required structure (a table with product, issue category, count and a one-sentence example), the length limit, and a rule to exclude customer names and contact details. Adding one example of the expected output fixes the format, and separating the complaint text from the instructions with a clear delimiter prevents complaint wording from being read as instructions. The revised prompt is then tested on several weeks of real complaints before it replaces the original.

Check yourself

Which four elements does Microsoft's guidance describe for a good Copilot prompt?

Show answer

Goal, context, expectations and source: what you want, why and for whom, the format and tone, and which information to use.

Exam Tips

Remember for the exam

  • A good prompt states the goal, context, expectations and source.
  • Use examples, delimiters, explicit output formats and grounding instructions.
  • Agent instructions and component descriptions are prompts that run on every turn.
  • Test prompt changes against a fixed set of inputs, one change at a time.