重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/pproenca/dot-skills --skill ruby-refactor适用于 Ruby 应用程序的全面重构指南,由社区维护。包含 8 个类别下的 45 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考这些指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 结构与分解 | 关键 | struct- |
| 2 | 条件简化 | 关键 | cond- |
| 3 | 耦合与依赖 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
couple-| 4 | Ruby 惯用法 | 高 | idiom- |
| 5 | 数据与值对象 | 中高 | data- |
| 6 | 设计模式 | 中 | pattern- |
| 7 | 现代 Ruby 3.x | 中 | modern- |
| 8 | 命名与可读性 | 低中 | name- |
struct-extract-method - 将长方法提取为专注的单元struct-extract-class - 提取类以实现单一职责struct-parameter-object - 为冗长的签名引入参数对象struct-compose-method - 在单一抽象层级上组合方法struct-replace-method-with-object - 用方法对象替换复杂方法struct-single-responsibility - 每个类只有一个变更理由struct-flatten-deep-nesting - 通过早期提取来展平深层嵌套cond-guard-clauses - 用卫语句替换嵌套条件判断cond-decompose-conditional - 将复杂的布尔表达式提取为命名的谓词方法cond-replace-with-polymorphism - 用多态替换 case/whencond-null-object - 用空对象替换 nil 检查cond-pattern-matching - 使用模式匹配处理结构化条件cond-consolidate-duplicates - 合并重复的条件片段couple-law-of-demeter - 通过委托强制执行迪米特法则couple-feature-envy - 移动方法以解决特性依恋couple-dependency-injection - 通过构造器默认值注入依赖couple-composition-over-inheritance - 用组合对象替换混入couple-tell-dont-ask - 告诉对象做什么,而不是查询其状态couple-avoid-class-methods-domain - 在领域逻辑中避免使用类方法idiom-prefer-enumerable - 使用 map/select/reject 而非带有累加器的 eachidiom-keyword-arguments - 使用关键字参数以提高清晰度idiom-duck-typing - 使用 respond_to? 而非 is_a? 进行类型检查idiom-predicate-methods - 使用 ? 后缀命名布尔方法idiom-respond-to-missing - 始终将 method_missing 与 respond_to_missing? 配对使用idiom-block-yield - 对于简单的块,使用 yield 而非 block.callidiom-implicit-return - 省略最后一个表达式的显式 returndata-value-object - 用值对象替换基本类型偏执data-define-immutable - 使用 Data.define 定义不可变的值对象data-encapsulate-collection - 在领域方法后封装集合data-replace-data-clump - 用分组对象替换数据泥团data-separate-query-command - 将查询方法与命令方法分离pattern-strategy - 将算法变体提取到策略对象中pattern-factory - 使用工厂方法抽象对象创建pattern-template-method - 使用模板方法定义算法骨架pattern-decorator - 使用装饰器包装对象以添加行为pattern-null-object-protocol - 实现具有完整协议的空对象modern-pattern-matching - 使用 case/in 进行结构化模式匹配modern-deconstruct-keys - 实现 deconstruct_keys 以支持自定义模式匹配modern-endless-methods - 对简单方法使用无结束符方法定义modern-hash-pattern-guard - 结合卫语句使用模式匹配modern-rightward-assignment - 对管道表达式使用向右赋值name-intention-revealing - 使用揭示意图的名称name-consistent-vocabulary - 在整个代码库中对每个概念使用一致的词汇name-avoid-abbreviations - 拼写出名称,除非是通用缩写name-rename-to-remove-comments - 通过重命名来消除注释的必要性阅读各个参考文件以获取详细解释和代码示例:
| 文件 | 描述 |
|---|---|
| references/_sections.md | 类别定义和排序 |
| assets/templates/_template.md | 新规则模板 |
| metadata.json | 版本和参考信息 |
每周安装次数
48
代码仓库
GitHub 星标数
85
首次出现
2026年2月12日
安全审计
安装于
codex45
github-copilot44
gemini-cli44
opencode43
kimi-cli43
amp42
Comprehensive refactoring guide for Ruby applications, maintained by the community. Contains 45 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 | Conditional Simplification | CRITICAL | cond- |
| 3 | Coupling & Dependencies | HIGH | couple- |
| 4 | Ruby Idioms | HIGH | idiom- |
| 5 | Data & Value Objects | MEDIUM-HIGH | data- |
| 6 | Design Patterns | MEDIUM | pattern- |
| 7 | Modern Ruby 3.x | MEDIUM | modern- |
| 8 | Naming & Readability | LOW-MEDIUM | name- |
struct-extract-method - Extract Long Methods into Focused Unitsstruct-extract-class - Extract Class for Single Responsibilitystruct-parameter-object - Introduce Parameter Object for Long Signaturesstruct-compose-method - Compose Methods at Single Abstraction Levelstruct-replace-method-with-object - Replace Complex Method with Method Objectcond-guard-clauses - Replace Nested Conditionals with Guard Clausescond-decompose-conditional - Extract Complex Booleans into Named Predicatescond-replace-with-polymorphism - Replace case/when with Polymorphismcond-null-object - Replace nil Checks with Null Objectcond-pattern-matching - Use Pattern Matching for Structural Conditionscouple-law-of-demeter - Enforce Law of Demeter with Delegationcouple-feature-envy - Move Method to Resolve Feature Envycouple-dependency-injection - Inject Dependencies via Constructor Defaultscouple-composition-over-inheritance - Replace Mixin with Composed Objectcouple-tell-dont-ask - Tell Objects What to Do, Don't Query Their Stateidiom-prefer-enumerable - Use map/select/reject Over each with Accumulatoridiom-keyword-arguments - Use Keyword Arguments for Clarityidiom-duck-typing - Use respond_to? Over is_a? for Type Checkingidiom-predicate-methods - Name Boolean Methods with ? Suffixidiom-respond-to-missing - Always Pair method_missing with respond_to_missing?data-value-object - Replace Primitive Obsession with Value Objectsdata-define-immutable - Use Data.define for Immutable Value Objectsdata-encapsulate-collection - Encapsulate Collections Behind Domain Methodsdata-replace-data-clump - Replace Data Clumps with Grouped Objectsdata-separate-query-command - Separate Query Methods from Command Methodspattern-strategy - Extract Algorithm Variations into Strategy Objectspattern-factory - Use Factory Method to Abstract Object Creationpattern-template-method - Define Algorithm Skeleton with Template Methodpattern-decorator - Wrap Objects with Decorator for Added Behaviorpattern-null-object-protocol - Implement Null Object with Full Protocolmodern-pattern-matching - Use case/in for Structural Pattern Matchingmodern-deconstruct-keys - Implement deconstruct_keys for Custom Pattern Matchingmodern-endless-methods - Use Endless Method Definition for Simple Methodsmodern-hash-pattern-guard - Use Pattern Matching with Guard Clausesmodern-rightward-assignment - Use Rightward Assignment for Pipeline Expressionsname-intention-revealing - Use Intention-Revealing Namesname-consistent-vocabulary - Use One Word per Concept Across Codebasename-avoid-abbreviations - Spell Out Names Except Universal Abbreviationsname-rename-to-remove-comments - Rename to Eliminate Need for CommentsRead individual reference files for detailed explanations and code examples:
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
Weekly Installs
48
Repository
GitHub Stars
85
First Seen
Feb 12, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex45
github-copilot44
gemini-cli44
opencode43
kimi-cli43
amp42
Flutter/Dart代码审查最佳实践:提升应用性能与质量的完整检查清单
1,200 周安装
Web与移动应用国际化(i18n)最佳实践指南:React、Next.js、React Native、Vue
169 周安装
Raindrop.io API 技能使用指南:书签管理、REST API 调用与认证教程
170 周安装
VSL故事板撰写专家:高转化视频销售脚本与故事板创作指南
168 周安装
Arize Link:一键生成Arize追踪、跨度和会话的深层链接工具
166 周安装
降低代码熵值技能 - 精简代码库,减少技术债务,提升软件维护性
168 周安装
Kysely:TypeScript 类型安全 SQL 查询构建器 | 数据库无关,零运行时开销
165 周安装
struct-single-responsibilitystruct-flatten-deep-nesting - Flatten Deep Nesting with Early Extractioncond-consolidate-duplicatescouple-avoid-class-methods-domainidiom-block-yieldidiom-implicit-return - Omit Explicit return for Last Expression