applying-code-principles
Fundamental software principles - SOLID, DRY, Occam's Razor, Miller's Law, YAGNI, Readable Code. Use when applying design principles, refactoring code, or when user mentions 原則, シンプル, 複雑, リファクタリング, 保守性, clean code, best practice.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Code Principles
Priority Order
| Priority | Principle | When to Apply |
|---|---|---|
| 1 | Safety First | Security, data integrity |
| 2 | YAGNI | Don't build what you don't need |
| 3 | Occam's Razor | Simplest solution |
| 4 | SOLID | For complex systems |
| 5 | DRY | Eliminate duplication (not at cost of clarity) |
| 6 | Miller's Law | Respect 7±2 cognitive limit |
Quick Checks
See CLAUDE.md Development Checks section (always loaded, single source of truth).
Thresholds
| Target | Ideal | Max | Limit |
|---|---|---|---|
| Function args | 3 | 5 | 7 |
| Class methods | 5 | 7 | 9 |
| Conditionals | 3 | 5 | 7 |
Rules
| Principle | Rule |
|---|---|
| DRY | Abstract on 3rd duplication (Rule of Three) |
| SOLID | Interface only when 2nd implementation appears |
| YAGNI | Build only if problem exists now |
| Readable | New team member understands in < 1 minute |
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!