再学 AI
第 20 课 / triage
当前 · 工程阅读 → 对照 → 问答 → 场景

把外来问题整理为下一步可处理的状态

分诊回答的是这条请求现在该怎样处理,而不是直接宣布它已经修好。

还不清楚 Skill、Agent、安装和调用?先读 从零开始的6节入门课

在关系图中查看 triage 与其他技能的关联 →

先把必要的概念讲清楚

分诊是把未经整理的输入变成适合下一步处理的任务。它回答“这是什么、资料够不够、谁能处理”,不是立即解决每个问题。

下面是老师补充的入门说明;原作者的要求保留在中英对照正文中。所有例子均为帮助理解而构造的教学情境。

issue / ticket|问题或任务工单

跟踪一项需求、缺陷、调查或实施任务的记录,通常有标题、正文、状态和引用。issue 和 ticket 在这些文档里经常都指工单,具体含义由上下文决定。工单写着“已完成”只是状态声明,还需要相应证据支持。

state machine|状态与允许的转换

列出对象可能处于哪些状态,以及什么事件允许它从一个状态变为另一个。例如工单从待澄清到可执行,再到实施中,最后验收完成。不能仅因为“写完代码”就跨过验收。状态机让进度含义明确,而不仅是漂亮的标签。

acceptance criteria|验收条件

明确规定结果满足什么才算完成,应尽量可观察、可检验。例如“收藏后刷新页面仍可见,重复点击只保留一条”。“体验很好”“代码完善”没有明确边界,难以判断。验收条件关注结果,不是把实现步骤换个标题列出来。

spec / specification|规格说明

把要解决的问题、预期行为、约束和验收依据写明确的文档。它比“做个好用的学习网站”具体:例如登录用户能收藏课程,刷新后仍保留,重复收藏不会多出记录。它不必规定每个内部函数怎么写,但应让实现者和验收者对同一结果达成一致。

读原文,理解每一步为什么这样做

左右内容按小节对应;窄屏先中文、后英文。两种语言均完整展示,对应讲解紧接在小节之后。译文传达原文要求;老师讲解补充概念、原因、例子与适用边界。

中文译文English · 英文原文
中文译文
name: triage
description: "通过分诊角色的状态机处理工单和外部 PR:分类、验证、必要时访谈,并编写 Agent 可执行简报。"
disable-model-invocation: true
English · 英文原文
name: triage
description: Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
disable-model-invocation: true
中文译文

对反馈和工单进行分诊

通过一套由类别和状态组成的小型状态机,推动项目工单进入适当的处理状态。

如果项目把外部提交的 PR 也作为接收需求的入口,那么分诊也应覆盖这些 PR,具体以工单系统配置为准。可以把 PR 看成一张附带了代码的工单:它使用相同的角色、状态和流转方式,只在下面特别标注“对于 PR”的地方有所区别。用户只说 #42 时,应按项目配置判断它指的是 issue 还是 PR。

在分诊过程中,凡是发布到工单系统的评论或工单,都必须以这段声明开头:

> *This was generated by AI during triage.*

声明的中文意思是:“本内容由 AI 在分诊过程中生成。”

English · 英文原文

Triage

Move issues on the project issue tracker through a small state machine of triage roles.

If this repo treats external pull requests as a request surface (see the issue-tracker config), triage covers them too: a PR is an issue with attached code, using the same roles, same states, and same machine, with a few deltas marked "for a PR" below. Resolve a bare #42 to an issue or PR per the tracker config.

Every comment or issue posted to the issue tracker during triage must start with this disclaimer:

> *This was generated by AI during triage.*
中文译文

参考文档

  • AGENT-BRIEF.md:说明怎样编写一份后续 Agent 仍能使用的任务简报。
  • OUT-OF-SCOPE.md:说明 .out-of-scope/ 知识库如何运作。
English · 英文原文

Reference docs

中文译文

类别与状态

有两种类别角色

  • bug:已有行为出现了故障。
  • enhancement:新增功能,或者改善现有功能。

有五种状态角色

  • needs-triage:需要维护者进一步评估。
  • needs-info:正在等待报告者补充信息。
  • ready-for-agent:任务已经描述充分,可以交给无人值守的 Agent 执行。
  • ready-for-human:需要由人完成实现。
  • wontfix:决定不采取处理行动。

对于 PR,要结合它已经附带的代码来理解这些状态。ready-for-agent 表示已经附上任务简报,下一步应由 Agent 继续处理这份代码差异;ready-for-human 则表示可以交给人合并。

每张经过分诊的工单,应当恰好有一个类别角色和一个状态角色。如果发现同一张工单的状态互相冲突,先指出问题并询问维护者,再做其他事情。

上面列出的是这套方法中的标准角色名称。工单系统实际使用的标签文字可能不同,因此需要一份对应关系。如果还没有得到该配置,就告诉用户运行 /setup-matt-pocock-skills

