GPT-5 Prompting (OpenAI)
Overview
Use this skill to produce prompts that are: unambiguous, testable, robust to edge cases, and aligned to the desired tradeoff between speed and reliability. Avoid hardcoding model IDs or limits; confirm current model names and features with $openai-docs when needed.
Prompt Pack (Use These Defaults)
System Message Template
Use a system message that defines role, priorities, safety bounds, and formatting constraints.
Required elements:
- Role: what the model is (and is not) responsible for.
- Output contract: exact format, sections, and any JSON schema constraints.
- Non-goals: what to avoid (guessing, inventing APIs, ignoring inputs).
- Clarification policy: what to ask if required info is missing.
Developer Message Template
Use a developer message for task-specific instructions, context, and constraints (without contradicting system).
Include:
- Task statement (1 sentence).
- Inputs provided and their meaning.
- Constraints and preferences (libraries, time, cost).
- Acceptance criteria (how you will judge success).
User Message Template
Make the user message concrete and data-heavy:
- Provide examples (good and bad).
- Provide edge cases.
- Provide “definition of done”.
Workflow: Draft -> Test -> Patch
- Draft the prompt (system/developer/user separation).
- Add 3 to 10 targeted test cases:
- Typical case, tricky case, adversarial case, empty/degenerate input.
- Run a “prompt diff” patch cycle:
- Identify failure mode (ambiguity, missing constraints, competing goals).
- Patch the smallest instruction that fixes it.
- Re-run tests.
Structured Output Guidance
Prefer:
- Explicit JSON schema (or a strict example) plus “no extra keys”.
- Deterministic ordering only if needed.
- “If you cannot comply, return an error object with fields …” (never silently fallback).
Common Failure Modes (And Fixes)
- Hallucinated facts:
- Add: “If unknown, say
I don’t knowand ask for X.” - Add: cite-only-from-provided-sources rule when applicable.
- Format drift:
- Add: strict schema, no prose, and a single top-level object.
- Add: “Validate output against schema before responding.”
- Tool misuse:
- Add: tool selection rule (“Only call tools when …”), plus examples.
- Add: “Never fabricate tool outputs.”
References
See references/templates.md for copy-paste prompt templates and a test-case checklist.