lauren· @poteto · X·· 21 小时前AI 评分61
Lauren Tan 分享 pstack 的 /no-comments 技能,可让 agent 清理代码注释
AI 导读
作者推荐尝试 pstack 中的 /no-comments 技能,链接指向 cursor/plugins 仓库中的 SKILL.md,并建议让 agent 把它转成一条 lint 规则使用。引用的 Matt Pocock 提示词将注释分为同义重复、借口、过时、决策记录四类,分别删除、修复或归档进 ADR,并建议创建 lint 规则和可复用的 /delete-comment 技能。
正文 · 原文
give /no-comments from pstack a try! or better yet, ask your agent to turn it into a lint rule
在 X 查看被引用的帖子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
来源:lauren · x.com