OpenAI prompt-engineering best practices
Guidance on clear instructions, delimiters, desired format, and reducing ambiguity in model requests.
Compute College
Write direct AI instructions with priorities, boundaries, edge cases, and constraints that reduce ambiguity without creating a brittle prompt.
Clear instructions tell a model what operation to perform, what order to follow when requirements compete, and what to do when the input is incomplete or outside scope. Constraints define boundaries such as allowed sources, output length, prohibited actions, required fields, or when to ask for clarification. Good constraints make the intended behavior easier to test; they do not attempt to enumerate every sentence the model might ever see.
Memory trick: Clear instructions define the lane. Constraints define the guardrails. Fallbacks define what happens when the road ends.
Ambiguous or conflicting instructions create inconsistent outputs and make failures difficult to diagnose. Overly long instruction blocks can also consume tokens, introduce contradictions, and leave less room for the information needed for the current task. A short hierarchy of priorities and explicit edge-case behavior gives the model a narrower decision surface and gives reviewers a stable contract.
For a support triage workflow, write: “Classify only the customer’s current request. Use the ticket text and the policy excerpt provided below. If the policy does not answer the question, return `needs_human_review`; do not invent a policy. Return one category, one-sentence rationale, and the supporting quote.” The instruction defines scope, source authority, the fallback, and output requirements.
Example figures are illustrative calculations, not current quoted market prices.
Current example
Prompt guidance from OpenAI and Google emphasizes specific instructions, relevant context, explicit output requirements, and breaking complex work into manageable steps. The implementation details vary by model and API, so test the behavior under the provider and mode you intend to use.
Guidance on clear instructions, delimiters, desired format, and reducing ambiguity in model requests.
Guidance on specifying tasks, breaking down complex prompts, and using examples to clarify behavior.
Source discipline: instruction techniques are not safety guarantees. Validate outputs, enforce permissions in code, and keep untrusted text separate from governing instructions.
A wall of absolute rules often creates contradictions: never do this, always do that, except when another rule applies. The team may not know which behavior to expect. Use a small priority order, explicit fallback states, and deterministic checks for rules software can enforce.
Practical takeaway
Rewrite one prompt into four blocks: task, priorities, constraints, and fallback behavior. Add two edge cases that should fail safely, then compare the revised prompt with the old version on the same test set while recording output tokens, retries, and accepted-task rate.
Decision check: does the prompt state what takes priority, what is out of scope, and what happens when the required evidence is missing?
Compute College track
Step 4 of 18: Clear instructions and constraints