ai_misc/skills/rubycritic-skill/SKILL.md
Analyze Ruby and Rails code quality with RubyCritic. Identifies code smells, complexity issues, and refactoring opportunities. Provides detailed metrics, scores files A-F, compares branches, and prioritizes high-churn problem areas. Use when analyzing Ruby code quality, reviewing PRs, or identifying technical debt.
npx skillsauth add madbomber/experiments RubyCritic Code Quality AnalysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A Claude Code skill for analyzing Ruby and Rails code quality using RubyCritic.
This skill integrates RubyCritic to provide comprehensive code quality analysis for Ruby and Rails projects. It helps identify code smells, complexity issues, and areas for refactoring with detailed metrics and actionable insights.
/rubycritic [path]Analyze code quality for the specified path or entire project.
Options:
path (optional): Specific file or directory to analyze. Defaults to current directory.Examples:
/rubycritic
/rubycritic app/models
/rubycritic app/controllers/users_controller.rb
/rubycritic-summaryGet a quick summary of code quality metrics without detailed file breakdowns.
/rubycritic-worstShow only the worst-rated files that need immediate attention.
Options:
--limit N: Number of worst files to show (default: 10)Examples:
/rubycritic-worst
/rubycritic-worst --limit 5
/rubycritic-compare [branch]Compare code quality between current branch and specified branch.
Options:
branch: Branch to compare against (default: main/master)Examples:
/rubycritic-compare main
/rubycritic-compare develop
Score Ranges:
Key Metrics:
The skill automatically checks for RubyCritic and installs it if needed:
gem install rubycritic
Create a .rubycritic.yml in your project root for custom settings:
# Minimum score for a file to be considered acceptable
minimum_score: 80.0
# Paths to exclude from analysis
paths:
- 'db/schema.rb'
- 'db/migrate/**/*'
- 'config/**/*'
- 'bin/**/*'
- 'spec/factories/**/*'
# Enable/disable specific analyzers
analyzers:
- flay # Structural duplication
- flog # ABC complexity
- reek # Code smells
- rubocop # Style issues (if available)
# Format for output
formats:
- console
- html
# Branch for comparison mode
branch: main
The skill provides:
Pre-Commit Analysis:
/rubycritic $(git diff --name-only --cached | grep '\.rb$')
CI/CD Integration:
Performance Considerations:
Solution: Narrow the scope
/rubycritic app/models/user.rb
/rubycritic app/controllers
Solution: Configure .rubycritic.yml to exclude problematic analyzers or paths
Solution: RubyCritic uses multiple analyzers; check individual metric breakdowns
Set quality gates for your team:
# In your CI/CD pipeline
if average_score < 75
puts "Code quality below threshold!"
exit 1
end
Target specific code smells:
/rubycritic app/models --smells "LongMethod,FeatureEnvy"
Compare against previous commits:
/rubycritic-compare HEAD~5
RubyCritic Analysis Results
===========================
Project Score: B (82.5)
Top Issues:
1. app/models/user.rb (Score: 65.2, Grade: D)
- Long Method: #calculate_permissions (complexity: 18)
- Feature Envy: accessing order.items repeatedly
- Duplication: 3 similar conditional blocks
2. app/controllers/orders_controller.rb (Score: 71.3, Grade: C)
- Long Method: #create (complexity: 15)
- Too Many Instance Variables: 6 ivars in #index
Recommendations:
- Extract #calculate_permissions into a service object
- Use Law of Demeter for order.items access
- Refactor conditional logic in User model
- Slim down OrdersController#create method
When using this skill, Claude should:
data-ai
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
development
Apply SOLID principles when writing, reviewing, or refactoring Ruby code. This skill should be used when designing classes, evaluating architecture, reviewing pull requests, or refactoring existing code. It provides actionable checklists, violation detection patterns, and Ruby-idiomatic refactoring strategies for each of the five SOLID principles.
tools
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
tools
Use at session start for Ruby projects (Gemfile, .ruby-version, or .tool-versions present). Detect version manager BEFORE running ruby, bundle, gem, rake, rails, rspec, or any Ruby command.