Install any skill in seconds. Free to start, no credit card required.
Get Started Free →This skill should be used when users request code review, refactoring, or code quality improvements for Ruby codebases. Apply Sandi Metz's four rules for writing maintainable object-oriented code - classes under 100 lines, methods under 5 lines, no more than 4 parameters, and controllers instantiate only one object. Use when users mention "Sandi Metz", "code quality", "refactoring", or when reviewing Ruby code for maintainability.
.claude/skills/dicklesworthstone-sandi-metz-rules/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 33% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 83% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-24 | ✓→✗ | ▼ Worse | 14% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 77% | 0% |
This skill helps apply Sandi Metz's four rules for writing maintainable object-oriented code to Ruby codebases. These rules are heuristics that encourage good design practices, making code easier to understand, test, and maintain.
Apply this skill when:
When reviewing code against Sandi Metz's rules:
Read the reference document: First, load the detailed rules documentation:
Read references/rules.mdMeasure accurately:
end statements)end statements)&block)Identify violations: Scan the codebase for violations of each rule. Use grep or file searching to find classes and methods, then analyze them systematically.
Not all violations are equal:
High priority:
Medium priority:
Low priority:
For each violation, provide concrete refactoring strategies:
Long classes:
Long methods:
Too many parameters:
Fat controllers:
When suggesting refactorings:
Remember that rules can be broken with good reason:
Always note when a violation might be acceptable and explain why.
When reviewing an entire codebase:
When reviewing a specific file:
When actively refactoring code:
Use these precise counting rules to ensure consistency:
Class lines:
rubyclass MyClass # Don't count def method # Count: 1 body # Count: 2 end # Don't count end # Don't count
Method lines:
rubydef my_method # Don't count line_1 # Count: 1 line_2 # Count: 2 # Don't count (blank line) # comment # Don't count line_3 # Count: 3 end # Don't count
Parameters:
rubydef method(a, b, c, d) # 4 parameters - OK def method(a, b, c, d, e) # 5 parameters - Violation def method(a:, b:, c:, d:) # 4 parameters - OK def method(a, b = nil, c = {}) # 3 parameters - OK (defaults still count) def method(a, *rest) # 2 parameters - OK def method(a, &block) # 1 parameter (blocks don't count)
Suggest using static analysis tools to enforce these rules:
Metrics/MethodLength, Metrics/ClassLength, Metrics/ParameterListsExample RuboCop configuration:
yamlMetrics/ClassLength: Max: 100 Metrics/MethodLength: Max: 5 Metrics/ParameterLists: Max: 4 MaxOptionalParameters: 3
This skill includes a comprehensive reference document with:
Load this reference when doing detailed code analysis or explaining refactoring approaches:
Read references/rules.md| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 14,323 | 44,475 | +211% | 1 | 1 | 0% | 2,327 | 1,815 | -22% | 0 | 0 | — |
case-02 | fail→fail | 23,767 | 35,741 | +50% | 1 | 1 | 0% | 4,699 | 8,746 | +86% | 0 | 0 | — |
case-03 | pass→pass | 9,204 | 7,687 | -16% | 1 | 1 | 0% | 1,751 | 3,098 | +77% | 0 | 0 | — |
case-04 | pass→pass | 10,299 | 10,236 | -1% | 1 | 1 | 0% | 1,803 | 2,929 | +62% | 0 | 0 | — |
case-05 | fail→pass | 10,733 | 6,276 | -42% | 1 | 1 | 0% | 1,839 | 2,447 | +33% | 0 | 0 | — |
case-06 | fail→pass | 12,787 | 15,217 | +19% | 1 | 1 | 0% | 2,327 | 4,266 | +83% | 0 | 0 | — |
case-07 | pass→pass | 6,275 | 6,197 | -1% | 1 | 1 | 0% | 1,101 | 2,735 | +148% | 0 | 0 | — |
case-08 | pass→pass | 15,176 | 5,715 | -62% | 1 | 1 | 0% | 2,698 | 2,726 | +1% | 0 | 0 | — |
case-09 | pass→pass | 18,894 | 18,324 | -3% | 1 | 1 | 0% | 3,168 | 3,657 | +15% | 0 | 0 | — |
case-10 | pass→pass | 16,018 | 17,319 | +8% | 1 | 1 | 0% | 2,753 | 4,734 | +72% | 0 | 0 | — |
case-11 | pass→pass | 9,463 | 8,964 | -5% | 1 | 1 | 0% | 1,515 | 3,229 | +113% | 0 | 0 | — |
case-12 | pass→pass | 13,627 | 16,118 | +18% | 1 | 1 | 0% | 2,153 | 3,755 | +74% | 0 | 0 | — |
case-13 | pass→pass | 11,767 | 7,957 | -32% | 1 | 1 | 0% | 1,686 | 2,796 | +66% | 0 | 0 | — |
case-14 | pass→pass | 8,273 | 5,518 | -33% | 1 | 1 | 0% | 1,321 | 2,446 | +85% | 0 | 0 | — |
case-15 | pass→pass | 5,653 | 3,408 | -40% | 1 | 1 | 0% | 912 | 2,036 | +123% | 0 | 0 | — |
case-16 | pass→pass | 5,979 | 3,928 | -34% | 1 | 1 | 0% | 857 | 2,099 | +145% | 0 | 0 | — |
case-17 | pass→pass | 9,905 | 11,827 | +19% | 1 | 1 | 0% | 1,662 | 3,611 | +117% | 0 | 0 | — |
case-18 | pass→pass | 13,216 | 12,135 | -8% | 1 | 1 | 0% | 2,285 | 3,817 | +67% | 0 | 0 | — |
case-19 | pass→pass | 8,869 | 8,715 | -2% | 1 | 1 | 0% | 1,651 | 3,021 | +83% | 0 | 0 | — |
case-20 | fail→pass | 10,007 | 5,256 | -47% | 1 | 1 | 0% | 1,651 | 2,444 | +48% | 0 | 0 | — |
case-21 | pass→pass | 3,637 | 3,583 | -1% | 1 | 1 | 0% | 621 | 2,183 | +252% | 0 | 0 | — |
case-22 | pass→pass | 7,272 | 24,272 | +234% | 1 | 1 | 0% | 1,383 | 2,585 | +87% | 0 | 0 | — |
case-23 | pass→pass | 10,197 | 8,953 | -12% | 1 | 1 | 0% | 2,007 | 3,093 | +54% | 0 | 0 | — |
case-24 | pass→fail | 16,422 | 8,561 | -48% | 1 | 1 | 0% | 2,656 | 3,035 | +14% | 0 | 0 | — |
case-25 | pass→pass | 14,284 | 13,416 | -6% | 1 | 1 | 0% | 2,312 | 3,651 | +58% | 0 | 0 | — |
case-26 | pass→pass | 6,721 | 9,051 | +35% | 1 | 1 | 0% | 1,055 | 3,162 | +200% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 26 cases were attempted, and 25 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +8 percentage points is the difference between those two pass rates over the 25 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.