Best Practices for Building LLM Apps

Chapter 1 · Practice 3 of 4

Keep prompts in version control and tag every call with the prompt version

From Prompt design and structured output

Why it matters

A prompt is code. When quality drops, you need to know whether the prompt, the model or the input changed, and that is only possible if prompts have a history.

  1. Store each prompt in the repository.
  2. Review changes in pull requests, like any other code.
  3. Give each version an id.
  4. Log that id with every model call.

Avoid editing prompts directly in a production dashboard with no history. If non-developers need to tune wording, give them a workflow that still produces a versioned change and runs your evals before it ships.