通常,一张没有标签的工单先进入 needs-triage。评估之后,再转为等待补充信息、可交给 Agent、可交给人,或决定不处理。处于 needs-info 的工单收到报告者回复后,应回到 needs-triage 重新评估。维护者可以随时直接调整状态;如果某次状态变化显得不寻常,应先提醒维护者并询问,再继续执行。

English · 英文原文

Roles

Two category roles:

  • bug: something is broken
  • enhancement: new feature or improvement

Five state roles:

  • needs-triage: maintainer needs to evaluate
  • needs-info: waiting on reporter for more information
  • ready-for-agent: fully specified, ready for an AFK agent
  • ready-for-human: needs human implementation
  • wontfix: will not be actioned

For a PR, the same states read against the attached code: ready-for-agent means a brief is attached and an agent should take the next step on the diff; ready-for-human means it's ready for a human to merge.

Every triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.

These are canonical role names. The actual label strings used in the issue tracker may differ. The mapping should have been provided to you. If not, tell the user to run /setup-matt-pocock-skills.

State transitions: an unlabeled issue normally goes to needs-triage first; from there it moves to needs-info, ready-for-agent, ready-for-human, or wontfix. needs-info returns to needs-triage once the reporter replies. The maintainer can override at any time; flag transitions that look unusual and ask before proceeding.

老师讲解 · 对应上方原文 · 含教学举例

状态角色比标签拼写更重要

needs-triage 表示还需判断,needs-info 表示缺少必要资料,ready-for-agent 表示适合 Agent 接手,ready-for-human 表示需要人的参与,wontfix 表示决定不处理。具体标签名称可以按项目映射。

例子:“页面坏了”通常还缺复现和预期,应补资料;“第 3 课英文栏在某宽度被遮挡,附步骤与截图”更接近可处理;涉及你个人账户验证的事项可能需人处理。

状态不是对人的评价,也不是越往后越优秀。它主要表达下一步怎样推进。ready 不等于已修复,wontfix 也应有可理解的理由。

类别说是什么问题,状态说下一步由谁处理

用户报告收藏后刷新就消失,类别可能是 bug,但状态不一定能立即设为 ready-for-agent。缺复现步骤时,应先等待信息。

已掌握情况 状态 下一步
刚收到反馈,尚未评估 needs-triage 查看并验证
不知道怎样触发 needs-info 提具体问题
已验证,目标和检查方式齐备 ready-for-agent 可领取实现

“请提供更多信息”让报告者不知道补什么。可以问“是刷新当前页面,还是退出后再登录;能否给出连续复现的顺序”。回答应帮助推进,而不是完成一轮形式上的询问。

已实现和被拒绝也不同。功能存在但没找到,应指出位置;不符合产品范围的请求,才记录拒绝理由。创建标签不能替代任务内容充分,关闭工单也不能自动证明错误已修复。

中文译文

如何调用

维护者调用 /triage,再用自然语言说明想做什么。Agent 应理解请求并采取相应行动,例如:

  • “把所有需要我关注的事情列出来。”
  • “我们看一下 #42。”这里可能指 issue,也可能指 PR。
  • “将 #42 改为 ready-for-agent。”
  • “哪些任务已经可以交给 Agent 领取?”
English · 英文原文

Invocation

The maintainer invokes /triage and describes what they want in natural language. Interpret the request and act. Examples:

  • "Show me anything that needs my attention"
  • "Let's look at #42" (issue or PR)
  • "Move #42 to ready-for-agent"
  • "What's ready for agents to pick up?"
中文译文

展示需要关注的事项

查询工单系统,按时间从早到晚展示以下三组:

  1. 没有标签的工单:尚未进行分诊。
  2. 标为 needs-triage 的工单:仍在评估过程中。
  3. 标为 needs-info,且报告者在上次分诊记录之后又有活动的工单:现在需要重新评估。

如果项目将 PR 纳入分诊,就同时列出符合条件的外部 PR,并在每一行标明 [PR][issue]。主动查找时,只列出项目配置定义为“外部”的贡献者所提交的 PR;协作者正在处理的 PR,不自动当作新的分诊工作。

这项过滤只适用于主动查找。如果用户明确点名某一份 PR,就应处理那份 PR,而不论提交者是谁。

展示各组数量,并为每一项写一句摘要,再由维护者选择接下来处理哪项。

English · 英文原文

Show what needs attention

Query the issue tracker and present three buckets, oldest first:

  1. Unlabeled: never triaged.
  2. needs-triage: evaluation in progress.
  3. needs-info with reporter activity since the last triage notes: needs re-evaluation.

