用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill solid命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | solid |
| description | | Use when this capability is needed. |
Five principles for building software that is easy to understand, extend, and maintain. They reduce coupling, increase cohesion, and make code testable.
Reference these principles when:
| Principle | One-Liner | Red Flag |
|---|---|---|
| SRP | One reason to change | "This class handles X and Y and Z" |
| OCP | Add, don't modify | Growing if/else or switch chains for types |
| LSP | Subtypes are substitutable | Type-checking or special-casing in calling code |
| ISP | Small, focused interfaces | Empty method implementations or throw new Error("Not implemented") |
| DIP | Depend on abstractions | new ConcreteClass() inside business logic |
See references/PRINCIPLES.md for detailed explanations and TypeScript examples.
Ask these questions for every class and module:
| Question | Violated Principle |
|---|---|
| Does this class have multiple reasons to change? | SRP |
| Do I need to modify existing code to add a new variant? | OCP |
| Does calling code need type-checks or special cases for subtypes? | LSP |
| Are implementors forced to stub out unused methods? | ISP |
| Does high-level logic directly instantiate infrastructure? | DIP |
| Scale | SRP | OCP | LSP | ISP | DIP |
|---|---|---|---|---|---|
| Function | Does one thing | — | — | — | Takes abstractions as params |
| Class | One reason to change | Extend via composition | Subtypes honor contracts | Implements only what it uses | Constructor injection |
| Module | One bounded context | Plugin architecture | Interchangeable implementations | Thin public API | Depends inward |
| Service | Single domain | New features = new services | API contract stability | Minimal API surface | Abstractions at boundaries |
| Anti-Pattern | Violated Principles | Fix |
|---|---|---|
| God class doing everything | SRP | Extract focused classes |
switch on type across codebase | OCP, LSP | Replace with polymorphism |
| Subclass that throws "not supported" | LSP, ISP | Redesign hierarchy, split interface |
| Fat interface with 20 methods | ISP | Split into role-based interfaces |
| Business logic importing DB driver | DIP | Inject repository interface |
| Service creating its own dependencies | DIP | Constructor injection |
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
基于 SOC 职业分类