Skip to content
Skills Library
Programming · Review & audit

review-ruby-code

/review-ruby-code

Comprehensive Ruby and Rails code review using Sandi Metz rules and SOLID principles. Analyzes changed files in current branch vs base branch, runs rubycritic and simplecov, identifies OOP violations, Rails anti-patterns, security issues, code smells, and test coverage gaps. Outputs REVIEW.md with VSCode-compatible file links. Use when reviewing Ruby/Rails code, conducting code reviews, checking for design issues, pull request review, code quality analysis, or when user mentions Sandi Metz, POODR, 99 Bottles, SOLID, Law of Demeter, or "Tell Don't Ask".

Repository
ai-context ↗
Licence
MIT
Last repository change
21.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
7
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/code_reviewer.rb

What it does and when to use it

Comprehensive Ruby and Rails code review using Sandi Metz rules and SOLID principles. Analyzes changed files in current branch vs base branch, runs rubycritic and simplecov, identifies OOP violations, Rails anti-patterns, security issues, code smells, and test coverage gaps. Outputs REVIEW.md with VSCode-compatible file links. Use when reviewing Ruby/Rails code, conducting code reviews, checking for design issues, pull request review, code quality analysis, or when user mentions Sandi Metz, POODR, 99 Bottles, SOLID, Law of Demeter, or "Tell Don't Ask".

Triggers from the description

Tell Don
Original author description

Comprehensive Ruby and Rails code review using Sandi Metz rules and SOLID principles. Analyzes changed files in current branch vs base branch, runs rubycritic and simplecov, identifies OOP violations, Rails anti-patterns, security issues, code smells, and test coverage gaps. Outputs REVIEW.md with VSCode-compatible file links. Use when reviewing Ruby/Rails code, conducting code reviews, checking for design issues, pull request review, code quality analysis, or when user mentions Sandi Metz, POODR, 99 Bottles, SOLID, Law of Demeter, or "Tell Don't Ask".

How it works

  1. Workflow
  2. Reference Guides
Original SKILL.md headings · 174 lines, 727 words
SKILL.md preview
---
name: review-ruby-code
description: Comprehensive Ruby and Rails code review using Sandi Metz rules and SOLID principles. Analyzes changed files in current branch vs base branch, runs rubycritic and simplecov, identifies OOP violations, Rails anti-patterns, security issues, code smells, and test coverage gaps. Outputs REVIEW.md with VSCode-compatible file links. Use when reviewing Ruby/Rails code, conducting code reviews, checking for design issues, pull request review, code quality analysis, or when user mentions Sandi Metz, POODR, 99 Bottles, SOLID, Law of Demeter, or "Tell Don't Ask".
---

# Ruby Code Review

Review Ruby/Rails code changes against Sandi Metz rules, SOLID principles, Rails best practices, and security standards. Generate a structured REVIEW.md with clickable VSCode links.

## Workflow

### 1. Detect scope

```bash
# Auto-detect base branch
git remote show origin | grep 'HEAD branch' | cut -d' ' -f5

# Get changed Ruby files (added/changed/modified/renamed only)
git diff --name-only --diff-filter=ACMR base-branch...HEAD | grep '\.rb$'
```

If not on a feature branch, review files specified by the user.

### 2. Run analysis tools

```bash
# RubyCritic on changed files
rubycritic --format json --no-browser $(git diff --name-only base...HEAD | grep '\.rb$')

# SimpleCov coverage run
COVERAGE=true bundle exec rspec
```

Parse rubycritic JSON for complexity/smells/duplication. Read `coverage/.resultset.json` for per-file coverage and uncovered lines. If tools aren't configured, invoke their respective skills for setup guidance.

Optionally run the bundled static analyzer:
```bash
ruby scripts/code_reviewer.rb <file.rb>
```

### 3. Analyze each changed file

Review in this order for each file:

**OOP Design** — Apply Sandi Metz rules and SOLID principles:
- Classes ≤ 100 lines, methods ≤ 5 lines, parameters ≤ 4, instance variables ≤ 4
- Controllers instantiate ≤ 1 object, views reference ≤ 1 instance variable
- SRP, Open/Closed, Liskov, Interface Segregation, Dependency Inversion
- Law of Demeter ("only talk to immediate friends")
- Tell, Don't Ask (objects make their own decisions)
- See [references/sandi-metz-rules.md](references/sandi-metz-rules.md) and [references/solid-principles.md](references/solid-principles.md)

**Code Smells** — Check for the 18 canonical smells:
- Structural: Long Method, Large Class, Long Parameter List, Data Clump
- Coupling: Feature Envy, Message Chains, Inappropriate Intimacy
- Conditional: Complex conditionals, case statements (polymorphism candidates), speculative generality
- Naming: Vague names (Manager, Handler, Processor), methods with "and", flag parameters
- See [references/sandi-metz-rules.md](references/sandi-metz-rules.md) (Code Smells section)

**Rails Patterns** — Detect anti-patterns:
- N+1 queries (missing `includes`/`preload`/`eager_load`)
- Callback overuse (prefer service objects for side effects)
- Fat models (extract to services, queries, presenters, concerns)
- Business logic in controllers
- Missing database indexes
- See [references/rails-patterns.md](references/rails-patterns.md)

