48  设置例行任务

Claude Tag 运行你从频道设置的例行任务。了解计划任务、频道监控、Pull Request 订阅、可直接粘贴的例行任务配方,以及如何列出或暂停常驻工作。

export const BetaNote = () => Claude Tag 目前处于公开测试阶段。此处描述的功能和行为在正式发布前可能会发生变化。;

你可以在 Claude 所在的任何频道给它常驻工作。这些常驻工作称为例行任务(Routine):按计划运行的任务,如监控频道、跟踪 Pull Request 或发布状态更新。你在应该运行的频道中设置例行任务,它使用该频道的连接和与手动请求相同的权限。

48.1 设置常驻工作

48.1.1 计划任务

在一条消息中描述你想要的计划和 Claude 应该做的工作:

text wrap theme={null} @Claude every weekday at 9am, read the open threads in this channel, check the tickets and pull requests linked in them, and post a one-line status per item. Skip anything with a ✅ reaction.

在任务中说明输出格式,使重复发布的帖子保持可读性。

48.1.2 监控频道

要求 Claude 监控指定频道并在有匹配话题的内容时发布到这里:

text wrap theme={null} @Claude watch #product-announce, #eng-announce, and #design-announce. Once a day, post here if anything is relevant to user education. Skip days with nothing.

同时指定频道和话题是保持监控有用的关键。监控也可以覆盖当前频道(“keep an eye on this channel and post a morning summary”)。

48.1.3 跟踪 Pull Request

Claude 可以订阅单个 Pull Request 并在其更新时做出反应。

text wrap theme={null} @Claude subscribe to PR #482 in acme/data-pipeline. When CI finishes or a review lands, post here, and tag me if anything failed.

48.2 例行任务配方

以下每个配方用一条消息设置一个完整的例行任务。将频道名、仓库名和时间调整为你的,并说明时区使计划按你期望的时间触发。

48.2.1 每日站会摘要

Claude 在团队开始新一天之前发布关于开放线程和等待某人处理的内容的晨间汇总。

text wrap theme={null} @Claude every weekday at 9am Pacific, post a summary of open threads in this channel and anything that looks like it's waiting on someone.

“Waiting on someone”使汇总突出行动而非仅回顾;Catch up有一次性版本。

48.2.2 每周频道摘要

Claude 在每周结束时发布一次总结,使频道有一个统一的地方查看本周发生了什么。

text wrap theme={null} @Claude every Friday at 3pm Eastern, post a digest of this week in this channel: what got decided, what's still open, and anything waiting on someone.

对于接收频道,Triage requests版本的汇总还会扫描从未 @ Claude 的帖子。

48.2.3 跟踪 Pull Request 直到合并

Claude 订阅单个 Pull Request 并在 CI、评审和合并过程中发布更新。

text wrap theme={null} @Claude subscribe to PR #482 in acme/data-pipeline. Post here when CI finishes, a review lands, or it merges, and tag me if anything failed.

跟踪 Pull Request说明了订阅对什么做出反应。

48.2.4 监控告警时触发调查

Claude 按计划检查告警仪表板并为任何新告警发布初步诊断,使调查在任何人提问之前就开始。此配方需要监控连接,如 Datadog 或 PagerDuty;监控告警有完整设置。

text wrap theme={null} @Claude every two hours, check the alerting dashboard against its last state. For anything new, post when it started, what changed around then, and what to look at first.

此例行任务仅在发生变化时发布,而非每次检查都发布。

48.2.5 新请求的自动分发

Claude 在请求到达时回答、去重和路由。此配方是一个常驻角色而非计划;“remember for this channel”将其保存到频道记忆,因此适用于所有人的线程。

text wrap theme={null} @Claude remember for this channel: when someone tags you on a request, check whether it duplicates something already reported, answer it directly if the answer exists, and otherwise route it to the right owner with a one-line summary.

搭配每周汇总使未 @ 的帖子也被扫描;Triage requests包含两条消息。

48.3 管理常驻工作

频道中的任何人都可以列出、编辑或禁用其常驻工作:

  • 列出。 问”what routines do you have set up in this channel?“,或发送 @Claude !routines。添加频道提及或其 ID,如 @Claude !routines #other-channel,列出其他频道的例行任务;从 Slack 的自动补全中选择频道使其作为真正的提及发送,因为单独键入的名称不被接受。
  • 编辑。 描述更改,它会更新任务。
  • 禁用。 指出要停止的任务名,如”disable the Friday rollup”。

常驻工作对频道可见:任务发布到它们所属的频道中。例行任务在其创建者离开组织后继续运行,但在创建者被移出频道后停止触发。

一些边界适用:

  • 任务使用频道的连接,与交互式请求相同。
  • 计划默认使用 UTC。当你说”every weekday at 9am”时,包含时区(例如”9am Pacific”)使 Claude 正确转换;没有时区它可能会猜测。问”what triggers do you have set up?“来确认它实际安排的时间。
  • 涉及 github.com 仓库的计划任务使用管理员为交互式工作设置的同一 GitHub 连接。参见配置 GitHub 访问

48.4 相关资源

  • 用例库:每个条目都有可复制的主动形式
  • 提示词库:创建、审查和停止例行任务的提示词
  • 好习惯:编写可持续运行的计划