This skill guides writing of new Ruby code following modern Ruby 3.x syntax, Sandi Metz's 4 Rules for Developers, and idiomatic Ruby best practices. Use when creating new Ruby files, writing Ruby methods, or refactoring Ruby code to ensure adherence to clarity, simplicity, and maintainability standards.
View on GitHubmajesticlabs-dev/majestic-marketplace
majestic-rails
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/majesticlabs-dev/majestic-marketplace/blob/main/plugins/majestic-rails/skills/ruby-coder/SKILL.md -a claude-code --skill ruby-coderInstallation paths:
.claude/skills/ruby-coder/# Ruby Coder
## Overview
This skill provides comprehensive guidance for writing clean, idiomatic Ruby code that follows modern Ruby 3.x syntax, Sandi Metz's 4 Rules for Developers, and established best practices. Apply these standards when creating new Ruby files, implementing features, or refactoring existing code to ensure clarity, maintainability, and adherence to Ruby conventions.
## Core Philosophy
Prioritize:
- **Clarity over cleverness**: Code should be immediately understandable
- **Simplicity**: Prefer simple, readable solutions over clever code
- **Idiomatic Ruby**: Use Ruby's expressive capabilities appropriately
- **Sandi Metz's Rules**: Enforce strict limits to maintain code quality
- **DRY (Don't Repeat Yourself)**: Eliminate duplication thoughtfully
- **Composition over Inheritance**: Design for flexibility and reusability
## Ruby 3.x Modern Syntax
### Naming Conventions
```ruby
# snake_case for methods and variables
def calculate_total_price
user_name = "David"
end
# CamelCase for classes and modules
module Vendors
class User
end
end
# SCREAMING_SNAKE_CASE for constants
MAX_RETRY_COUNT = 3
DEFAULT_TIMEOUT = 30
```
### Hash Shorthand Syntax
Use the shorthand syntax when hash keys match local variable names (requires exact matching between symbol key and variable name):
```ruby
# Modern Ruby 3.x shorthand
age = 49
name = "David"
user = { name:, age: }
# Instead of the verbose form
user = { name: name, age: age }
```
### String Interpolation
Prefer string interpolation over concatenation:
```ruby
# Good - interpolation
greeting = "Hello, #{user_name}!"
message = "Total: #{quantity * price}"
# Avoid - concatenation
greeting = "Hello, " + user_name + "!"
```
### Modern Hash Syntax
Use symbol keys with colon syntax:
```ruby
# Good - modern syntax
options = { timeout: 30, retry: true, method: :post }
# Avoid - hash rocket syntax (only use for non-symbol keys)
options = { :timeout => 30, :retry => true }
```
## Sandi Metz's 4 Rule