·refactor:rails

重構 Ruby on Rails 代碼以提高可維護性、可讀性以及對最佳實踐的遵守。這項技能可以將雜亂的 Rails 代碼轉換為遵循 Rails 約定和現代 Ruby 最佳實踐的優雅、結構良好的解決方案。它解決了胖控制器和模型的問題,將業務邏輯提取到服務對像中,應用 DRY 原則,使用共享行為的關注點,實現複雜數據庫操作的查詢對象,並利用 Rails 8 和 Ruby 3.3+ 功能,包括模式匹配和數據類。

15安裝·0熱度·@snakeo

安裝

$npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill refactor:rails

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