When PRs are in scope, include external PRs in these buckets and tag each line [PR] or [issue]. Discovery surfaces only external PRs (the tracker config defines who counts as external), so a collaborator's in-flight PR is not triage work. This filter is discovery-only; an explicitly named PR is always triaged regardless of author.

Show counts and a one-line summary per item. Let the maintainer pick.

老师讲解 · 对应上方原文 · 含教学举例

浏览队列与处理单个工单是两种工作

你只想知道现在有哪些事项需要关注时,先列队列和状态即可;指定某个工单时,再按流程判断资料、范围与下一步。不应因为打开看板就自动开始修改所有事项。

外部 PR 是否进入请求队列,要遵循配置。PR 除了代码,也可能被当作请求入口,但默认范围不能凭工具能读到什么就扩张。

分诊应读取已有讨论,避免反复向用户询问已经回答的问题。对作者直接生成、已经可执行的实施工单,也不应无缘无故再走一遍完整分诊。

中文译文

处理指定的 issue 或 PR

  1. 收集完整背景。 阅读工单或 PR 的全部内容,包括正文、评论、标签、作者和日期。对于 PR,还要阅读代码差异。先理解已有分诊笔记,避免再次询问已经解决的问题。查看代码时使用项目业务术语,并遵循相关区域的架构决策记录。

    接着,针对代码库做两项检查:

    • 是否已经实现。 按业务概念搜索请求中的行为,而不只是搜索报告者使用的字面措辞。说明查看过哪些位置。如果找到已有实现,就按第 5 步中“已经实现”的 wontfix 情形处理。
    • 是否以前拒绝过。 阅读 .out-of-scope/*.md,指出其中是否存在与本次请求相似的记录。
  2. 提出建议。 告诉维护者你建议采用哪一种类别和状态,解释理由,并简要说明相关代码现状,包括该功能是否已经实现。然后等待维护者指示。

  3. 验证报告中的说法。 在进入深入追问之前,先检查报告的情况是否成立。对于 bug,按照报告者提供的步骤复现。对于 PR,检出它的代码,运行相关测试或命令,确认代码改动是否真的实现了所声称的行为。

    报告实际结果:已经确认,并给出相关代码路径;验证失败;或者信息不足,无法完成验证。信息不足通常是应转入 needs-info 的明显信号。经过实际验证,后续任务简报才会有更坚实的依据。

  4. 需要时再深入追问。 如果请求仍需要补充细节,就分别通过 Skill 工具加载 grillingdomain-modeling。一轮一轮问清需求,同时把业务用词变准确;概念和决定一旦明确,就及时更新 CONTEXT.md 或相关 ADR。

  5. 落实最终处理结果。 按选定状态采取对应行动:

    • ready-for-agent:按 AGENT-BRIEF.md 发布一条任务简报评论。
    • ready-for-human:使用相同的简报结构,同时说明为什么不能委托给 Agent,例如需要人的判断、外部访问能力、设计决定或手动测试。
    • needs-info:按照后面的模板发布分诊笔记。
    • wontfix:关闭工单,但评论内容要区分具体原因。如果已经实现,指出实现位于哪里,不要写入 .out-of-scope/,因为这个知识库记录被拒绝的请求,不记录已经完成的能力。如果是拒绝处理的 bug,礼貌说明原因后关闭。如果是拒绝的功能增强请求,先写入 .out-of-scope/,在评论中链接该记录,再关闭工单。
    • needs-triage:设置对应角色。如果已经取得部分进展,可以补充评论,但不是每次都必须评论。
English · 英文原文

Triage a specific issue or PR

  1. Gather context. Read the full issue or PR (body, comments, labels, author, dates; for a PR, the diff too). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the project's domain glossary, respecting ADRs in the area. Run two checks against the codebase: (a) redundancy: search for an existing implementation of the requested behavior by domain concept (not just the request's wording), and report where you looked. If found, it's an already-implemented wontfix (step 5). (b) prior rejection: read .out-of-scope/*.md and surface any that resembles this request.

  2. Recommend. Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the request (including whether it's already implemented). Wait for direction.

  3. Verify the claim. Before any grilling, check that the claim holds up. For a bug, reproduce it from the reporter's steps. For a PR, confirm the diff does what it claims: check it out, run the relevant tests or commands. Report what happened: confirmed (with code path), failed, or insufficient detail (a strong needs-info signal). A confirmed verification makes a much stronger agent brief.

  4. Grill (if needed). If the request needs fleshing out, call the Skill tool twice, for "grilling" and "domain-modeling", and grill it into shape a round of questions at a time, sharpening domain terms and updating CONTEXT.md/ADRs inline as decisions land.

  5. Apply the outcome:

    • ready-for-agent: post an agent brief comment (AGENT-BRIEF.md).
    • ready-for-human: same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).
    • needs-info: post triage notes (template below).
    • For wontfix, close the issue, with the comment depending on why:
      • Already implemented: the change already exists in the codebase. Point to where it lives; do not write to .out-of-scope/ (that KB is for rejected requests, not built ones).
      • Rejected (bug): give a polite explanation, then close.
      • Rejected (enhancement): write to .out-of-scope/, link to it from a comment, then close (OUT-OF-SCOPE.md).
    • needs-triage: apply the role. Optional comment if there's partial progress.
中文译文

维护者直接指定状态

如果维护者明确说“把 #42 改为 ready-for-agent”,就信任维护者的判断,直接应用该状态。先说明准备进行哪些操作,包括改标签、发评论或关闭工单,然后执行。此时跳过深入访谈。

如果没有经过访谈就直接改为 ready-for-agent,应询问维护者是否希望编写一份任务简报。

English · 英文原文

Quick state override

If the maintainer says "move #42 to ready-for-agent", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to ready-for-agent without a grilling session, ask whether they want to write an agent brief.

中文译文

等待补充信息时的模板

## 分诊笔记

**目前已经确认的内容:**

- 事项 1
- 事项 2

**还需要你(@reporter)补充的内容:**

- 问题 1
- 问题 2

把访谈中已经解决的事项全部记录在“目前已经确认的内容”下,避免前面的工作丢失。需要补充的问题必须具体、让对方知道怎样回答,不能只写一句“请提供更多信息”。

English · 英文原文

Needs-info template

## Triage Notes

**What we've established so far:**

- point 1
- point 2

**What we still need from you (@reporter):**

- question 1
- question 2

Capture everything resolved during grilling under "established so far" so the work isn't lost. Questions must be specific and actionable, not "please provide more info".

老师讲解 · 对应上方原文 · 含教学举例

缺资料时提出能解锁工作的具体问题

“请提供更多信息”不够用。缺信息记录应说明当前理解、哪一项事实还未知、希望提供什么,以及得到后能做哪个决定。

例如“请说明用手机还是电脑、在哪一课、出现遮挡前如何操作;这能判断是否是响应式布局问题”。不需要一次让用户填写所有环境信息,只问与当前阻塞有关的内容。

记录分诊笔记能够让下一次会话知道哪些已查、哪些还没确认。重复进入时应接着处理剩余问题,不能把状态字段清空重来。

中文译文

继续上一次会话

如果 issue 或 PR 上已经有分诊笔记,先阅读这些记录,检查报告者是否回答了尚未解决的问题,再向维护者展示更新后的情况,之后才继续工作。不要再次询问已经回答的问题。

English · 英文原文

Resuming a previous session

If prior triage notes exist on the issue or PR, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.

老师讲解 · 对应上方原文 · 含教学举例

恢复会话时,依据记录与新事实接续

旧分诊结论可能因新资料改变,例如补充步骤后发现是浏览器缓存,而非页面错误。要把新证据与旧判断区分,保留为什么更改状态的理由。

快速状态覆盖提供便利,但它不会自动补齐缺失证据。手动改成 ready-for-agent 后,下一位仍需要足够明确的行为和验收条件才能工作。

学习本课的合格表现是:你能把一个模糊投诉转成清楚的下一步,并说明目前为什么可以或不可以实施。

原作者:Matt Pocock · 中文翻译为非官方译本

来源:skills/engineering/triage/SKILL.md ↗

固定版本:3cca18b368ae95cdbdebbff572ccafa662551015

配套参考资料(英文)

先作答,再看参考思路

Q1 · 理解

用自己的话说明:它解决什么问题,完成后会留下什么?

请各用一句话回答。若它只做规划或解释,不要把“已开发”“已部署”写成产物。

Q2 · 判断

ready-for-agent 与 completed 有什么不同?

我已思考,查看参考思路

前者意味着描述足够明确,可以交给 Agent;后者需要实际实现及验收证据。把就绪当完成会让看板失真。

Q3 · 追问

原文中哪条要求在你的环境下可能不成立?

说出具体一句及其前提,例如工具不可用、资料缺失、已有项目约定冲突,或它只是作者偏好。把你的答案带回课堂,我们据此继续讨论。

课堂回传格式:第 20 课 / 我的理解 / Q2 回答 / 仍不理解的原句。这里是阅读教材;实时问答在我们的对话中进行。

把方法放进一个具体情境

教学案例:“文章打不开”没有链接或复现步骤,应归为信息待补;确认某功能已经存在,则给出所在位置,不应新建重复开发任务。拒绝需求与已经实现是不同原因。

边界与容易误读的地方

状态标签不能证明执行活性。原文包含评论和关闭操作,真实使用时必须遵守项目授权与平台权限;教材讨论不触发这些操作。

讨论后再实践:先判断上述情境是否适用,再选择真实任务。现在无需安装、运行命令或修改现有项目。

关联阅读