> For the complete documentation index, see [llms.txt](https://zhouhao4221.gitbook.io/haiqing-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zhouhao4221.gitbook.io/haiqing-docs/01-thinking/ai-thinking-framework.md).

# AI 工程思维框架

## 1. 提示前的四个问题

在向 AI 提交任务前，先明确：

1. **目标是什么？** — 用一句话表述期望的输出
2. **约束是什么？** — 不能做什么、必须遵守什么
3. **成功标准是什么？** — 如何知道输出是好的
4. **上下文是什么？** — AI 需要哪些背景知识才能做好这件事

四个问题都能回答，再开始提示。

***

## 2. 决策边界：何时用 AI，何时用人工判断

| 适合交给 AI   | 必须人工判断        |
| --------- | ------------- |
| 生成初稿、样板代码 | 定义目标和约束       |
| 已知模式的代码审查 | 涉及权衡的架构决策     |
| 文档、变更日志生成 | 最终的合并/发布决策    |
| 测试用例枚举    | 生产事故根因定性      |
| 有规范可循的重构  | 新技术或未知领域的方案选型 |

判断准则：凡是"定义问题本身"的工作，保留给人；凡是"在已定义边界内执行"的工作，可以交给 AI。

***

## 3. 输出评估：收到 AI 输出后的系统检查

* **正确性** — 是否解决了真实问题，而非表面描述的问题？
* **完整性** — 是否遗漏了边界情况或隐含的依赖？
* **可解释性** — 能否向他人解释输出的每一部分？
* **风险** — 如果输出有错，后果是什么？能否回滚？

无法通过以上检查的输出，不提交、不合并、不发布。

***

## 4. 常见失败模式

* **过度信任** — 接受 AI 输出而不验证，尤其在不熟悉的领域
* **模糊输入** — 未定义约束就要求 AI 做决策，AI 会自行填补空白
* **上下文丢失** — 长会话中 AI 遗失了早期的关键约束，输出悄悄偏离
* **确认偏误** — 用 AI 验证已有结论，而非真正挑战它

***

## 5. 行动前的一个问题

在执行任何 AI 任务前：*我能清楚地描述成功是什么样的吗？*

如果不能，先把思路结构化，再开始提示。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://zhouhao4221.gitbook.io/haiqing-docs/01-thinking/ai-thinking-framework.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
