Your bookmarks

Loading your bookmarks

Latest updates

New courses, skills, book chapters, and site improvements will appear here.

Create free accountSign upDashboardDashboard

Prompt engineering

  • Context
  • Standard term
2 steps

Prompt engineering is writing and testing the instructions you give an AI, so they state the outcome you want, supply the facts or files it needs, set any hard limits, and specify the answer's format.

A model answers from what the prompt and its attachments give it, plus general patterns it learned in training. Anything you leave out, such as who will read the answer or which details you care about, it fills with a typical guess, which is why a vague prompt gets an answer that could fit anyone.

Where you’ll meet it

You paste two apartment leases into a chat and ask which one is better. The answer praises both, recommends the cheaper one, and never mentions that it charges two months' rent for leaving early.

What to do

Tell it what you're deciding and which terms you care about, such as rent increases, early-exit fees, and notice periods. Ask it to quote the clause behind each point and to lay the comparison out as a table. Save the prompt for the next lease you compare.

Easy to mix up

In context engineering, an app gathers the files, past messages, and notes the model reads with each request. In prompt engineering, you put that together yourself, in the text you type or paste.

Check yourself

You add five sample descriptions to a prompt that writes product descriptions. Afterward, every new description opens with a question and ends with an exclamation mark. What should you change first?

Go deeperA prompt tuned for one model can misfire on the next

OpenAI's prompting guidance advises starting with a short prompt that states the goal and context, then adding instructions, examples, or tools such as web search only when test runs show a gap. Anthropic's warns that emphatic rules written for older models can make newer ones overreact, and both labs advise retesting inherited prompts after a model upgrade.

Testing a prompt works like an eval, a repeatable test of an AI system, with a fixed set of typical cases run against each version and the outputs compared. A wording change can look better on two or three cases by chance, so it stays only when the improvement holds across the set.

Practice Modern AI

Or take the learning quiz on a mix of every set