Reduce RuboCop Max Lines Threshold

VerifiedSafe

Updates RuboCop configuration to reduce the maximum lines threshold per class/module, identifies classes and modules exceeding the new limit, and generates a brief with refactoring strategies and a task plan to split oversized files.

Sby Skills Guide Bot
DevelopmentIntermediate
1906/2/2026
Claude Code
#rubocop#code-quality#refactoring#linting

Recommended for

Our review

This skill updates the RuboCop max lines threshold for classes/modules, identifies violations, and creates a structured refactoring plan.

Strengths

  • Automates RuboCop configuration updates
  • Systematically identifies oversized classes and modules
  • Provides actionable refactoring strategies
  • Generates an execution plan via /plan-execute

Limitations

  • Requires an existing RuboCop setup in the project
  • Refactoring suggestions are generic and may need manual tailoring
  • Does not address other metrics like cyclomatic complexity
When to use it

Use this skill when you need to reduce class/module line counts and enforce new limits in a structured, automated way.

When not to use it

Avoid this skill if RuboCop is not used in your project, or if you prefer a manual refactoring approach without a structured plan.

Security analysis

Safe
Quality score90/100

The skill only runs read-only Ruby linter commands (rubocop) to analyse code and produce a refactoring plan. There are no destructive, network, or obfuscated operations. The bash usage is confined to legitimate development tooling.

No concerns found

Examples

Reduce max lines to 100
Reduce max lines for classes and modules to 100 using RuboCop.
Create refactoring plan for long classes
Find all classes over 120 lines in my Ruby project and create a plan to refactor them.

name: plan-reduce-max-lines description: This skill should be used when reducing the maximum class/module lines threshold and fixing all violations. It updates the RuboCop configuration, identifies classes and modules exceeding the new limit, generates a brief with refactoring strategies, and creates a plan with tasks to split oversized files. allowed-tools: ["Read", "Bash", "Glob", "Grep"]


Reduce Max Lines

Target threshold: $ARGUMENTS lines per class/module

If no argument provided, prompt the user for a target.

Step 1: Gather Requirements

  1. Read current config from .rubocop.yml or .rubocop.local.yml (Metrics/ClassLength and Metrics/ModuleLength)
  2. Run RuboCop with the target threshold to find violations:
    bundle exec rubocop --only Metrics/ClassLength,Metrics/ModuleLength --format json 2>&1
    
  3. Note for each violation:
    • File path
    • Class/module name
    • Current line count

If no violations at $ARGUMENTS, report success and exit.

Step 2: Compile Brief and Delegate

Compile the gathered information into a structured brief:

Reduce max class/module lines threshold to $ARGUMENTS.

Classes/modules exceeding threshold (ordered by line count):
1. [file:ClassName] - [current] lines (target: $ARGUMENTS)
2. ...

Configuration change: .rubocop.local.yml, Metrics/ClassLength Max to $ARGUMENTS, Metrics/ModuleLength Max to $ARGUMENTS

Refactoring strategies: extract concerns, extract service objects, remove duplication, delete dead code, simplify logic

Verification: `bundle exec rubocop --only Metrics/ClassLength,Metrics/ModuleLength --format simple 2>&1 | grep "offense" | wc -l` -> Expected: 0

Invoke /plan-execute with this brief to create the implementation plan.

Related skills