refactor by pproenca/dot-skills
npx skills add https://github.com/pproenca/dot-skills --skill refactor基于 Martin Fowler 的重构目录和整洁代码原则的全面代码重构指南,专为 AI 智能体和 LLM 设计。包含 8 个类别共 43 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考这些准则:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 结构与分解 | 关键 | struct- |
| 2 | 耦合与依赖 | 关键 | couple- |
| 3 | 命名与清晰度 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
name-| 4 | 条件逻辑 | 高 | cond- |
| 5 | 抽象与模式 | 中高 | pattern- |
| 6 | 数据组织 | 中 | data- |
| 7 | 错误处理 | 中 | error- |
| 8 | 微重构 | 低 | micro- |
struct-extract-method - 为长函数提取方法struct-single-responsibility - 应用单一职责原则struct-extract-class - 从大类中提取类struct-compose-method - 为可读流程组合方法struct-function-length - 保持函数在 20 行以内struct-replace-method-with-object - 用方法对象替换方法struct-parameter-object - 引入参数对象couple-dependency-injection - 使用依赖注入couple-hide-delegate - 隐藏委托以减少耦合couple-remove-middle-man - 在过度时移除中间人couple-feature-envy - 通过移动方法修复依恋情结couple-interface-segregation - 应用接口隔离原则couple-preserve-whole-object - 保留整个对象而非字段name-intention-revealing - 使用揭示意图的名称name-avoid-abbreviations - 避免缩写和首字母缩略词name-consistent-vocabulary - 使用一致的词汇表name-searchable-names - 使用可搜索的名称name-avoid-encodings - 避免在名称中进行类型编码cond-guard-clauses - 用卫语句替换嵌套条件cond-polymorphism - 用多态替换条件cond-decompose - 分解复杂条件cond-consolidate - 合并重复的条件片段cond-special-case - 引入特例对象cond-lookup-table - 用查找表替换条件pattern-strategy - 为算法变体提取策略模式pattern-template-method - 为共享骨架使用模板方法模式pattern-factory - 为复杂对象创建使用工厂模式pattern-open-closed - 应用开闭原则pattern-composition-over-inheritance - 优先使用组合而非继承pattern-extract-superclass - 为通用行为提取超类data-encapsulate-collection - 封装集合data-replace-primitive - 用对象替换基本类型data-encapsulate-record - 将记录封装到类中data-split-variable - 拆分具有多次赋值的变量data-replace-temp-with-query - 用查询替换临时变量error-exceptions-over-codes - 使用异常而非错误码error-custom-exceptions - 创建领域特定的异常类型error-fail-fast - 使用前置条件快速失败error-separate-concerns - 将错误处理与业务逻辑分离micro-remove-dead-code - 移除死代码micro-inline-variable - 内联简单变量micro-simplify-expressions - 简化布尔表达式micro-rename-for-clarity - 为清晰度重命名阅读单独的参考文件以获取详细解释和代码示例:
获取包含所有规则详细说明的完整指南:AGENTS.md
每周安装量
142
代码仓库
GitHub 星标数
85
首次出现
2026年1月22日
安全审计
安装于
codex117
gemini-cli116
opencode116
claude-code110
github-copilot107
cursor105
Comprehensive code refactoring guide based on Martin Fowler's catalog and Clean Code principles, designed for AI agents and LLMs. Contains 43 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Structure & Decomposition | CRITICAL | struct- |
| 2 | Coupling & Dependencies | CRITICAL | couple- |
| 3 | Naming & Clarity | HIGH | name- |
| 4 | Conditional Logic | HIGH | cond- |
| 5 | Abstraction & Patterns | MEDIUM-HIGH | pattern- |
| 6 | Data Organization | MEDIUM | data- |
| 7 | Error Handling | MEDIUM | error- |
| 8 | Micro-Refactoring | LOW | micro- |
struct-extract-method - Extract Method for Long Functionsstruct-single-responsibility - Apply Single Responsibility Principlestruct-extract-class - Extract Class from Large Classstruct-compose-method - Compose Method for Readable Flowstruct-function-length - Keep Functions Under 20 Linesstruct-replace-method-with-object - Replace Method with Method Objectstruct-parameter-object - Introduce Parameter Objectcouple-dependency-injection - Use Dependency Injectioncouple-hide-delegate - Hide Delegate to Reduce Couplingcouple-remove-middle-man - Remove Middle Man When Excessivecouple-feature-envy - Fix Feature Envy by Moving Methodscouple-interface-segregation - Apply Interface Segregation Principlecouple-preserve-whole-object - Preserve Whole Object Instead of Fieldsname-intention-revealing - Use Intention-Revealing Namesname-avoid-abbreviations - Avoid Abbreviations and Acronymsname-consistent-vocabulary - Use Consistent Vocabularyname-searchable-names - Use Searchable Namesname-avoid-encodings - Avoid Type Encodings in Namescond-guard-clauses - Replace Nested Conditionals with Guard Clausescond-polymorphism - Replace Conditional with Polymorphismcond-decompose - Decompose Complex Conditionalscond-consolidate - Consolidate Duplicate Conditional Fragmentscond-special-case - Introduce Special Case Objectcond-lookup-table - Replace Conditional with Lookup Tablepattern-strategy - Extract Strategy for Algorithm Variantspattern-template-method - Use Template Method for Shared Skeletonpattern-factory - Use Factory for Complex Object Creationpattern-open-closed - Apply Open-Closed Principlepattern-composition-over-inheritance - Prefer Composition Over Inheritancepattern-extract-superclass - Extract Superclass for Common Behaviordata-encapsulate-collection - Encapsulate Collectiondata-replace-primitive - Replace Primitive with Objectdata-encapsulate-record - Encapsulate Record into Classdata-split-variable - Split Variable with Multiple Assignmentsdata-replace-temp-with-query - Replace Temp with Queryerror-exceptions-over-codes - Use Exceptions Instead of Error Codeserror-custom-exceptions - Create Domain-Specific Exception Typeserror-fail-fast - Fail Fast with Preconditionserror-separate-concerns - Separate Error Handling from Business Logicmicro-remove-dead-code - Remove Dead Codemicro-inline-variable - Inline Trivial Variablesmicro-simplify-expressions - Simplify Boolean Expressionsmicro-rename-for-clarity - Rename for ClarityRead individual reference files for detailed explanations and code examples:
references/{prefix}-{slug}.mdFor the complete guide with all rules expanded: AGENTS.md
Weekly Installs
142
Repository
GitHub Stars
85
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex117
gemini-cli116
opencode116
claude-code110
github-copilot107
cursor105
AI 代码实施计划编写技能 | 自动化开发任务分解与 TDD 流程规划工具
49,800 周安装
Medusa 电商店铺前端最佳实践:UI/UX、SEO、移动端响应式设计全指南
1,100 周安装
Vibe Coding 指南:用 AI 和自然语言构建软件原型与 MVP 的完整框架
1,200 周安装
Tailwind CSS 实用优先CSS框架 - 快速构建自定义UI界面 | v4.1.18教程
1,100 周安装
PHP 8.x 最佳实践指南:51条规则掌握现代PHP开发、PSR标准与SOLID原则
1,100 周安装
Trigger.dev 任务:构建可靠的后台任务与异步工作流,支持自动重试和队列管理
1,100 周安装
腾讯云CloudBase开发指南:一站式云端应用开发与部署解决方案
1,200 周安装