Prompt Engineering
How to get useful, reliable answers from AI language models: what a model does with your text, how to write clear instructions with the right context and examples, how to ask for structured output, how to test and reuse prompts, and how to use them safely at work and in software.
18 pages 94 glossary terms AWS AI Practitioner
How to use this topic
The first seven pages cover the basics: what prompt engineering is, how a model reads a prompt, the parts of a good prompt, clear instructions, context, roles and system prompts, and examples. The next six make prompts dependable: structured output, reasoning, prompt chaining, reducing hallucinations, testing and templates. The last five apply it: prompts for IT work and for code, prompts inside applications, context engineering and agents, and prompt security.
Most pages have a Try it yourself box: two or more prompts to paste into an AI assistant such as Claude, ChatGPT, Microsoft Copilot or Gemini, with what to look for in the answers. Model answers differ from run to run, so the pages never show them as fixed output. The prompts use made-up data; never paste confidential or personal information into a public AI tool. The background — what language models are and how they are trained — is in Artificial Intelligence.
There is no established certification for prompt engineering alone. Pages marked AWS AI Practitioner cover the prompt-engineering objectives of the AWS Certified AI Practitioner exam (AIF-C01), which the Artificial Intelligence topic also follows.
Learning path
- 01What Is Prompt Engineering?What prompt engineering is, why the wording of a request changes what an AI model gives back, and where good prompting stops helping.
- 02How a Model Reads Your PromptTokens, the context window and next-token prediction: what a language model actually does with your text, and why that makes phrasing, order and length matter.
- 03Anatomy of a Good PromptThe building blocks of a prompt that works: the task, context, input, output format, examples and constraints, and how to put them together.
- 04Clear and Specific InstructionsWriting instructions a model cannot misread: being specific, naming the audience and length, saying what to do instead of what not to do, and explaining why.
- 05Giving Context and Reference MaterialGiving a model the documents, data and background it needs, marking them off clearly, and telling it to answer from that material only.
- 06Roles and System PromptsWhat a role or persona in a prompt does and does not do, the difference between system and user prompts, and how to write standing instructions.
- 07Zero-Shot, One-Shot and Few-Shot PromptingWhen a prompt needs examples, how many to give, and how to choose examples that teach the pattern instead of being copied.
- 08Structured OutputAsking for JSON, tables and fixed formats, describing the shape with a schema, and checking in code that the answer really has that shape.
- 09Reasoning: Step by Step and Thinking ModelsLetting a model work through a problem before answering: chain-of-thought prompting, reasoning models with built-in thinking, and when extra reasoning does not help.
- 10Breaking Down Tasks: Prompt ChainingSplitting a large job into a chain of smaller prompts, passing results from one step to the next, and checking each step before going on.
- 11Reducing HallucinationsWhy models state wrong things confidently, and the prompting habits that reduce it: grounding in sources, allowing "I don't know", asking for quotes and verifying the answer.
- 12Iterating and Testing PromptsImproving a prompt on evidence instead of gut feeling: test sets, success criteria, comparing versions and catching regressions when a prompt or model changes.
- 13Prompt Templates and ReuseTurning a prompt that works into a reusable template with variables, keeping prompts in version control, and sharing them in a team.
- 14Prompts for IT WorkPractical prompts for everyday IT tasks: tickets, log analysis, runbooks, documentation, status updates and screenshots — and what to check before you use the answer.
- 15Prompting for CodeGetting useful help with code: describing the task, environment and constraints, asking for reviews and explanations, debugging with error messages, and checking what you get.
- 16Prompts in Applications: the APIHow prompts work inside software: messages and roles in an API request, parameters such as temperature and maximum tokens, tool use and structured outputs.
- 17Context Engineering and AgentsManaging everything a model sees, not just the prompt: retrieved documents, tool results, memory and conversation history, and writing instructions for AI agents.
- 18Prompt Security and Responsible UseKeeping prompts safe: defending against prompt injection, keeping secrets and personal data out of prompts, company rules, and the myths about magic phrases.
Prompt Engineering glossary
Short definitions of the terms used in this topic. The full glossary covers every topic.