> ## Documentation Index
> Fetch the complete documentation index at: https://www.mintlify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mintlify agent 使用场景和示例

> 了解如何使用 Mintlify agent 在 Slack、拉取请求和 API 工作流中自动更新文档、生成代码示例、处理反馈、沉淀团队知识，并在产品发布后持续维护内容准确性。覆盖从 Slack 线程迭代提示词，到合并功能变更、生成发布说明和通过 API 创建任务的常见场景，帮助团队选择适合的文档维护方式。

agent 可以协助完成多种文档相关任务。以下示例展示了几种将 agent 集成到文档流程中的方式。选择一种适合你团队当前工作方式的方案，并根据你的具体需求进行调整。

<div id="iterate-on-a-prompt-in-a-slack-thread">
  ## 在 Slack 线程中迭代优化提示词
</div>

先向 agent 发送提示词，然后在同一条线程中继续使用 `@mintlify` 提及它，以便细化和迭代 agent 创建的拉取请求（PR；亦称“合并请求”或 Merge Request）。

例如：`@mintlify Our quickstart page needs a new section on inviting collaborators`。接着：`@mintlify The new section should be called "Inviting collaborators"`。然后再根据需要继续进行其他迭代。

<div id="start-with-the-agent-finish-manually">
  ## 从 agent 开始，由你手动完成
</div>

先向 agent 发送指令以启动一个项目，然后检出它创建的 branch，在本地环境或 Web 编辑器中完成任务。agent 可以帮助你起步，之后你可以接手完成整个任务。

例如：`@mintlify Update the quickstart page to include information about inviting collaborators`，然后检出该 branch，使用你喜欢的方式进行进一步修改。

<div id="update-docs-when-merging-feature-changes">
  ## 在合并功能变更时更新文档
</div>

当你合并功能变更的拉取请求（PR）时，将该 PR 的链接分享给 agent，让其更新相关文档。

例如：`@mintlify This PR adds a new authentication method. Update the docs to include the new auth flow: [PR link]`。

<div id="generate-release-notes-from-a-pull-request">
  ## 从拉取请求生成发布说明
</div>

向 agent 提供特定的拉取请求，让其根据提交历史生成发布说明或更新日志。

例如：`@mintlify Generate release notes for this PR: [PR link]`。

<div id="address-pull-request-review-feedback">
  ## 处理拉取请求评审反馈
</div>

将拉取请求链接分享给 agent，以便处理文档拉取请求中的审阅意见和代码评审反馈。

例如：`@mintlify Address the review comments on this PR: [PR link]`。

<div id="generate-code-examples">
  ## 生成代码示例
</div>

让 agent 在整份文档或特定页面中为各个功能生成代码示例。

例如：`@mintlify Generate a code example to make the authentication method easier to understand`。

<div id="add-images-or-files-to-your-docs">
  ## 向文档添加图片或文件
</div>

在向 agent 发送指令时，直接在 Slack 消息中附加文件或图片。agent 会处理附件并将其加入到文档中。支持的附件类型包括图片、PDF、SVG 以及其他文档。

例如：`@mintlify Add this diagram to the architecture overview page`，并在消息中附上该图片。

<div id="review-existing-content">
  ## 审查现有内容
</div>

让 agent 审查现有内容的技术准确性、写作风格、语法或其他问题。

例如：`@mintlify 请审查 API 限流部分。我们上个月更改了限制。`

<div id="respond-to-user-feedback">
  ## 回应用户反馈
</div>

根据用户的反馈向 agent 提问，以便对文档进行有针对性的更新。

例如：`@mintlify Users are getting confused by step 3 in the setup guide. What might be making it unclear?`。

<div id="automate-with-automations">
  ## 使用 Automations 实现自动化
</div>

创建自动化来处理重复性任务和响应式维护工作，例如在你为产品添加新功能时撰写更新日志或更新内容。

参见[自动化概览](/docs/zh/automations/index)了解更多信息。

<div id="automate-with-the-api">
  ## 使用 API 实现自动化
</div>

将 agent 集成到你现有的自动化工具中。当代码发生变更时，它可以自动更新文档、触发内容审查，或在多个代码仓库之间同步文档更新。

使用 agent 的 API 端点来[创建任务](/docs/zh/api/agent/v2/create-agent-job)、[获取任务状态](/docs/zh/api/agent/v2/get-agent-job)以及[发送消息](/docs/zh/api/agent/v2/send-message)。

通过 API 创建任务时，你可以使用 `asDraft` 参数（默认为 `false`）控制拉取请求是否以草稿模式打开。将 `asDraft` 设置为 `true` 以创建草稿拉取请求。保留默认值即可创建非草稿拉取请求，以便在自动化工作流中立即进行审查和合并。


## Related topics

- [指南](/docs/zh/guides/index.md)
- [示例](/docs/zh/components/examples.md)
- [AI 助手](/docs/zh/assistant/index.md)
