npx skills add https://github.com/oimiragieo/agent-studio --skill dry-principle| 反模式 | 失败原因 | 正确方法 |
|---|---|---|
| 在第二次出现时提取(两次规则) | 两个实例可能只是偶然相似;错误的抽象比重复更糟糕 | 等待第三次出现后再提取;使用三次规则 |
| 通过共享辅助函数耦合不相关的概念 | 对一个领域的更改会破坏另一个;产生意外的依赖关系 | 仅当共享逻辑真正代表相同的领域概念时才提取 |
| 过度抽象以消除所有明显的重复 | 创建复杂的间接性,需要阅读 3 个文件才能理解 1 个操作 | 宁愿有 3 行可读的重复代码,也不要 1 个难以理解的抽象 |
| 在多个配置文件中定义相同的常量 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 值会悄无声息地产生分歧;一次性更改会导致难以追踪的错误 |
| 单一配置模块或环境变量;随处导入 |
| 将 DRY 原则应用于测试代码(减少夹具重复) | 过于 DRY 的测试设置会变得难以独立阅读 | 测试应该是自包含的;测试设置中的一些重复是可以接受的 |
开始前:
cat .claude/context/memory/learnings.md
完成后: 记录发现的任何新模式或例外情况。
假设中断:你的上下文可能会重置。如果它不在记忆中,那就没有发生过。
每周安装量
80
代码仓库
GitHub 星标数
19
首次出现
2026年2月9日
安全审计
安装于
gemini-cli78
github-copilot78
codex78
cursor78
amp77
kimi-cli77
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Extracting on the second occurrence (Rule of Two) | Two instances may be coincidentally similar; wrong abstraction is worse than duplication | Wait for the third occurrence before extracting; use the Rule of Three |
| Coupling unrelated concepts through shared helpers | Changes to one domain break the other; creates unexpected dependencies | Only extract when the shared logic genuinely represents the same domain concept |
| Over-abstracting to eliminate all apparent duplication | Creates complex indirection that requires reading 3 files to understand 1 operation | Prefer 3 readable duplicate lines over 1 inscrutable abstraction |
| Same constant defined in multiple configuration files | Values diverge silently; one-off changes cause hard-to-trace bugs | Single config module or environment variable; import everywhere |
| DRY applied to test code (reducing fixture duplication) | Test setup that's too DRY becomes hard to read in isolation | Tests should be self-contained; some duplication in test setup is acceptable |
Before starting:
cat .claude/context/memory/learnings.md
After completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Weekly Installs
80
Repository
GitHub Stars
19
First Seen
Feb 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
gemini-cli78
github-copilot78
codex78
cursor78
amp77
kimi-cli77
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
Google Workspace CLI 邮件转任务工具:Gmail 邮件自动创建 Google Tasks 任务
8,600 周安装
Java文档最佳实践指南:Javadoc注释规范与代码文档化技巧
8,300 周安装
pnpm 10.x 包管理器教程 - 快速节省磁盘空间,严格依赖管理,工作区配置指南
8,500 周安装
Web应用自动化测试技能 - Playwright浏览器测试、UI验证与调试指南
8,500 周安装
JUnit 5+ 最佳实践指南:编写高效单元测试与参数化测试
8,500 周安装
网页游戏引擎开发指南:使用HTML5 Canvas、WebGL、JavaScript构建2D/3D游戏
8,500 周安装