Ruby static code analyzer and formatter for enforcing style guidelines, detecting bugs, and improving code quality. Supports Rails, RSpec, and Performance extensions with safe autocorrection capabilities.
Automatically detects style violations, bugs, and code smells in Ruby code using RuboCop. Triggers when users ask to lint, format, or analyze Ruby/Rails code, or request automatic corrections.
/plugin marketplace add el-feo/ai-context/plugin install ruby-rails@jebs-dev-toolsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/autocorrect_guide.mdreferences/configuration_guide.mdreferences/cop_reference.mdreferences/custom_cops_guide.mdreferences/extensions_guide.mdscripts/README.mdRuboCop is Ruby's premier static code analyzer (linter) and formatter, based on the community-driven Ruby Style Guide. This skill enables comprehensive code analysis, automatic formatting, and enforcement of coding standards across Ruby projects including Rails applications.
Claude automatically uses this skill when users:
Code Analysis & Linting
Automatic Code Correction
-a) for guaranteed-safe fixes-A) for broader but riskier corrections-x) for formatting without logic changesConfiguration & Customization
.rubocop.yml configurationExtension Integration
# Analyze current directory
rubocop
# Analyze specific files/directories
rubocop app spec lib/important_file.rb
# Show only correctable offenses
rubocop --display-only-correctable
# Safe autocorrection only (recommended)
rubocop -a
# All corrections including unsafe
rubocop -A
# Layout/formatting corrections only
rubocop -x
# Autocorrect specific cops
rubocop -a --only Style/StringLiterals,Layout/TrailingWhitespace
# Run only specific cops
rubocop --only Style/StringLiterals,Naming/MethodName
# Run all cops except specified
rubocop --except Metrics/MethodLength
# Run only lint cops
rubocop --lint
# Check only Rails-specific issues
rubocop --only Rails
# Enable extensions
plugins:
- rubocop-rails
- rubocop-rspec
- rubocop-performance
AllCops:
TargetRubyVersion: 3.2
NewCops: enable # Auto-enable new cops
Exclude:
- 'db/schema.rb'
- 'vendor/**/*'
- 'node_modules/**/*'
# Adjust specific cops
Style/StringLiterals:
EnforcedStyle: double_quotes
Metrics/MethodLength:
Max: 15
Exclude:
- 'spec/**/*'
Inherit from shared config:
inherit_from:
- .rubocop_todo.yml
- config/rubocop_defaults.yml
Rails-specific settings:
Rails:
Enabled: true
Rails/ApplicationRecord:
Enabled: true
Exclude:
- 'db/migrate/**'
RSpec configuration:
RSpec/ExampleLength:
Max: 10
RSpec/MultipleExpectations:
Max: 3
app/models/user.rb:15:3: C: Style/StringLiterals: Prefer single-quoted strings...
name = "John Doe"
^^^^^^^^^^
Format breakdown:
app/models/user.rb:15:3 - File path, line number, column numberC: - Severity (C=Convention, W=Warning, E=Error, F=Fatal)Style/StringLiterals - Cop department and name# Generate initial configuration
rubocop --init
# Generate .rubocop_todo.yml for existing violations
rubocop --auto-gen-config
# Use todo file to gradually fix issues
# .rubocop.yml:
inherit_from: .rubocop_todo.yml
# Check staged files only
git diff --name-only --cached | grep '\.rb$' | xargs rubocop
# With autocorrection
git diff --name-only --cached | grep '\.rb$' | xargs rubocop -a
# Exit with error code if offenses found
rubocop --format progress --fail-level warning
# Generate formatted reports
rubocop --format json --out rubocop-report.json
rubocop --format html --out rubocop-report.html
# Use all available CPUs (enabled by default)
rubocop --parallel
# Limit CPU usage
PARALLEL_PROCESSOR_COUNT=2 rubocop
Detects Rails-specific issues:
Enforces RSpec best practices:
Identifies performance optimizations:
"Unknown cop" errors:
rubocop-rails, rubocop-rspec, etc.).rubocop.yml: plugins: [rubocop-rails]Autocorrection not working:
-A for unsafe correctionsPerformance issues:
--parallel for faster executionUseCache: true under AllCops in configThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.