Before prompt engineering

This guide assumes that you have:

  1. A clear definition of the success criteria for your use case
  2. Some ways to empirically test against those criteria
  3. A first draft prompt you want to improve

If not, we highly suggest you spend time establishing that first. Check out Define your success criteria and Create strong empirical evaluations for tips and guidance.

Prompt generator

Don’t have a first draft prompt? Try the prompt generator in the Anthropic Console!

When to prompt engineer

This guide focuses on success criteria that are controllable through prompt engineering. Not every success criteria or failing eval is best solved by prompt engineering. For example, latency and cost can be sometimes more easily improved by selecting a different model.

How to prompt engineer

The prompt engineering pages in this section have been organized from most broadly effective techniques to more specialized techniques. When troubleshooting performance, we suggest you try these techniques in order, although the actual impact of each technique will depend on our use case.

  1. Prompt generator
  2. Be clear and direct
  3. Use examples (multishot)
  4. Let Claude think (chain of thought)
  5. Use XML tags
  6. Give Claude a role (system prompts)
  7. Prefill Claude’s response
  8. Chain complex prompts
  9. Long context tips

Prompt engineering tutorial

If you’re an interactive learner, you can dive into our interactive tutorials instead!