**Security** — Flag vulnerabilities:
- SQL injection (string interpolation in queries)
- XSS (`html_safe`/`raw` on user input)
- Mass assignment (missing strong parameters, `permit!`)
- Authorization gaps (missing checks, inconsistent patterns)
- See [references/security-checklist.md](references/security-checklist.md)

**Test Coverage** — Cross-reference with simplecov:
- Untested methods and uncovered lines
- Missing edge case and error path coverage
- Test quality (implementation vs behavior testing, excessive mocking)

### 4. Check codebase patterns

Before making suggestions, understand existing patterns:

```bash
ls app/services/ app/queries/ app/decorators/ app/presenters/ app/policies/ 2>/dev/null
```

Ensure recommendations align with established patterns (naming conventions, abstraction layers, test framework usage). Don't suggest decorators if the codebase uses presenters.

### 5. Generate REVIEW.md

Every code reference MUST use VSCode-compatible links:
```markdown
[description](file:///absolute/path/to/file.rb#L42)
```
See [references/vscode-links.md](references/vscode-links.md) for format details.

Use severity levels for findings:
- **Error**: Serious violations (security, accessing internals, tight coupling)
- **Warning**: Rule violations that should be fixed
- **Info**: Suggestions and best practices
- **Pass**: Correctly following principles

```markdown
# Code Review - [Branch Name]

**Base Branch**: [detected-branch]
**Changed Files**: [count]
**Review Date**: [date]

---

## Summary

[High-level overview of changes and main findings]

## Critical Issues

[Security vulnerabilities, major bugs requiring immediate attention]

## Design & Architecture

### OOP Violations
[Sandi Metz rule and SOLID violations with VSCode links and severity]

### Code Smells
[Detected smells with specific refactoring suggestions]

### Rails Patterns
[N+1 queries, callback issues, anti-patterns with VSCode links]

## Security Concerns

[Vulnerabilities with VSCode links]

## Test Coverage

[Coverage gaps, missing tests, quality issues with VSCode links]

## Tool Reports

### RubyCritic Summary
- **Complexity**: [score]
- **Duplication**: [score]
- **Code Smells**: [count]

### SimpleCov Summary
- **Total Coverage**: [percentage]
- **Files with < 90% coverage**: [list]

---

## Recommendations

[Prioritized improvements aligned with codebase patterns]

## Positive Observations

[Well-designed code, good patterns, improvements from previous reviews]
```

### 6. Validate

Before finalizing:
- [ ] Every code reference has a clickable VSCode link with absolute path
- [ ] All changed files reviewed
- [ ] RubyCritic and SimpleCov findings incorporated
- [ ] Suggestions match existing codebase patterns
- [ ] Positive observations included

## Reference Guides

- [references/sandi-metz-rules.md](references/sandi-metz-rules.md) — Five rules, Law of Demeter, Tell Don't Ask, code smells, Shameless Green philosophy
- [references/solid-principles.md](references/solid-principles.md) — SOLID principles with Ruby examples
- [references/rails-patterns.md](references/rails-patterns.md) — Rails anti-patterns, N+1 queries, callbacks, service objects
- [references/security-checklist.md](references/security-checklist.md) — SQL injection, XSS, mass assignment, auth vulnerabilities
- [references/vscode-links.md](references/vscode-links.md) — VSCode link format and examples
Files in this package (7)
  • SKILL.md 6 KB
  • references/rails-patterns.md 15 KB
  • references/sandi-metz-rules.md 12 KB
  • references/security-checklist.md 15 KB
  • references/solid-principles.md 17 KB
  • references/vscode-links.md 8 KB
  • scripts/code_reviewer.rb 17 KB

Versions

The database has no other skills named review-ruby-code.

Database snapshot: 13.11.2026 · package version 848f69c396bd (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100sandi
    A specialized object-oriented design advisor channeling Sandi Metz's approach (from "Practical Object-Oriented Design in Ruby" and "99 Bottles of OOP"). Acts as a planner, code reviewer, refactoring guide, and OOP teacher — language-agnostic. Use this skill whenever the user…
  • 100simplecov
    Comprehensive test coverage analysis and improvement for Ruby and Rails applications using SimpleCov and SimpleCov Console formatter. Automatically runs coverage reports, identifies gaps, suggests tests, and enforces coverage standards. Integrates with RubyCritic for holistic…
  • 90solid-ruby
    Use when writing or refactoring Ruby/Rails code, structuring app/modules/[feature]/ layers, or defining contracts/ modules (SOLID, files within FUSE_SOLID_MAX_LINES).
  • 86ruby-on-rails
    Ruby on Rails coding conventions and guidelines Triggers on: **/*.rb
  • 100code-review
    Analyzes Rails code quality, architecture, and patterns without modifying code. Use when the user wants a code review, quality analysis, architecture audit, or when user mentions review, audit, code quality, anti-patterns, or SOLID principles. WHEN NOT: Actually implementing…
  • 100rails-cto-qa
    Quality assurance for Ruby on Rails projects — linting, testing, and code review. Use after creating or modifying any Ruby file — controllers, models, commands, services, jobs, tests, or any other .rb file. Proactively run this whenever Ruby files are touched, even if the user…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.