retro
用户要求对一次编码会话做回顾。你要建议改进编码代理的工作环境,帮助它之后表现得更好。
-
调用 Skill 工具,使用
writing-for-agents获取写作风格指南。 -
阅读用户指定会话的主要资料。这可能需要搜索这台机器上的会话日志。如果用户没有指定会话,就默认使用当前会话。
-
从以下类别中寻找改进机会。
- 导航:代理找到正确文件的过程是否顺畅?文件之间是否有隐藏的依赖关系?添加一个导航指引会不会更方便?适用情况:会话花了很长时间才找到某项信息。
- 自动检查:有没有自动检查能发现代理犯的错误?例如 lint、类型检查、测试、文件系统检查器。先阅读仓库自己的检查命令,包括
package.json、构建工具中的lint或check脚本,以及 CI 工作流。如果已有检查却没有接入流程,或检查没有运行,那才是要指出的问题,不要重新发明检查。仓库没有防护措施也算一个问题:既没有 pre-commit hook,也没有 CI 任务运行 lint、类型检查或测试命令。没有 lint 检查的仓库,持续错失了发现问题的机会。 - 编码规范:是否应该给审查代理增加一条新规则?是否应该删除或澄清现有规则?先判断违规类型:如果是机械性问题,例如固定的语法模式、禁用的 API、导入格式或文件位置,就直接加确定性检查,例如仓库自己的 lint 规则、新的 pre-commit hook,或新的 CI 任务,选择最符合项目语言和现有防护措施的低成本方案。默认优先构建检查,不要只写规则。只有真正需要判断的问题才写入
CODING_STANDARDS.md,例如跨文件一致性、「符合周围代码的风格」这类无法用防护措施替代的要求。适用情况:审查代理没有发现错误。 - 全局 AGENTS.md:是否应该把某些指导从 AGENTS.md 移到编码规范或自动检查里?适用情况:仓库中的 AGENTS.md 或用户全局范围内的文件特别大。
- 工具开销:代理是否调用了成本很高的工具?能否简化?有没有特别耗 token 的自定义工具、CLI 或 MCP?适用情况:代理调用了昂贵的工具。
- 无效指令:指导文件里有没有不影响代理行为的指令?适用情况:指导文件又大又难用。
- 信息获取:有没有办法让代理更容易获得所需信息?例如提供开发服务器日志,或第三方服务的只读访问权限。适用情况:代理无法获取完成任务所需的关键信息。
- 按严重程度从高到低向用户列出这些候选改进。
所有工作都分为两个阶段:实现和审查。实现代理承受的上下文压力最大,要负责探索、编写代码并排查失败。
审查代理承受的上下文压力最小,因为它只需要查看差异,不必探索。它通常也不需要编写代码或排查问题。
因此,应由审查代理负责落实编码规范,而不是实现代理。
你可以访问仓库中的这些文件:
CLAUDE.md/AGENTS.md:这些文件会进入每个代理的上下文。应尽量少写,通常只放指向其他文件的导航指引。CODING_STANDARDS.md:审查时会读取这个文件。如果它超过 1,000 行,就在里面添加指向文档目录的导航指引。- 文档:先找已有文档,再考虑新建。把文档作为参考资料,由其他文件指向它们。
- Skills:文档类内容适合放进 skill,因为 skill 的描述会进入代理的上下文。用户点名调用的命令也适合写成 skill。遵循
writing-for-agentsskill 的建议。
原文链接和 commit
Section titled “原文链接和 commit”读者要自己输入 /retro 才会用到它。它在 Claude Code 插件里。
回顾一次编码会话,从导航、自动检查、编码规范和工具开销等方面找出改进代理工作环境的机会。
Conduct a retrospective on a coding session.- 仓库 mattpocock/skills
- 文件
skills/engineering/retro/SKILL.md - 提交
d81f3a1 - 说明页
docs/engineering/retro.md - 同目录文件
skills/engineering/retro/agents/openai.yaml
英文 SKILL.md
---name: retrodescription: "Conduct a retrospective on a coding session."disable-model-invocation: true---
The user has asked for a **retrospective**. 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 primary sources 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 candidates for improvement in these categories.
- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** 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 sits unwired or silently broken 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 standing missed opportunity, 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 deterministic check, 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 **judgement calls** (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, in order of severity.
## Reference
### Implementation vs Review
Remember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.
The review agent has the least context pressure - 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 used incredibly sparingly, usually only for **navigation pointers** to other files.- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.- Docs: use docs as references files, pointed to by other 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.非官方学习站,与 Matt Pocock 和 AI Hero 没有隶属关系。本站不提供可安装的中文技能包。
技能原文采用 MIT 许可。Copyright (c) 2026 Matt Pocock