refactor:rails
✓重构 Ruby on Rails 代码以提高可维护性、可读性以及对最佳实践的遵守。这项技能可以将杂乱的 Rails 代码转换为遵循 Rails 约定和现代 Ruby 最佳实践的优雅、结构良好的解决方案。它解决了胖控制器和模型的问题,将业务逻辑提取到服务对象中,应用 DRY 原则,使用共享行为的关注点,实现复杂数据库操作的查询对象,并利用 Rails 8 和 Ruby 3.3+ 功能,包括模式匹配和数据类。
SKILL.md
You are an elite Ruby on Rails refactoring specialist with deep expertise in writing clean, maintainable, and idiomatic Rails code. Your mission is to transform messy, hard-to-maintain code into elegant, well-structured solutions that follow Rails conventions and modern Ruby best practices.
\\\`ruby Before: Deeply nested def processorder(order) if order.present? if order.valid? if order.items.any? actual logic buried deep end end end end
After: Guard clauses def processorder(order) return unless order.present? return unless order.valid? return if order.items.empty?
重构 Ruby on Rails 代码以提高可维护性、可读性以及对最佳实践的遵守。这项技能可以将杂乱的 Rails 代码转换为遵循 Rails 约定和现代 Ruby 最佳实践的优雅、结构良好的解决方案。它解决了胖控制器和模型的问题,将业务逻辑提取到服务对象中,应用 DRY 原则,使用共享行为的关注点,实现复杂数据库操作的查询对象,并利用 Rails 8 和 Ruby 3.3+ 功能,包括模式匹配和数据类。 来源:snakeo/claude-debug-and-refactor-skills-plugin。
可引用信息
为搜索与 AI 引用准备的稳定字段与命令。
- 安装命令
npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill refactor:rails- 分类
- </>开发工具
- 认证
- ✓
- 收录时间
- 2026-02-06
- 更新时间
- 2026-02-18
快速解答
什么是 refactor:rails?
重构 Ruby on Rails 代码以提高可维护性、可读性以及对最佳实践的遵守。这项技能可以将杂乱的 Rails 代码转换为遵循 Rails 约定和现代 Ruby 最佳实践的优雅、结构良好的解决方案。它解决了胖控制器和模型的问题,将业务逻辑提取到服务对象中,应用 DRY 原则,使用共享行为的关注点,实现复杂数据库操作的查询对象,并利用 Rails 8 和 Ruby 3.3+ 功能,包括模式匹配和数据类。 来源:snakeo/claude-debug-and-refactor-skills-plugin。
如何安装 refactor:rails?
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill refactor:rails 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用
这个 Skill 的源码在哪?
https://github.com/snakeo/claude-debug-and-refactor-skills-plugin
详情
- 分类
- </>开发工具
- 来源
- skills.sh
- 收录时间
- 2026-02-06