# 第十二章 提示词工程进阶与上下文工程

> 从“会提问”到“会引导”，从优化一句话到优化整个知识背景

***

掌握了基础提示词技巧后，本章将带你进入两个更深层的领域：

**提示词进阶**：如何引导 AI 进行深度思考，用思维链、结构化输出和迭代优化解决复杂任务。

**上下文工程**：提示词只是 AI 看到的“一句话”，上下文工程则优化 AI 看到的“整个背景”——包括 RAG、知识库和 MCP 协议。这是 2026 年 AI 应用的核心能力。

## 本章内容

**Part A：提示词进阶**

* [**12.1 思维链**](/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced/12.1_chain_of_thought.md)：让 AI 学会“慢思考”，展示推理步骤
* [**12.2 结构化输出**](/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced/12.2_structured_output.md)：让 AI 直接输出表格或数据，而非写作文
* [**12.3 迭代优化**](/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced/12.3_iterative.md)：好的提示词不是一次写成的，而是“试”出来的
* [**12.4 高级技巧**](/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced/12.4_advanced_techniques.md)：自洽性、角色反转、强化约束等“黑科技”

**Part B：上下文工程**

* [**12.5 上下文工程**](/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced/12.5_context_engineering.md)：从提示词到知识库，理解 RAG 与 MCP 协议


---

# Agent Instructions: 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:

```
GET https://yeasy.gitbook.io/ai_beginner_guide/di-san-bu-fen-shi-zhan-ying-yong-ji-qiao/12_prompt_advanced.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
