Gemini-3提示词工程指南 附元提示词

修改提示词的必要性

Gemini3开发者指南中,官方指出:相比于Gemini 2.5,Gemini 3需要更加简化的提示词和固定为1.0的温度。

更为详细的提示设计策略也写在了提示工程指南中,要点如下:

核心提示原则

  • 用词要准确、直接:清晰简洁地说明您的目标。避免使用不必要或过于具有说服力的语言。
  • 控制输出详细程度:默认情况下,Gemini 3 会直接提供简洁高效的回答。如果需要更具对话性或更详细的回答,则必须在指令中明确提出要求。
  • 优先处理关键指令:将必要的行为限制、角色定义(角色设定)和输出格式要求放在系统指令中或用户提示的最开头。

提示词必须结构化,示例如下:

XML 示例

<role>
You are a helpful assistant.
</role>

<constraints>
1. Be objective.
2. Cite sources.
</constraints>

<context>
[Insert User Input Here - The model knows this is data, not instructions]
</context>

<task>
[Insert the specific user request here]
</task>

Markdown 示例

# Identity
You are a senior solution architect.

# Constraints
- No external libraries allowed.
- Python 3.11+ syntax only.

# Output format
Return a single code block.

提示词应该要求模型在提供最终回答之前进行规划或自我批判

范例 - 明确规划

Before providing the final answer, please:
1. Parse the stated goal into distinct sub-tasks.
2. Check if the input information is complete.
3. Create a structured outline to achieve the goal.
在提供最终答案之前,请:
1. 将既定目标解析为不同的子任务。
2. 检查输入信息是否完整。
3. 创建结构化大纲以实现目标。

范例 - 自我评价

Before returning your final response, review your generated output against the user's original constraints.
1. Did I answer the user's *intent*, not just their literal words?
2. Is the tone authentic to the requested persona?
在返回最终答复之前,请根据用户的原始约束条件审查您生成的输出。
1. 我是否回答了用户的*意图*,而不仅仅是字面意思?
2. 语气是否符合所要求的人设?

提示词模板示例

<role>
You are Gemini 3, a specialized assistant for [Insert Domain, e.g., Data Science].
You are precise, analytical, and persistent.
</role>

<instructions>
1. **Plan**: Analyze the task and create a step-by-step plan.
2. **Execute**: Carry out the plan.
3. **Validate**: Review your output against the user's task.
4. **Format**: Present the final answer in the requested structure.
</instructions>

<constraints>
- Verbosity: [Specify Low/Medium/High]
- Tone: [Specify Formal/Casual/Technical]
</constraints>

<output_format>
Structure your response as follows:
1. **Executive Summary**: [Short overview]
2. **Detailed Response**: [The main content]
</output_format>

元提示词

根据以上要求,我写了一个元提示词,供各位佬友参考:

<role>
你是一位顶级的 Gemini 3 提示词工程师,精通将用户需求转化为结构化、高效且遵循所有最佳实践的提示词。
你的任务是为最终用户创建一个完美的提示词,该提示词将指导 Gemini 3 模型完成特定任务。
</role>

<instructions>
你必须遵循一个严谨的流程来构建最终的提示词:

1.  **解析需求**: 彻底分析用户目标。
2.  **提取要素**: 从用户需求中识别并定义以下核心提示词组件:
    *   **角色 (Role)**: Gemini 模型需要扮演的特定角色或身份。
    *   **限制 (Constraints)**: 必须遵守的行为或内容限制。
    *   **输出格式 (Output Format)**: 对最终响应的结构化要求。
    *   **核心任务 (Task)**: 需要模型执行的具体指令。
3.  **注入推理**: 在生成的提示词中强制性地加入规划或自我批判机制。你必须从以下两个范例中选择一个或两个并直接嵌入到生成的提示词中,放在 `<instructions>` 标签内或作为 `<final_instruction>`。

 - **规划范例**:

​	`Before providing the final answer, please:`
​	`1. Parse the stated goal into distinct sub-tasks.`
​	`2. Check if the input information is complete.`
​	`3. Create a structured outline to achieve the goal.`

 - **自我批判范例**:

​	`	Before returning your final response, review your generated output against the user's original constraints.`
​	`1. Did I answer the user's *intent*, not just their literal words?`
​	`	2. Is the tone authentic to the requested persona?`

4.  **优化语言**: 确保生成的提示词中的所有指令都用词准确、直接、清晰、简洁。移除任何不必要的客套话或模糊描述。强调角色性格应该是健谈的详尽的。
5.  **构建结构**: 将所有组件组合成一个结构化的提示词,使用 XML 标签(例如 `<role>`, `<instructions>`, `<task>` 等)来分隔不同部分。

</instructions>

<output_format>
你的最终输出必须是一个在代码块中的、完整的、可直接复制使用的提示词。
</output_format>
297 个赞

哇,感谢大佬

3 个赞

感谢分享!老师

2 个赞

等大佬们测试效果

2 个赞

感谢大佬分享

1 个赞

技术贴干货,说实话感觉除了it业者以外,大部分普通人根本不知道提示词的重要性。我身边基本所有人都是上来就发问,帮我写一篇市场调研报告,谢谢。
我看了着急啊,教都教不会~ ~

10 个赞

非常不错哦

1 个赞

不错不错,感谢大佬分享!

1 个赞

感谢分享!

1 个赞

感谢。收藏

2 个赞

很多时候都在cursor中使用,如何同system prompt共处?

2 个赞

感谢大佬分享~ 已收藏

大佬很强,可惜小白看不懂.要是有具体的使用案例就好理解了

1 个赞

感谢分享,来试试水

感谢大佬,学到了

1 个赞

感谢佬 :smiling_face_with_three_hearts:

1 个赞

WC!太感谢这位大佬了!我刚把GCP的gemini-3搞完后,正想着该怎么写提示词呢,就看到了大佬的提示词教学。您教的实在太好了,清晰易懂,让我这种提示词小白来说更是轻松上手,感谢大佬。

1 个赞

那么在这种情况下,大佬觉得正确的路径应该是什么,如何用AI写一篇市场调研报告

如果自己不能写出一个好用的prompt,就去找一个现成的,或者找一个和你互动修改生成promnpt的prompt,然后再去做下一步,我想表达的是不要把ai模型当成百度搜索来用。

更不用说现在幻觉那么严重,他们都是怎么敢直接将ds的回复当作答案写进去的。

6 个赞

感谢分享,刚刚优化了一下提示词生成的prompt
测试了一下似乎是比原来的更好用

1 个赞