> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/getting-started/ai-documentation/optimizing-for-ai.md).

# 为 AI 做优化

GitBook 会自动为你的网站发布适合 AI 使用的输出内容。

### 让你的网站更易于 AI 工具读取

每个已发布的 GitBook 网站都包含适合 AI 的输出内容：

* 添加 `.md` 到页面 URL 后，即可将该页面以 Markdown 格式获取。
* 使用 `llms.txt` 为代理提供整个网站的索引。
* 使用 `llms-full.txt` 为代理提供已发布文档的完整快照。
* 使用 `/~gitbook/mcp` 让兼容 MCP 的工具直接读取你的文档。

这些内容会自动生成，使你的文档更容易被 LLM、IDE、编码代理和搜索系统理解。

### 优化以获得更好的 AI 回答

GitBook 负责交付层，但你的写作仍然很重要。

清晰的标题、简短的章节、具体的示例和最新信息都能同时帮助人类和 AI 系统。如果你想改进 ChatGPT、Claude 和 Cursor 等工具对你文档的理解，先从 [适合 LLM 的文档](/docs/documentation/zh/ai-yu-sou-suo/llm-ready-docs.md).

### 保持翻译文档同步

如果你用多种语言发布文档，翻译质量也会影响 AI 回答。

[翻译](/docs/documentation/zh/gitbook-agent/translations.md) 可让你借助 GitBook Agent 本地化文档。更新源内容时，GitBook 可以让译文版本与这些变更保持同步。

### 有助于 AI 的写作指南

重点关注以下基础：

* 使用清晰的标题层级。
* 保持章节简短且具体。
* 包含具体示例和准确数值。
* 及时删除过时内容。

这些做法可以提升检索效果，减少歧义，并让回答更准确。

### 衡量代理如何使用你的文档

使用 [网站分析](/docs/documentation/zh/docs-site/insights.md) 用于跟踪来自 LLM 和 MCP 客户端的流量，并查看代理如何访问你的内容。


---

# 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://gitbook.com/docs/documentation/zh/getting-started/ai-documentation/optimizing-for-ai.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.
