Prompt OpenAI Models with Evaluated Contracts
Design clear, versioned prompts for ChatGPT and API workflows, separate instruction authority from variable input, and improve behavior with controlled evaluations.
By the end
You will be able to
- Define success criteria and representative evaluation cases before tuning a prompt.
- Structure goals, authoritative instructions, context, examples, variable input, output contracts, and verification.
- Adapt prompting to the selected model and surface without hard-coding volatile guidance.
- Classify failures across prompt, context, model, tool, policy, and application boundaries.
Start from success evidence
Write the required outcome, target users, unacceptable behavior, output contract, representative cases, rubric, and pass threshold before changing prompt wording. Compare candidates against the same cases and configuration.
Prompt engineering cannot repair unavailable facts, missing permissions, a broken tool, unsuitable latency, or absent application validation. Classify the failed boundary before editing.
State the contract clearly and once
Describe the outcome, audience, authoritative context, hard constraints, allowed actions, approval boundaries, required evidence, output shape, and stopping condition. Use ordered steps only when order or completeness is a real requirement.
Avoid duplicated or conflicting instructions. Keep stable policy in the appropriate higher-authority instruction layer and put task-specific requests in the user input.
Separate context, examples, and untrusted input
Label authoritative references, examples, and variable user or retrieved content. Use clear delimiters or structured fields, and tell the workflow which evidence may support claims.
Prompt structure does not create security. Treat external text as untrusted data, enforce authorization outside the model, validate outputs, and never include secrets merely to make them available.
Goal: [OBSERVABLE OUTCOME]
Authoritative instructions: [POLICY + HARD CONSTRAINTS]
Trusted context: [APPROVED SOURCES]
Variable input (untrusted): [USER OR RETRIEVED DATA]
Examples: [RELEVANT, DIVERSE, SECRET-FREE]
Output contract: [SCHEMA OR REQUIRED HEADINGS]
Verify: [CLAIMS, CONSTRAINTS, POSTCONDITIONS]
Stop or escalate when: [BOUNDARY]Adapt with current model guidance
Model families can differ in reasoning controls, verbosity, tool behavior, and recommended prompt patterns. Use the current official model guidance for the configured model and evaluate changes rather than copying a static recipe.
Keep model identifiers and model-specific settings in reviewed configuration. Change one meaningful hypothesis at a time where practical and preserve the baseline for rollback.
Iterate and version from evidence
Run baseline and candidate across typical, edge, adversarial, and prior-failure cases. Record per-case rubric results, critical failures, latency, usage, cost, model, prompt, tools, and reviewer disagreement.
Classify each miss as instruction ambiguity, missing context, misleading example, output violation, model limitation, tool failure, policy boundary, or application defect. Add repaired failures to regression coverage.
Practice activity
Build and evaluate an OpenAI prompt contract
- Choose a recurring task and define at least four success criteria, one forbidden outcome, and an 80 percent pass threshold.
- Create six cases: three typical, one edge, one adversarial instruction-conflict case, and one prior failure.
- Write a prompt that separates authoritative instructions, trusted context, untrusted variable input, examples, output contract, verification, and escalation.
- Compare a baseline and candidate under identical settings, classify every failure boundary, and make a ship, revise, or reject decision.
What to produce
- A secret-free versioned prompt, rubric, and six-case suite with explicit trust and approval boundaries.
- A baseline-versus-candidate report with scores, failures, versions, latency and usage evidence, and a release decision.
Reflect before continuing
Which failed case required a system change rather than another prompt instruction?
Evidence
Sources and verification
- Prompt engineeringOpenAI · verified 2026-07-25
- Model guidanceOpenAI · verified 2026-07-25
- Evaluation best practicesOpenAI · verified 2026-07-25
- Developer quickstartOpenAI · verified 2026-07-25
Knowledge check
Make it stick.
Choose the strongest answer for each question. Your attempts become part of your device-local transcript.