返回 Skill 列表
extension
分类: 开发与工程无需 API Key

applying-solid-principles

这项技能应在需要遵循SOLID原则和清洁代码实践的代码实现中使用。它提供了关于单一职责、开闭原则、里氏替换、接口隔离以及依赖倒置原则的详细指导,并附有TypeScript中的比较示例。

person作者: jakexiaohubgithub

SOLID Principles and Clean Code - File Contents

This document is a mandatory guide to SOLID principles and clean code practices for all code implementations.

Main Components

This skill is made up of four detailed documents:

  1. SOLID Principles in Detail - Explanation and comparison examples for the five design principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion). See @SOLID-PRINCIPLES.md.

  2. Clean Code Basics - Fundamentals for everyday implementation: naming conventions, function design, reducing nesting, and eliminating magic numbers. See @CLEAN-CODE-BASICS.md.

  3. Quality Checklist - Criteria for confirming adherence to design principles, detecting code smells, and deciding when to refactor. See @QUALITY-CHECKLIST.md.

  4. Quick Reference - One-line summaries for rapid lookup, common mistakes and fixes, and code review points. See @QUICK-REFERENCE.md.

The Five SOLID Principles

The documentation systematically explains the patterns that underpin extensibility and maintainability, starting with the Single Responsibility rule that "there should be only one reason to change."

Related Supplementary Principles

The additional principles referenced — DRY, YAGNI, and KISS — also provide frameworks that increase the effectiveness of your design.