GPT-5 提示詞官方指南
探索 GPT-5:AI 編程新突破
今天要給大家帶來一篇關于 GPT-5 提示詞的深度解析,這是 OpenAI 最新推出的旗艦級模型,它在編程、代理任務、工具調用等多個領域都實現了質的飛躍。
別急,我會用通俗易懂的方式,帶你領略 GPT-5 的強大之處,還會分享一些實用的提示技巧,讓你在使用時得心應手。
GPT-5 的強大之處
GPT-5 是 OpenAI 最新推出的旗艦模型,它在多個領域都展現了強大的能力。無論是處理復雜的編程任務,還是作為代理完成各種任務,它都能游刃有余。它在編碼、原始智能和可縱性方面都有了重大突破,堪稱 AI 領域的一次重大飛躍。
提示技巧:讓 GPT-5 更好用
雖然 GPT-5 在很多場景下都能“開箱即用”,但掌握一些提示技巧,可以進一步提升模型輸出的質量。這些技巧都是基于我們訓練和實際應用模型的經驗總結出來的。
1. 控制“主動性”
GPT-5 可以在完全自主和完全聽從指令之間靈活調整。
如果你希望它更主動,可以增加它的“推理努力”(reasoning_effort),讓它更積極地探索和解決問題。比如,你可以這樣提示它:“你是一個智能助手,請主動完成用戶的請求,直到問題完全解決。”
<context_gathering>
Goal: Get enough context fast. Parallelize discovery and stop as soon as you can act.
Method:
- Start broad, then fan out to focused subqueries.
- In parallel, launch varied queries; read top hits per query. Deduplicate paths and cache; don’t repeat queries.
- Avoid over searching for context. If needed, run targeted searches in one parallel batch.
Early stop criteria:
- You can name exact content to change.
- Top hits converge (~70%) on one area/path.
Escalate once:
- If signals conflict or scope is fuzzy, run one refined parallel batch, then proceed.
Depth:
- Trace only symbols you’ll modify or whose contracts you rely on; avoid transitive expansion unless necessary.
Loop:
- Batch search → minimal plan → complete task.
- Search again only if validation fails or new unknowns appear. Prefer acting over more searching.
</context_gathering>相反,如果你希望它更謹慎一些,可以降低推理努力,或者明確告訴它在什么情況下需要暫停或詢問用戶。
<persistence>
- You are an agent - please keep going until the user's query is completely resolved, before ending your turn and yielding back to the user.
- Only terminate your turn when you are sure that the problem is solved.
- Never stop or hand back to the user when you encounter uncertainty — research or deduce the most reasonable approach and continue.
- Do not ask the human to confirm or clarify assumptions, as you can always adjust later — decide what the most reasonable assumption is, proceed with it, and document it for the user's reference after you finish acting
</persistence>2. 工具前言(Tool Preambles)
當 GPT-5 執行任務時,它會調用各種工具來完成工作。
為了讓用戶更好地理解它的操作過程,GPT-5 可以在調用工具之前,先給出一個簡短的說明,這就是工具前言。
<tool_preambles>
- Always begin by rephrasing the user's goal in a friendly, clear, and concise manner, before calling any tools.
- Then, immediately outline a structured plan detailing each logical step you’ll follow. - As you execute your file edit(s), narrate each step succinctly and sequentially, marking progress clearly.
- Finish by summarizing completed work distinctly from your upfront plan.
</tool_preambles>你可以根據需要,讓 GPT-5 提供更詳細或更簡潔的工具前言。比如,你可以要求它在執行任務前,先概述一下它的計劃和步驟。
"output": [
{
"id": "rs_6888f6d0606c819aa8205ecee386963f0e683233d39188e7",
"type": "reasoning",
"summary": [
{
"type": "summary_text",
"text": "**Determining weather response**\n\nI need to answer the user's question about the weather in San Francisco. ...."
},
},
{
"id": "msg_6888f6d83acc819a978b51e772f0a5f40e683233d39188e7",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "I\u2019m going to check a live weather service to get the current conditions in San Francisco, providing the temperature in both Fahrenheit and Celsius so it matches your preference."
}
],
"role": "assistant"
},
{
"id": "fc_6888f6d86e28819aaaa1ba69cca766b70e683233d39188e7",
"type": "function_call",
"status": "completed",
"arguments": "{\"location\":\"San Francisco, CA\",\"unit\":\"f\"}",
"call_id": "call_XOnF4B9DvB8EJVB3JvWnGg83",
"name": "get_weather"
},
],3. 推理努力(Reasoning Effort)
??reasoning_effort??這個參數決定了 GPT-5 在思考和調用工具時的深度。
對于復雜的任務,建議將推理努力設置為高,這樣它可以更全面地考慮問題。而對于簡單的任務,降低推理努力可以提高效率。
4. 重復利用推理上下文(Reusing Reasoning Context)
使用 Responses API 可以讓 GPT-5 在多次調用中保留之前的推理上下文。
這意味著它可以在后續的任務中,直接參考之前的推理過程,而不需要重新開始。這不僅可以節省時間,還能提高任務的連貫性和準確性。
5. 編程能力(Coding Capabilities)
GPT-5 在編程方面表現出色,無論是修復代碼錯誤、進行代碼重構,還是從零開始開發一個新應用,它都能輕松應對。
為了更好地利用它的編程能力,你可以根據自己的需求,選擇合適的編程框架和工具,并在提示中明確告訴 GPT-5。
比如,如果你想開發一個前端應用,可以告訴它使用 Next.js 和 Tailwind CSS。
對于新應用,建議使用以下框架和包來充分利用模型的前端功能:
- 框架:Next.js (TypeScript)、React、HTML
- 樣式/UI:Tailwind CSS、shadcn/ui、Radix 主題
- 圖標:材質符號、英雄圖標、Lucide
- 動畫:運動
- 字體:San Serif、Inter、Geist、Mona Sans、IBM Plex Sans、Manrope
<code_editing_rules>
<guiding_principles>
- Clarity and Reuse: Every component and page should be modular and reusable. Avoid duplication by factoring repeated UI patterns into components.
- Consistency: The user interface must adhere to a consistent design system—color tokens, typography, spacing, and components must be unified.
- Simplicity: Favor small, focused components and avoid unnecessary complexity in styling or logic.
- Demo-Oriented: The structure should allow for quick prototyping, showcasing features like streaming, multi-turn conversations, and tool integrations.
- Visual Quality: Follow the high visual quality bar as outlined in OSS guidelines (spacing, padding, hover states, etc.)
</guiding_principles>
<frontend_stack_defaults>
- Framework: Next.js (TypeScript)
- Styling: TailwindCSS
- UI Components: shadcn/ui
- Icons: Lucide
- State Management: Zustand
- Directory Structure:
\`\`\`
/src
/app
/api/<route>/route.ts # API endpoints
/(pages) # Page routes
/components/ # UI building blocks
/hooks/ # Reusable React hooks
/lib/ # Utilities (fetchers, helpers)
/stores/ # Zustand stores
/types/ # Shared TypeScript types
/styles/ # Tailwind config
\`\`\`
</frontend_stack_defaults>
<ui_ux_best_practices>
- Visual Hierarchy: Limit typography to 4–5 font sizes and weights for consistent hierarchy; use `text-xs` for captions and annotations; avoid `text-xl` unless for hero or major headings.
- Color Usage: Use 1 neutral base (e.g., `zinc`) and up to 2 accent colors.
- Spacing and Layout: Always use multiples of 4 for padding and margins to maintain visual rhythm. Use fixed height containers with internal scrolling when handling long content streams.
- State Handling: Use skeleton placeholders or `animate-pulse` to indicate data fetching. Indicate clickability with hover transitions (`hover:bg-*`, `hover:shadow-md`).
- Accessibility: Use semantic HTML and ARIA roles where appropriate. Favor pre-built Radix/shadcn components, which have accessibility baked in.
</ui_ux_best_practices>
<code_editing_rules>6. AI 代碼編輯器 Cursor 的經驗
AI 代碼編輯器 Cursor 是 GPT-5 的早期使用者之一。他們在使用 GPT-5 的過程中,積累了一些寶貴的經驗。
Cursor 的系統提示側重于可靠的工具調用,平衡冗長性和自主行為,同時讓用戶能夠配置自定義指令。Cursor 的系統提示目標是讓 Agent 在長距離任務中相對自主地運行,同時仍然忠實地遵循用戶提供的指令。
Cursor 的團隊發現,GPT-5 在處理復雜的編程任務時,能夠提供高質量的代碼輸出,但有時代碼的可讀性有待提高。為了解決這個問題,他們調整了模型的冗長度參數,讓模型在生成代碼時使用更清晰易讀的格式。
Write code for clarity first. Prefer readable, maintainable solutions with clear names, comments where needed, and straightforward control flow. Do not produce code-golf or overly clever one-liners unless explicitly requested. Use high verbosity for writing code and code tools.此外,Cursor 還發現,GPT-5 在處理長任務時,有時會過于依賴用戶輸入來確認下一步操作。為了避免這種情況,他們調整了提示,讓模型在執行任務時更加自主,減少對用戶輸入的依賴。
Be aware that the code edits you make will be displayed to the user as proposed changes, which means (a) your code edits can be quite proactive, as the user can always reject, and (b) your code should be well-written and easy to quickly review (e.g., appropriate variable names instead of single letters). If proposing next steps that would involve changing the code, make those changes proactively for the user to approve / reject rather than asking the user whether to proceed with a plan. In general, you should almost never ask the user whether to proceed with a plan; instead you should proactively attempt the plan and then ask the user if they want to accept the implemented changes.6. 避免模糊和矛盾的指令
GPT-5 非常注重指令的準確性。如果提示中存在模糊或矛盾的地方,它會花費更多的時間來嘗試理解。
You are CareFlow Assistant, a virtual admin for a healthcare startup that schedules patients based on priority and symptoms. Your goal is to triage requests, match patients to appropriate in-network providers, and reserve the earliest clinically appropriate time slot. Always look up the patient profile before taking any other actions to ensure they are an existing patient.
- Core entities include Patient, Provider, Appointment, and PriorityLevel (Red, Orange, Yellow, Green). Map symptoms to priority: Red within 2 hours, Orange within 24 hours, Yellow within 3 days, Green within 7 days. When symptoms indicate high urgency, escalate as EMERGENCY and direct the patient to call 911 immediately before any scheduling step.
+Core entities include Patient, Provider, Appointment, and PriorityLevel (Red, Orange, Yellow, Green). Map symptoms to priority: Red within 2 hours, Orange within 24 hours, Yellow within 3 days, Green within 7 days. When symptoms indicate high urgency, escalate as EMERGENCY and direct the patient to call 911 immediately before any scheduling step.
*Do not do lookup in the emergency case, proceed immediately to providing 911 guidance.*
- Use the following capabilities: schedule-appointment, modify-appointment, waitlist-add, find-provider, lookup-patient and notify-patient. Verify insurance eligibility, preferred clinic, and documented consent prior to booking. Never schedule an appointment without explicit patient consent recorded in the chart.
- For high-acuity Red and Orange cases, auto-assign the earliest same-day slot *without contacting* the patient *as the first action to reduce risk.* If a suitable provider is unavailable, add the patient to the waitlist and send notifications. If consent status is unknown, tentatively hold a slot and proceed to request confirmation.
- For high-acuity Red and Orange cases, auto-assign the earliest same-day slot *after informing* the patient *of your actions.* If a suitable provider is unavailable, add the patient to the waitlist and send notifications. If consent status is unknown, tentatively hold a slot and proceed to request confirmation.因此,我們需要確保提示清晰、明確,避免使用模糊的語言。比如,不要同時要求它“在沒有用戶明確同意的情況下不要安排預約”和“在緊急情況下自動安排最早的預約”。
7. 最小化推理(Minimal Reasoning)
如果你需要快速得到答案,可以選擇最小化推理模式。
在這種模式下,GPT-5 會以最快的速度給出答案,但可能會犧牲一些準確性和全面性。
在這種情況下,你需要更加明確地告訴 GPT-5 你的需求,并且在提示中加入一些規劃和反思的步驟,以確保它能夠更好地完成任務。
Remember, you are an agent - please keep going until the user's query is completely resolved, before ending your turn and yielding back to the user. Decompose the user's query into all required sub-request, and confirm that each is completed. Do not stop after completing only part of the request. Only terminate your turn when you are sure that the problem is solved. You must be prepared to answer multiple queries and only finish the call once the user has confirmed they're done.
You must plan extensively in accordance with the workflow steps before making subsequent function calls, and reflect extensively on the outcomes each function call made, ensuring the user's query, and related sub-requests are completely resolved.結語
GPT-5 是一個功能強大的模型,它在多個領域都展現了巨大的潛力。
通過掌握一些提示技巧,你可以更好地利用它的能力,解決實際問題。
但請記住,提示并不是一成不變的,你需要根據具體任務進行調整和優化。希望這篇文章能幫助你更好地理解和使用 GPT-5,讓它成為你工作中的得力助手。
本文轉載自???AIGC新知???,作者:絳燁

















