ruby-code-smeller

Detect code smells in Ruby and Rails code and suggest refactorings.

Updated Dec 8, 2022
One-click install
npx skills add https://github.com/lekemula/dotfiles --skill ruby-code-smeller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ruby-code-smeller
Source: https://github.com/lekemula/dotfiles/tree/main/claude/skills/ruby-code-smeller
Command: npx skills add https://github.com/lekemula/dotfiles --skill ruby-code-smeller

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers identify and resolve common code quality issues ("code smells") in Ruby and Rails applications, leading to more maintainable and robust codebases.

Core Features & Use Cases

  • Code Smell Detection: Identifies 17 distinct types of code smells, from long methods to primitive obsession.
  • Refactoring Suggestions: Provides actionable advice and code sketches for refactoring detected smells.
  • Use Case: A developer can use this skill to analyze a complex controller action in a Rails application, get a list of potential smells like "God Controller" or "Boolean Parameters," and receive suggestions on how to extract logic into service objects or create new methods.

Quick Start

Analyze the file '/path/to/your/ruby_code.rb' for code smells.

Frequently Asked Questions about ruby-code-smeller

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect code smells in a Ruby on Rails application?

Detect Ruby on Rails code smells by analyzing your files to identify 17 distinct issues like Long Method, Large Class, and Feature Envy, and receive specific refactoring recommendations to improve code quality.

What is a Long Method code smell and how do I refactor it in Ruby?

A Long Method code smell occurs when a Ruby method becomes too complex. You refactor it by applying automated suggestions to extract logic into new methods or service objects, resolving the detected issue.

Can I get refactoring suggestions for a God Controller in Rails?

Yes, you can get refactoring suggestions for a God Controller in Rails. Analyzing complex controller actions identifies this specific code smell and provides actionable advice to extract logic into service objects.

Does automated code quality analysis work for primitive obsession in Ruby?

Automated code quality analysis works for primitive obsession in Ruby by detecting this specific code smell alongside 16 other types, providing actionable refactoring advice and code sketches to resolve the issue.

What is the best way to find Data Clumps and Feature Envy in Ruby code?

The best way to find Data Clumps and Feature Envy in Ruby code is using automated detection to scope your files for these structural issues, providing targeted refactoring recommendations to resolve them.

When should I not use automated code smell detection for my Rails project?

You should not use automated code smell detection when your Rails project requires understanding deep business logic context, as the tool focuses on structural issues like Boolean Parameters and Data Clumps rather than domain-specific rules.