sandi-metz-reviewer

Identify Sandi Metz OO design principle violations in Ruby code.

12|2|Updated Mar 11, 2025
One-click install
npx skills add https://github.com/el-feo/ai-context --skill sandi-metz-reviewer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sandi-metz-reviewer
Source: https://github.com/el-feo/ai-context/tree/main/skills/sandi-metz-reviewer
Command: npx skills add https://github.com/el-feo/ai-context --skill sandi-metz-reviewer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Ensuring Ruby code adheres to strong object-oriented design principles can be challenging and time-consuming during manual code reviews. This skill automates the application of Sandi Metz's renowned principles, providing expert feedback to improve your code's design and maintainability.

Core Features & Use Cases

  • Sandi Metz's Four Rules: Automatically checks classes (≤100 lines), methods (≤5 lines), parameters (≤4), and instance variables (≤4), providing clear warnings for violations.
  • SOLID & Demeter Checks: Reviews code for adherence to Single Responsibility, Open/Closed, Liskov Substitution, and Law of Demeter principles, identifying areas of tight coupling or unclear responsibilities.
  • Actionable Refactoring Guidance: Offers specific, practical suggestions for improving code structure, naming, and dependency management, helping you refactor effectively.

Quick Start

Review the attached Ruby code file 'order_processor.rb' for Sandi Metz's object-oriented design principles.

Frequently Asked Questions about sandi-metz-reviewer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate code reviews for Ruby to check object-oriented design?

Automated code reviews evaluate Ruby classes against Sandi Metz's design principles: classes ≤100 lines, methods ≤5 lines, parameters ≤4, instance variables ≤4. The review identifies violations of SRP, SOLID, Law of Demeter, and Tell Don't Ask, then provides actionable refactoring suggestions with severity levels.

What are Sandi Metz's four rules for object-oriented design?

Sandi Metz's four rules enforce class size (≤100 lines), method length (≤5 lines), parameter count (≤4), and instance variable limits (≤4). These rules improve code maintainability and reduce coupling in Ruby applications by constraining complexity at the class and method level.

Can I use this for code review requests on existing Ruby codebases?

Yes. Apply this to Ruby codebases and code-review requests to evaluate adherence to SOLID principles, SRP, Law of Demeter, and Tell Don't Ask patterns. Output includes per-principle findings, severity levels, and specific refactoring guidance for each violation detected.

How do I identify tight coupling and unclear responsibilities in Ruby code?

SOLID and Demeter principle checks analyze your Ruby code for single responsibility violations, open/closed violations, and Liskov substitution issues. The review surfaces coupling points and suggests dependency restructuring to clarify class responsibilities and improve design.

What refactoring suggestions does this provide?

Refactoring guidance is actionable and specific: it addresses code structure improvements, naming clarity, and dependency management. Each suggestion targets a specific principle violation detected in your Ruby code, helping you restructure classes and methods effectively.

Does this work with Ruby frameworks like Rails?

This analyzes any Ruby codebase for design principle violations, including Rails applications. It evaluates raw Ruby code structure independently, applying Sandi Metz's rules to classes, methods, and dependencies regardless of framework context.