Skill Learning

retro

1. Bilingual SKILL.md

左右滑动可直接切换英文版与中文版;两种语言按段落自动对齐。英文中的蓝色虚线词语可点击查看解释。共标记 16 处。

入口 skill:retro左右滑动切换语言 · 段落位置自动对齐
The user has asked for a ****. You are suggesting improvements to the coding agent's **environment** to improve future runs.
## Steps
1. Call the Skill tool with `writing-for-agents` for the writing style guide.
2. Read the for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.
3. Look for in these categories.
- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **** make it easier? _Use when_ the session took a long time to find a piece of information. - **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a , not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all. - **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a , full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **** (cross-file consistency, "matches the surrounding style," anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake. - **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope. - **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call. - **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy. - **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.
4. Present these candidates to the user, .
## Reference
### Implementation vs Review
Remember that all work goes through two stages: implementation and review. The implementation agent has the most ****. They are responsible for exploration, writing code, and debugging failures.
The review agent has the least - it receives a diff, so no exploration needed. It often does not need to write code or debug.
This means that the review agent should be responsible for imposing coding standards, not the implementation agent.
### Files
You have access to several files in the repo:
- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be , usually only for **s** to other files. - `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **s** to docs folders if the standards file gets more than 1,000 lines long. - Docs: use docs as references files, . Look for existing docs before writing new ones. - Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.
用户请求进行一次**复盘(retrospective)**。你要针对编码代理的**环境(environment)**提出改进建议,以改善未来的运行。
## 步骤
1. 使用 Skill 工具调用 `writing-for-agents`,获取写作风格指南。
2. 阅读用户所指定会话的一手资料。这可能意味着要搜索本机上的会话日志。如果用户没有指定会话,则默认使用当前会话。
3. 在以下类别中寻找改进候选项。
- **导航(Navigation)**:代理找到正确文件有多容易?文件之间是否存在隐藏依赖?增加一个**导航指针(navigation pointer)**会不会更容易?_适用时机_:该会话花了很长时间才找到某条信息。 - **自动检查(Automated checks)**:是否有自动检查能够捕获代理犯下的错误?例如 lint、类型检查、测试、文件系统 linter?先读取仓库自己的检查命令(其 `package.json` / 构建工具中的 `lint` / `check` 脚本及 CI 工作流),这样,如果某个检查已经存在却没有接入流程或悄无声息地失效,发现项就应是这个问题,而不是重新发明一套检查。一个没有任何**护栏(guardrail)**的仓库(没有 pre-commit hook,也没有运行 lint / typecheck / test 命令的 CI job)本身就是一项发现:未经 lint 的仓库是一个长期存在的错失机会,而不是中性的默认状态。_适用时机_:代理犯了本可被自动检查捕获的错误,或仓库根本没有护栏。 - **编码标准(Coding standards)**:是否应该给**审查代理(reviewer agent)**一条需要执行的新规则?是否应该删除或澄清现有规则?先对违规进行分类:**机械性(mechanical)**违规(固定语法模式、禁用 API、导入形态或文件位置规则)必须落实为确定性检查,不再讨论:可以是仓库自有 linter 的自定义规则、新的 pre-commit hook 或新的 CI job,选择取决于仓库语言和现有护栏下哪一种成本最低。默认优先构建检查,而不是撰写规则。`CODING_STANDARDS.md` 只保留真正的**判断事项(judgement calls)**(跨文件一致性、“与周围风格匹配”,或任何护栏都无法替代的事项)。_适用时机_:审查代理没能捕获某个错误。 - **全局 AGENTS.md(Global AGENTS.md)**:是否有 steering 指令应改放到编码标准(或自动检查)中?_适用时机_:仓库级或用户全局范围内的 AGENTS.md 文件特别庞大。 - **工具经济性(Tool economy)**:代理是否进行了本可精简的高成本工具调用?是否存在 token 效率特别低的自定义工具(CLI、MCP)?_适用时机_:代理进行了一次高成本工具调用。 - **无效操作(No-ops)**:寻找 steering 文件中不会改变代理行为的指令。_适用时机_:steering 文件庞大而笨重。 - **信息访问(Information access)**:寻找增加代理信息访问能力的机会,例如把开发服务器日志同时写入文件,或提供第三方服务的只读访问权限。_适用时机_:代理无法取得一项关键信息。
4. 按严重程度排序,将这些候选项呈现给用户。
## 参考
### 实现与审查
请记住,所有工作都会经历两个阶段:实现和审查。实现代理承受最大的**上下文压力(context pressure)**。它负责探索、编写代码以及调试故障。
审查代理承受的上下文压力最小——它接收的是一个 diff,因此无需探索。它通常也不需要编写代码或调试。
这意味着,负责施加编码标准的应当是审查代理,而不是实现代理。
### 文件
你可以访问仓库中的若干文件:
- `CLAUDE.md` / `AGENTS.md`:这些文件会被推送到任何在该仓库中工作的代理的上下文窗口。应当极其克制地使用它们,通常只用来提供指向其他文件的**导航指针**。 - `CODING_STANDARDS.md`:该文件在审查阶段读取,而不是实现阶段。如果标准文件超过 1,000 行,请加入指向 docs 文件夹的**导航指针**。 - Docs:把 docs 用作参考文件,并由其他文件指向它们。撰写新文档前先查找已有文档。 - Skills:用 skills 承载文档(因为它们的 description 会进入代理上下文窗口),或承载用户主动调用的命令。遵循 `writing-for-agents` skill 中的建议。

Entry SHA-256: 33fbc28568e3146f20fd908b12998bc0ab30aa4f4c87288199a40793efa94696

2. Why This Skill Is Clever

一句话核心机制

retro 把一次会话里的具体摩擦转化为环境层改进候选,并用“机械问题进自动检查、判断问题进审查标准”的分流规则,避免把所有教训都堆进全局提示词。

触发与边界

Direct source: disable-model-invocation: true 明确它只能由用户主动触发;若用户没有指定会话,则读取当前会话。它审视的是编码代理的环境,而不是直接修复本次代码产物,最终只按严重程度提出候选项。

Supporting context: agents/openai.yaml 同时设置 allow_implicit_invocation: false,再次确认了显式调用边界;配套文档说明典型入口是 /retro,并将代码质量结论交给 code-review。

Interpretation: 这是一道有意的人在回路(human-in-the-loop)闸门:复盘可以自主发现问题,但永久改变规则、检查或访问权限之前仍由用户选择。

信息架构 / 执行顺序

  1. 先加载 writing-for-agents,统一后续建议的写作方式。
  2. 读取用户指定会话的原始记录;未指定时回到当前会话。
  3. 从七类环境问题中寻找有会话证据的候选:导航、自动检查、编码标准、全局指令、工具经济性、无效指令和信息访问。
  4. 对违规先做关键分类:机械问题默认落实为可失败的确定性检查;真正的判断问题才写进审查标准。
  5. 按严重程度向用户呈现候选,不在这一阶段自动修改环境。

最巧妙的设计点

  1. “the coding agent's environment”
    - Direct source: 目标对象被限定为代理环境。
    - 机制不是修补单次症状,而是追问仓库为什么允许问题发生,再改入口、检查、标准或信息通道。
    - 这样能让一次会话的成本产生跨会话收益。

  2. “Read the primary sources for the session”
    - Direct source: 复盘必须先读会话的一手记录。
    - 它把泛泛而谈的“最佳实践生成器”约束成证据驱动诊断器。
    - 这能降低为了填满分类而编造通用建议的风险。

  3. “a check that already exists but sits unwired or silently broken is the finding”
    - Direct source: 先读取仓库已有检查命令和 CI,再决定是否需要新机制。
    - 它优先修复断开的反馈回路,而不是看到问题就重复建设。
    - 这同时控制维护成本,并揭示“已有能力未真正生效”这种更深层故障。

  4. “a mechanical one ... gets a deterministic check, full stop”
    - Direct source: 固定模式违规必须进入 linter、pre-commit 或 CI。
    - 规则类型决定承载介质:机器能判定的交给机器,只有机器无法替代的判断才留给文字。
    - 这避免“把自动化问题写成一句容易被忽略的提示词”。

  5. “The review agent has the least context pressure”
    - Direct source: 实现代理承担探索、编码和调试,审查代理只接收 diff。
    - 因此编码标准由审查阶段施加,而不是继续挤占实现阶段的上下文。
    - 这不是简单减少文本,而是按角色的信息负载重新安排规则。

  6. “used incredibly sparingly”
    - Direct source: CLAUDE.md / AGENTS.md 只应极少使用,通常仅保留导航指针。
    - 详细知识留在 docs 或 skills,由入口文件按需指向。
    - 这形成“常驻上下文只放索引、详细内容按需加载”的分层信息架构。

防失败机制与 trade-off

显式不变量: 必须读会话原始材料;先检查仓库现有命令与 CI;机械违规默认自动化;全局 steering 文件保持精简;输出按严重程度排序。

失败预防: 七个分类提供观察面,但每个分类都附带 _Use when_ 条件,避免无证据地把所有类别填满。CODING_STANDARDS.md 只接收判断问题,也防止审查规则膨胀成另一份无法执行的提示词。

Trade-off: 单次会话证据可能放大偶发问题,严重程度排序也包含判断成分。Skill 本身没有定义候选的接受、实施和验证闭环,因此用户选中候选后,仍需用对应工程流程实现并真实运行检查。

可移植性风险: Skill tool、disable-model-invocation 和 agents/openai.yaml 都依赖具体 harness;CLAUDE.md、AGENTS.md、pre-commit 与 CI 的实际位置也因仓库而异。迁移时应保留“证据 → 分类 → 合适承载层”的原则,而不是照抄文件名。

可迁移原则

今日实践题

如果代理三次使用了同一个已禁用 API,你会把教训写进 AGENTS.md、CODING_STANDARDS.md,还是仓库 linter?请用本 Skill 的“机械问题 / 判断问题”分流规则解释原因。

Evidence note

选中原文直接支持触发边界、执行步骤、七类观察面、机械与判断问题的分流,以及实现 / 审查的上下文分工。agents/openai.yaml 和配套 docs 只作为调用与产品边界的 supporting context;“人机闸门”和“跨会话收益”属于设计 interpretation,并非原文逐字承诺。

Source & provenance
Repository path
skills/engineering/retro/SKILL.md
Generated
2026-10-02 08:23 Asia/Shanghai
Upstream commit
d81f3a183412e71a5b1e84ca21bc1a35eea03a60
Source
View on GitHub