AgentSkillsCN

openai-gpt5-prompting

为 OpenAI GPT-5 系列模型编写、评审并迭代提示词。适用于以下任务:(1) 将模糊的需求转化为高信号指令;(2) 在快速推理与深度推理行为之间进行选择;(3) 构建稳健的结构化输出提示(JSON 模式、工具调用);(4) 设计评估提示与评分标准;(5) 调试提示失败问题(幻觉、格式漂移、工具误用)。当用户提及 GPT-5、提示工程、系统/开发者消息、结构化输出、智能体提示,或希望获取最佳实践模板时,可选用此方法。

SKILL.md
--- frontmatter
name: openai-gpt5-prompting
description: Write, critique, and iterate prompts for OpenAI GPT-5 series models. Use for tasks like: (1) turning vague requirements into high-signal instructions, (2) selecting between quick vs deep reasoning behaviors, (3) creating robust structured-output prompts (JSON schemas, tool calls), (4) designing evaluation prompts and rubrics, and (5) debugging prompt failures (hallucinations, format drift, tool misuse). Trigger when the user mentions GPT-5, prompt engineering, system/developer messages, structured outputs, agent prompts, or wants best-practice templates.

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

  1. Draft the prompt (system/developer/user separation).
  2. Add 3 to 10 targeted test cases:
  • Typical case, tricky case, adversarial case, empty/degenerate input.
  1. 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)

  1. Hallucinated facts:
  • Add: “If unknown, say I don’t know and ask for X.”
  • Add: cite-only-from-provided-sources rule when applicable.
  1. Format drift:
  • Add: strict schema, no prose, and a single top-level object.
  • Add: “Validate output against schema before responding.”
  1. 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.