跳到正文
RadarAI· X:Lauren Tan(SpaceXSI,Grok Bot 工程负责人) (@poteto)·· 21 小时前AI 评分45

Lauren Tan 分享 pstack 的 /no-comments 技能,可让 agent 清理代码注释

AI 导读

Lauren Tan 在 X 上推荐 pstack 中的 /no-comments 技能,其链接指向 cursor/plugins 仓库的 SKILL.md,并建议让 agent 把它转成一条 lint 规则使用。该技能引用 Matt Pocock 的提示词,将代码注释分为同义重复、借口、过时、决策记录四类,分别执行删除、删除并提 issue 修复、删除、移入 ADR 的处理。

正文 · 原文

lauren· @poteto · X·2026-11-21 05:58· 35 分钟前AI 评分61

AI 导读

作者推荐尝试 pstack 中的 /no-comments 技能,链接指向 cursor/plugins 仓库中的 SKILL.md,并建议让 agent 把它转成一条 lint 规则使用。引用的 Matt Pocock 提示词将注释分为同义重复、借口、过时、决策记录四类,分别删除、修复或归档进 ADR,并建议创建 lint 规则和可复用的 /delete-comment 技能。

正文 · 原文

引用Matt Pocock@mattpocockuk

Prompt of the day (a long one):

Take a look at every code comment in <my codebase | this section of the code>.

Categorise each comment as:

  • Tautology: simply repeats what is already visible from the code
  • Excuse: many comments allow the agent to get away with a hacky implementation, which then gets propagated through the code
  • Stale: references code or implementation information that is no longer relevant
  • Decision Record: documents an important, non-obvious decision about the code

For each comment, take this action:

  • Tautology/Stale: delete the comment
  • Excuse: delete the comment and file an issue to fix the hacky implementation
  • Decision Record: move it into an ADR

Once this is done:

  • Create a lint rule banning comments for <my codebase | this section of the code>
  • Take a ratchet approach, assuming not all comments will be deleted this PR
  • Create a /delete-comment skill in this repository so we can repeat this process later
  • Estimate for me how many lines of code we'll shed by deleting all comments

---

I'm sold - comments considered harmful

在 X 查看被引用的帖子

来源:lauren · x.com

来源:RadarAI · aihot.news