提示词
为 Chat、ChatGPT Work 与 Codex 编写有效提示词。
提示词概览
提示词是你告诉 ChatGPT 想知道、创建或修改什么的方式。它可以是问题、指令或目标,不需要技术语法或僵硬公式。先用自己的话描述需求,检查回复,再用后续消息逐步完善结果。
简短提示词通常已经足够。对于更大或更重要的任务,可以加入真正影响结果的部分:
- 目标: ChatGPT 应完成什么?
- 上下文: 哪些信息或来源会有帮助?
- 输出: 需要什么格式、长度或细节层次?
- 边界: 哪些内容必须保持不变?ChatGPT 应避免什么,或执行前先向你确认什么?
只使用有帮助的部分即可,不需要机械填满每一项,也没有强制格式。
描述所需结果
先描述结果,而不是一开始就列出详细步骤。当受众或格式会改变输出方式时,把它们一并写清楚。
Turn these meeting notes into a short update for the project team.
Put the decisions and next steps first.这条提示词说明了要创建什么,以及谁会阅读。只有当过程本身很重要时才明确规定过程;否则,可以让 ChatGPT 自行搜索、比较信息并调整做法。
添加有用上下文
提供可能改变结果的信息。只加入重要来源,并说明 ChatGPT 应从每个来源中提取什么。
- 当需要总结、比较、转换内容或创建可评审文件时,附加文档、电子表格、演示文稿或 PDF。
- 任务依赖视觉上下文时,添加截图、流程图或其他图片输入,并指出关键区域,不要只依赖图片本身。
- 答案依赖最新信息时,让 ChatGPT 使用 Web 搜索;需要核对结果时,要求提供来源。
- 当相关聊天或任务需要共享文件、来源或本地文件夹时,使用项目。
使用连接来源
如果 ChatGPT 可以访问连接来源,请说明应去哪里查找,以及要找什么,不需要逐条规定每一次搜索。
Use the latest project plan in Drive and relevant decisions and updates from
the project's Slack channel to prepare a status update.连接来源需要匹配的 plugin;是否可用可能取决于套餐和工作区设置。
使用 plugins
plugins 为 ChatGPT 提供可复用指令,并连接 Google Drive、Gmail、Slack、GitHub 等工具。描述所需结果,让 ChatGPT 从可用工具中选择;如果要指定 plugin,请在输入框中输入 @。
个性化 ChatGPT
希望在所有聊天和任务中生效的偏好,可以作为自定义指令放到 Settings > Personalization(设置 > 个性化)。只与当前任务有关的细节应保留在提示词中。
查看个性化设置设置默认性格、自定义指令和其他偏好。对话线程与持续上下文
一条对话线程包含你的提示词、模型回复和工具调用。后续消息会继续使用同一线程的上下文,因此适合在同一结果上补充来源、纠正方向、添加测试或要求修改。
你可以并行运行多条线程,但不要让两条线程同时修改同一批文件。编码任务需要并行时,优先使用独立工作树。
所有上下文都必须放入模型的上下文窗口。长任务中,ChatGPT 或 Codex 可能通过总结相关信息、舍弃次要细节的方式压缩上下文。即使系统会自动压缩,也应主动减少无关文件、重复日志和已经失效的要求。
设置能够避免实际问题的边界
边界是少量但关键的指令,用来避免产生额外工作,或执行你没有打算批准的动作。当改错一个细节会让结果无法使用,或者操作影响他人前需要评审时,就应加入边界。
- 保持已批准的日期和预算数字不变。
- 只使用提供的来源;缺少信息时明确标记,不要猜测。
- 建议不得超出预算范围。
- 只把消息准备成草稿,不要发送。
聚焦最重要的一两个边界,不需要控制 ChatGPT 的每一个步骤。
让结果可以直接使用
告诉 ChatGPT 结果将如何使用,这会帮助它选择合适的长度、细节和组织方式。
- 创建一页式摘要,让负责人可以在会前快速浏览,并把决策和下一步放在前面。
- 把笔记整理成跟进邮件,包含决策、负责人和截止日期。
- 创建计划支出与实际支出的清晰表格,并突出超过 10% 的差异。
对于重要工作,应要求最终检查,例如确认每个行动项都有负责人和截止日期,或标明无法核实的信息。使用或分享前仍需由你亲自评审。
通过后续消息改善结果
第一条提示词不必完美。检查结果后,直接描述希望改变的部分。
Make the opening more direct, keep the evidence, and move the recommendation
above the background section.无需从头开始,就可以补充来源、纠正方向、要求另一种方案或改变细节层次。
Steering 与 queuing
Codex 工作时,不必等待当前运行结束也可以发送消息:
- Steer(引导) 把消息加入当前运行,用于改变方向、补充遗漏细节或提供新信息。
- Queue(排队) 把消息留给下一次运行,适合需要等当前工作结束后再处理的后续事项。
在 ChatGPT 桌面 App 中,可以通过 Settings > General > Follow-up behavior选择默认行为。排队消息会显示在输入框上方,可以编辑、排序、发送或删除。
在 Codex CLI 中,Codex 工作时按 Enter 引导当前会话轮次,按 Tab 将消息排到下一轮。详情见交互快捷键。
把各部分组合起来
下面是一条使用连接来源准备项目更新的完整提示词:
Prepare a one-page project status update for Monday's leadership meeting. Use
the latest project plan in Drive and relevant decisions and updates from the
project's Slack channel.
Lead with the decisions leadership needs to make and the next steps. Summarize
progress, risks, owners, and due dates. Keep approved dates and budget figures
unchanged. Flag any conflicting or missing information, and don't send or
publish anything.
Before you finish, check that every next step has an owner and due date.这条提示词包含目标、上下文、输出和边界,并要求最终检查,但没有规定每个执行步骤。
使用语音听写
在 ChatGPT 桌面 App 的输入框可见时,按住 Ctrl+M 并开始说话。ChatGPT 会把语音转写到输入框中,你可以先检查和编辑,再发送提示词。
Chat 提示词示例
Chat 适合提问、发展想法、起草内容和处理日常决策。先说明结果,再加入真正会改变答案的细节。
理解一个主题
Explain how compound interest works for someone who has never invested.
Use one concrete example and define any financial terms you introduce.起草并修改文字
Draft a friendly email declining this invitation because I will be traveling.
Keep it under 120 words and leave the door open for a future event.比较选项
Compare these two phone plans for one person who travels internationally twice
a year. Show the important differences in a table, then recommend one and explain
the tradeoff.制定实用计划
Plan five weekday dinners that take less than 30 minutes. Avoid peanuts, reuse
ingredients across meals, and finish with one consolidated shopping list.Work 提示词
Chat 适合快速提问、简短改写、头脑风暴和轻量草稿。任务需要多个来源或工具、包含一系列步骤、会执行修改,或要产出更大的交付物时,使用 Work。
为 Work 描述所需结果,提供来源材料,说明受众和评审方式,并要求 ChatGPT 规划、收集信息、创建文件和完成检查。
高效使用 Work
Work 适合耗时或重复任务,以及可复用的完整文件。即使任务消耗更多 credits,只要节省时间、提高质量或支持重要决策,也可能值得。
先从一个可以评审的结果开始:
- 只加入相关来源,并在适用时限制日期范围。
- 定义受众、输出格式和期望长度。
- 区分必需工作与可选改进或润色。
- 当实现方式很重要时要求先给计划;ChatGPT 发送、发布或修改他人依赖的信息前,必须获得你的批准。
- 如果任务开始执行不再需要的工作,及时收窄范围或停止。
评审第一版结果,改进指令,并在工作流稳定后复用。
把来源材料转换成完整文件
Use the attached quarterly reports to create a leadership brief and a six-slide
presentation.
The audience is the executive team. Lead with the three decisions they need to
make, distinguish reported facts from your analysis, cite each number to its
source file, and check that the brief and slides agree before you finish.研究一项决策
Research three customer-support platforms for a 50-person company. Compare
pricing, security, integrations, and migration effort using current sources.
Deliver a recommendation memo with links, assumptions, and the questions we
should answer before signing a contract.协调一次发布
Create a launch plan for the attached product brief. Include the timeline,
owners, dependencies, risks, announcement draft, customer FAQ, and a checklist
for launch day. Flag any missing decisions before producing the final files.对于重复工作,先在普通任务中把提示词调整稳定,再从该任务安排计划工作。如果每次计划运行都应开始一项新任务,则创建独立计划任务。
Codex 提示词
需要 ChatGPT 处理代码、代码库或开发者工具时,使用 Codex。有效的 Codex 提示词应说明需要的行为,指向相关代码或复现步骤,保留重要约束,并明确如何验证改动。
计划模式与 Goal mode
对于多步骤任务,希望 Codex 在改动前调查并提出方案时,在 App 输入框中使用 /plan。当 Goal mode 可用时,可以在计划明确后使用 /goal 设置持续目标。当前命令列表见 App 斜杠命令。
目标文本会同时作为起始提示词和完成标准。一个好目标通常包含具体产出、必要约束,以及可衡量的测试或评审标准。
Migrate this codebase from JavaScript to TypeScript. Preserve existing behavior,
compile in strict mode without explicit `any` types, and make the full test suite pass.目标启动后仍可继续引导 Codex,补充库、兼容性或禁止方案等约束。需要状态回顾但不想干扰主任务时,可以使用 Side conversation(侧边会话)。
如何阅读下面的示例
每个工作流包含:
- 适用场景以及更适合的 Codex 入口(IDE、CLI 或云端)。
- 带有用户提示词示例的步骤。
- 上下文说明:Codex 会自动看到什么,哪些内容需要主动附加。
- 验证方式:如何检查输出。
Codex 会在沙箱中运行本地命令,限制文件和网络访问。任务需要越过边界时,Codex 会按审批策略处理。
解释代码库
适合刚开始了解项目、接手服务,或需要理解协议、数据模型和请求流时使用。
IDE 扩展工作流
打开最相关的文件。
选中关心的代码(可选,但建议这样做)。
向 Codex 发送:
Explain how the request flows through the selected code. Include: - a short summary of the responsibilities of each module involved - what data is validated and where - one or two "gotchas" to watch for when changing this
验证时,让 Codex 生成可以逐项核对的步骤和文件列表:
Summarize the request flow as a numbered list of steps. Then list the files involved.CLI 工作流
启动交互式会话:
codex附加文件并发送:
I need to understand the protocol used by this service. Read @foo.ts @schema.ts and explain the schema and request/response flow. Focus on required vs optional fields and backward compatibility rules.
在输入框中使用 @ 插入工作区路径,或用 /mention 附加特定文件。
修复 bug
当错误可以在本地复现时,向 Codex 提供复现步骤、相关文件、约束和验证方法。
CLI 工作流
在仓库根目录启动 Codex:
codex提供复现步骤:
Bug: Clicking "Save" on the settings screen sometimes shows "Saved" but doesn't persist the change. Repro: 1) Start the app: npm run dev 2) Go to /settings 3) Toggle "Enable alerts" 4) Click Save 5) Refresh the page: the toggle resets Constraints: - Do not change the API shape. - Keep the fix minimal and add a regression test if feasible. Start by reproducing the bug locally, then propose a patch and run checks.
你提供的复现步骤和约束通常比高层问题描述更重要;Codex 则会补充命令输出、调用点和它触发的堆栈信息。
修复后要求重新执行复现步骤,并运行最小相关检查:
After the fix, run lint + the smallest relevant test suite. Report the commands and results.IDE 扩展工作流
打开可能包含 bug 的文件及其最近调用方。
向 Codex 发送:
Find the bug causing "Saved" to show without persisting changes. After proposing the fix, tell me how to verify it in the UI.
编写测试
需要明确限定测试范围时,可以基于 IDE 选区或 CLI 中的函数名和路径提出请求。
IDE 扩展工作流
打开包含目标函数的文件。
选中函数定义,并从命令面板选择 Add to Codex Thread。
发送:
Write a unit test for this function. Follow conventions used in other tests.
CLI 工作流
启动 Codex:
codex按函数名给出提示词:
Add a test for the invert_list function in @transform.ts. Cover the happy path plus edge cases.
根据截图制作原型
当你有设计稿、截图或 UI 参考,需要转换成可运行原型时使用。
CLI 工作流
把截图保存到本地,例如
./specs/ui.png。运行 Codex:
codex把图片拖入终端附加到提示词。
补充实现约束和交付物:
Create a new dashboard based on this image. Constraints: - Use react, vite, and tailwind. Write the code in typescript. - Match spacing, typography, and layout as closely as possible. Outputs: - A new route/page that renders the UI - Any small components needed - README.md with instructions to run it locally
截图提供视觉要求,但框架、路由、组件方式,以及 hover、校验和键盘交互等不可见行为仍应通过文字说明。
验证时,让 Codex 启动开发服务器并给出准确地址:
Start the dev server and tell me the local URL/route to view the prototype.IDE 扩展工作流
在 Codex 任务中附加图片(拖放或粘贴)。
向 Codex 发送:
Create a new settings page. Use the attached screenshot as the target UI. Follow design and visual patterns from other files in this project.
通过实时更新迭代 UI
需要保持“设计、微调、刷新、继续微调”的循环时,可以在另一个终端中运行开发服务器,再让 Codex 进行小而聚焦的改动。
CLI 工作流(运行 Vite,并用小提示词迭代)
启动 Codex:
codex在另一个终端窗口中启动开发服务器:
npm run dev让 Codex 提出改动方向:
Propose 2-3 styling improvements for the landing page.选定一个方向后,用小而具体的提示词迭代:
Go with option 2. Change only the header: - make the typography more editorial - increase whitespace - ensure it still looks good on mobile继续提出聚焦请求:
Next iteration: reduce visual noise. Keep the layout, but simplify colors and remove any redundant borders.
每轮都在浏览器中检查结果。保留喜欢的改动,撤销不需要的改动;手动撤销或修改后应告诉 Codex,避免后续覆盖。
把重构委派到云端
当你希望先结合本地上下文设计方案,再把长时间实现委派给并行云任务时使用。
本地规划(IDE)
提交或暂存当前工作,保证后续可以清晰比较。
让 Codex 先制定重构计划:
$plan We need to refactor the auth subsystem to: - split responsibilities (token parsing vs session loading vs permissions) - reduce circular imports - improve testability Constraints: - No user-visible behavior changes - Keep public APIs stable - Include a step-by-step migration plan评审并修改计划:
Revise the plan to: - specify exactly which files move in each milestone - include a rollback strategy
云端委派(IDE → Cloud)
设置 Codex 云端环境,在 IDE 中选择云端环境,然后发送:
Implement Milestone 1 from the plan.评审云端 diff,在本地运行测试,再创建 PR 或继续下一里程碑。
云端任务运行在隔离环境中;除非为环境启用,否则智能体阶段没有互联网访问。详情见云端网络访问。
执行本地代码评审
CLI 工作流(评审当前工作树)
启动 Codex:
codex运行评审命令:
/review(可选)提供自定义关注点:
/review Focus on edge cases and security issues
根据反馈修复后,再次运行 /review 验证问题是否已经解决。
评审 GitHub PR
GitHub 工作流(评论驱动)
如果希望在不把分支拉到本地的情况下获得反馈,先为仓库启用 Codex Code review(代码评审),详情见代码评审。
在 GitHub 中打开 PR。
留言并明确标记 Codex 与关注范围:
@codex review(可选)补充更明确的指令:
@codex review for security vulnerabilities and security concerns
更新文档
IDE 或 CLI 工作流(本地编辑与验证)
明确要修改的文档文件,并在 IDE 中打开或通过
@提及(IDE 或 CLI)。向 Codex 说明范围和验证要求:
Update the "advanced features" documentation to provide authentication troubleshooting guidance. Verify that all links are valid.Codex 起草后,评审文档并按需要继续迭代。
验证时,应阅读渲染页面,检查标题结构、代码块、链接和示例,而不只是查看原始 Markdown diff。