跳到正文
Skillpedia
通用编程15k · #10989

principle-subtract-before-you-add

它能做什么

为智能体提供一条在添加新功能之前先简化的规则。适合代码库随时间变得臃肿的团队。

适用场景

  • ✓当你即将为代码中混乱或臃肿的部分添加功能的时候。
  • ✓当计划进行重构或重写的时候。
  • ✓当存在死代码路径、冗余验证器或空引用的时候。

技能链接

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-subtract-before-you-add/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-subtract-before-you-add/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“在我们添加新的导出功能之前,请清理该模块中的死代码和不需要的检查。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会先删除死代码、冗余的验证器和空的存根引用,然后在更简单的基础上构建新工作。它按实际使用情况设计,而不是为推测中的边界情况设计。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Subtract Before You Add

When evolving a system, remove complexity first, then build. Default to subtraction.

Make simplification a continual investment. Leave the design slightly simpler and more capable behind the same or smaller surface than you found it.

  • Sequence removal before construction
  • Cut before you polish (get to the minimum before investing in quality)
  • Design for observed usage, not speculative edge cases
  • No speculative validators, parsers, or guards beyond what the spec demands
  • Simplify prompts (remove redundant instructions, excessive templates)
  • When a reference has no novel content, delete it rather than leaving a stub
常见问题

这是否意味着删除一切?

不是。它只删除已死或不需要的内容,并依据观察到的使用情况进行设计,而不是依靠猜测。

应该先追求质量吗?

该技能主张,在投入打磨之前,先削减到最小化。

存根引用怎么办?

当一个引用没有新的内容时,该技能主张删除它,而不是保留存根。

详情

作者的原始描述

Apply when sequencing an addition, refactor, or rewrite. Remove dead code, redundant validators, and stub references first, then build on the simpler base.

repo: cursor/plugins

热度

GitHub 星标
15k
排名
#10989
许可证
—
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能