Interpretive guidance for Ruby code quality using RuboCop (configurable) or StandardRB (zero-config). Use when linting Ruby files, configuring Ruby tools, troubleshooting lint errors, or understanding tool selection.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
configs/rubocop.ymlconfigs/standard.ymlrubocop.mdstandardrb.mdThis skill teaches how to apply Ruby linting and formatting tools effectively using mr-sparkle's tool selection system. It provides guidance on what the tools do, when each tool group is used, and how our configuration balances configurability with zero-config simplicity.
Claude knows how to use RuboCop and StandardRB. Fetch these docs only when you need:
Reference URLs:
Key principle: Prefer zero-config tooling (StandardRB) when project has it configured; fall back to configurable tool (RuboCop) when configured; default to StandardRB if no configuration exists.
What this means:
Decision test: Does the project have explicit tool configuration? Use configured tools. Otherwise use StandardRB.
The linting system uses group-based priority selection for Ruby files:
Priority 1: standardrb (if project has standard config)
↓
Priority 2: rubocop (if project has rubocop config)
↓
Fallback: standardrb (with default config)
Detection logic:
Gemfile, .git, or other markers)Tool in winning group runs (only one tool needed for Ruby).
From official docs:
standardrb (check), standardrb --fix (auto-correct)Configuration locations:
.standard.yml (optional overrides, but goes against philosophy)See standardrb.md for detailed overview.
When StandardRB shines:
Philosophy:
StandardRB removes decision fatigue by providing a curated, opinionated rule set. You don't configure it; you use it. This is intentional.
Basic usage:
# Check for issues
standardrb
# Auto-fix issues
standardrb --fix
# Check specific files
standardrb app/models/**/*.rb
Rare configuration (discouraged but possible):
# .standard.yml - only if absolutely necessary
ignore:
- 'vendor/**/*'
- 'db/schema.rb'
See configs/standard.yml for minimal example and standardrb.md for philosophy details.
From official docs:
rubocop (check), rubocop -a (safe auto-correct), rubocop -A (all auto-correct)Configuration locations:
.rubocop.yml (standard config file)rubocop-rails, rubocop-rspec, etc.)See rubocop.md for detailed overview.
When RuboCop shines:
Philosophy:
RuboCop is powerful and flexible. You configure exactly which cops to enable, at what severity, with what parameters. This is ideal when you have strong opinions or legacy codebases.
Basic usage:
# Check for issues
rubocop
# Auto-fix safe issues
rubocop -a
# Auto-fix all issues (use with caution)
rubocop -A
# Check specific files
rubocop app/models/**/*.rb
Common configuration pattern:
# .rubocop.yml
AllCops:
TargetRubyVersion: 3.2
NewCops: enable
Style/StringLiterals:
EnforcedStyle: single_quotes
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
See configs/rubocop.yml for sensible defaults and rubocop.md for configuration guidance.
$ lint.py file.rb
# Runs: standardrb --fix
# Uses: StandardRB defaults (zero config)
# Project has .standard.yml or uses 'standard' gem
$ lint.py file.rb
# Runs: standardrb --fix
# Uses: project's .standard.yml (if exists)
# Project has .rubocop.yml
$ lint.py file.rb
# Runs: rubocop -a
# Uses: project's .rubocop.yml config
# Project has both .standard.yml and .rubocop.yml
$ lint.py file.rb
# Runs: standardrb only (first group with config wins)
Problem: Trying to customize StandardRB extensively.
# ❌ Fighting StandardRB's philosophy
# .standard.yml
ignore:
- 'app/**/*'
- 'lib/**/*'
Why it fails: If you need this much customization, you should use RuboCop instead. StandardRB's value is zero-config consistency.
Better: Either accept StandardRB's defaults or switch to RuboCop for full control.
rubocop -A Without ReviewProblem: Auto-correcting all issues without understanding changes.
Why it fails: -A (aggressive auto-correct) can make unsafe changes. Some fixes need human review.
Better:
# Safe auto-correct first
rubocop -a
# Review remaining issues
rubocop
# Only use -A for specific safe cops if needed
rubocop -A --only Style/StringLiterals
Problem: Reinventing rules that exist in community gems.
# ❌ Custom rules for Rails-specific issues
# .rubocop.yml
Style/MyCustomRailsRule:
Enabled: true
Why it fails: Community gems like rubocop-rails already have comprehensive Rails-specific cops.
Better:
# Gemfile
gem 'rubocop-rails', require: false
# .rubocop.yml
require:
- rubocop-rails
# Now use built-in Rails cops
Rails/Validation:
Enabled: true
Problem: Disabling cops because they're "annoying."
# ❌ Over-disabling
AllCops:
DisabledByDefault: true
Style/StringLiterals:
Enabled: false
Metrics/MethodLength:
Enabled: false
Layout/LineLength:
Enabled: false
Why it fails: Defeats the purpose of linting. Rules exist for good reasons.
Better: Understand why rules trigger, fix the code, or selectively disable with inline comments:
# Selective disable when truly needed
def legacy_method # rubocop:disable Metrics/MethodLength
# ... complex legacy code that can't be refactored yet
end
.rubocop_todo.ymlProblem: Committing a massive .rubocop_todo.yml and forgetting about it.
Why it fails: Todo file is meant to be temporary. It lets you enable RuboCop gradually but shouldn't be permanent.
Better:
# Generate todo file for existing codebase
rubocop --auto-gen-config
# Then incrementally fix issues
# After fixing some cops, regenerate:
rubocop --auto-gen-config --exclude-limit 0
# Goal: Eventually delete .rubocop_todo.yml entirely
The mr-sparkle plugin's linting hook:
.rb, .rake, Rakefile, Gemfile)What this means: Most formatting issues auto-fix on save. Pay attention to reported unfixable issues.
Before finalizing Ruby code:
Auto-fixable (tools handle):
Manual attention required:
The universal linting script handles Ruby files automatically:
# Lint Ruby file (applies fixes)
./plugins/mr-sparkle/skills/linting/scripts/lint.py file.rb
# JSON output for programmatic use
./plugins/mr-sparkle/skills/linting/scripts/lint.py file.rb --format json
Exit codes:
0 - Clean or successfully fixed1 - Lint errors found (non-blocking)2 - Tool execution errorSee linting skill for complete CLI documentation.
Detailed guides (loaded on-demand for progressive disclosure):
configs/rubocop.yml - Sensible default RuboCop configurationconfigs/standard.yml - Minimal StandardRB configuration exampleOfficial documentation to fetch:
Remember: This skill documents mr-sparkle's tool selection logic for Ruby. Fetch official docs when you need specific cop definitions or configuration syntax you're unsure about.