smithery/tikazyq

principle-solid

应用面向对象设计五大原则(单一职责、开闭、里氏替换、接口隔离、依赖倒置),系统化评审类与模块设计质量。当需要评审架构设计、重构现有代码、审查类职责划分时使用。支持多层次检查?

Installation

$ npx skills add smithery/tikazyq --skill principle-solid

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/tikazyq · top by installs.

npx skills add smithery/tikazyq

Browse all from smithery/tikazyq

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,375 B
  • docs SUMMARY.md 320 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

SOLID Principles Skill

Scope: COMMON(全阶段通用)

版本: 0.1.0(占位)| 创建日期: 2025-11-27


概述

SOLID 是面向对象设计的五大基本原则:

┌─────────────────────────────────────────────────────┐
│              🏛️ SOLID Principles                    │
├──────────┬──────────────────────────────────────────┤
│    S     │ Single Responsibility Principle         │
│    O     │ Open-Closed Principle                   │
│    L     │ Liskov Substitution Principle           │
│    I     │ Interface Segregation Principle         │
│    D     │ Dependency Inversion Principle          │
└──────────┴──────────────────────────────────────────┘

五大原则

S - 单一职责原则 (SRP)

  • 每个类/模块只有一个改变的理由
  • 职责清晰,不混杂无关功能
  • 高内聚,低耦合

O - 开闭原则 (OCP)

  • 对扩展开放,对修改关闭
  • 通过抽象实现扩展
  • 新增功能不需修改现有代码

L - 里氏替换原则 (LSP)

  • 子类可以替换父类而不影响程序正确性
  • 子类不削弱父类的前置条件
  • 子类不加强父类的后置条件

I - 接口隔离原则 (ISP)

  • 接口小而专注
  • 客户端不依赖它不需要的接口
  • 多个专用接口优于一个通用接口

D - 依赖反转原则 (DIP)

  • 高层模块不依赖低层模块,都依赖抽象
  • 抽象不依赖细节,细节依赖抽象
  • 依赖注入

分级检查策略

L1-STREAMLINED

  • 每原则检查 1 个核心点(共 5 项)
  • 关注明显违反
  • 通过标准:5 项中 4 项通过(≥80%)

L2-BALANCED

  • 每原则检查 2-3 个关键点(共 10-15 项)
  • 结合代码示例分析
  • 通过标准:10 项中 8 项通过(≥80%)

L3-RIGOROUS

  • 全面检查所有子项(15+ 项)
  • 依赖图分析 + 耦合度量化
  • 记录违反点及重构建议
  • 通过标准:15 项中 14 项通过(≥93%)

>> 命令

>>solid_check_l1     # SOLID 快速检查(5项各1个关键点)
>>solid_check_l2     # SOLID 标准检查(含代码示例分析)
>>solid_violation    # 识别 SOLID 违反点

相关 Skills

  • 同类: principle-dry, principle-kiss, principle-yagni, principle-soc(设计原则家族)
  • 应用: vertical-slice, component-boundary, layer-design(设计阶段使用)
  • 验证: code-review, refactoring(代码阶段验证 SOLID 符合度)

TODO: 待细化各原则的具体检查规则和代码示例