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.
Install with Tessl CLI
npx tessl i github:Dicklesworthstone/pi_agent_rust --skill sandi-metz-rules89
Does it follow best practices?
If you maintain this skill, you can automatically optimize it using the tessl CLI to improve its score:
npx tessl skill review --optimize ./path/to/skillValidation for skill structure
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:
class MyClass # Don't count
def method # Count: 1
body # Count: 2
end # Don't count
end # Don't countMethod lines:
def 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 countParameters:
def 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:
Metrics/ClassLength:
Max: 100
Metrics/MethodLength:
Max: 5
Metrics/ParameterLists:
Max: 4
MaxOptionalParameters: 3This skill includes a comprehensive reference document with:
Load this reference when doing detailed code analysis or explaining refactoring approaches:
Read references/rules.md5b012b7
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.