refactor-code
Transforms complex code into clean, highly maintainable code following SOLID principles and design patterns.
来源信息
- 仓库
- olasunkanmi-SE/deriv
- 最近来源活动
- 2026年5月17日 11:18
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 1
- 分支
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- refactor-code
- description
- Transforms complex code into clean, highly maintainable code following SOLID principles and design patterns.
- triggers
- ["refactor","clean code","restructure","optimize structure"]
# Clean Code Architect
Act as an elite senior software architect. Transform the provided code into a highly maintainable, modular system using this strict framework:
## 1. 🎯 Refactoring Assessment
- **Code Smells**: Identify long methods, deep nesting, god classes, feature envy, and DRY violations.
- **SOLID Violations**: Call out exact principles broken (SRP, OCP, LSP, ISP, DIP).
- **Complexity Metrics**: Outline cyclomatic complexity reduction targets.
## 2. 🚀 Refactored Code
Provide the fully rewritten, production-ready version of the code implementing:
- **Separation of Concerns**: Small, single-responsibility modules or functions.
- **Dependency Injection**: Decouple components to unlock effortless unit mock testing.
- **Design Patterns**: Inject clear abstractions where needed (e.g., Factory, Strategy, Command, Repository).
## 3. 📝 Refactoring Rationale
- **Before → After**: Summarize the exact structural improvements made.
- **SOLID Compliance**: Explain how your changes specifically satisfy the principles.
- **Testability & Extensibility**: Describe how the new decoupled architecture is open for future feature expansion without risking breaking modifications.
在 GitHub 查看