Prompt Engineering Best Practices

Chapter 1 · Practice 2 of 4

Explain why a rule exists instead of only stating it

From Clear instructions and context

Why it matters

A bare rule gives the model one instruction. A rule with its reason lets it handle cases you did not list.

Anthropic's guide shows the difference with a formatting rule:

Less effectiveMore effective
NEVER use ellipsesYour response will be read aloud by a text-to-speech engine, so never use ellipses, since the engine cannot pronounce them

With the reason attached, the model can also avoid other things a speech engine would stumble over, such as tables or emoji, without being told about each one.

Apply this to every rule that matters:

  • "Keep answers under 80 words because they are shown in a mobile notification."
  • "Do not mention prices because they change daily and this text is cached for a week."

Avoid

  • Stacking capital-letter warnings in place of a one-line reason