Prompt Design for LLM Developers: Basic Principles

AI Navigate Original / 5/16/2026

共有:

Key Points

  • App prompts require reproducibility, robustness, and verifiability
  • State role/constraints, specify output format, use few-shot examples
  • Separate user input as data; specify failure behavior
  • Version-control prompts and prepare regression tests for model updates

Prompt Design for Developers: Basic Principles

Prompts embedded in an app, unlike conversational prompts, require "reproducibility, robustness, and verifiability."

Basic Principles

  1. State role and constraints: fix what to do/not do at the top
  2. Specify output format: receive structure (JSON, etc.), not free text
  3. Examples (few-shot): stabilize behavior with good/bad examples
  4. Separate input and instructions: isolate user input as data (injection defense)
  5. Specify failure behavior: if unknown, have it return "unknown"

App-Specific Cautions

  • Version-control prompts (assets, like code)
  • Assume behavior changes with model updates; prepare regression tests
  • Long context degrades; trim to necessary and sufficient

Key Point

"Asking well" in conversation and "unbreakable instruction design" in apps are different things. This chapter covers the latter. Next we proceed to structuring, evaluation, and management.