ruby

SKILL.md

Critical Patterns

Ruby Idioms (REQUIRED)

# ✅ ALWAYS: Use Ruby idioms
users.map(&:name)                    # Symbol to proc
user&.address&.city                  # Safe navigation
name ||= "Default"                   # Memoization

Class Structure (REQUIRED)

# ✅ ALWAYS: Clear class structure
class User
  attr_reader :name, :email
  
  def initialize(name:, email:)
    @name = name
    @email = email
  end
  
  def admin?
    role == 'admin'
  end
end

Error Handling (REQUIRED)

# ✅ Use custom exceptions
class UserNotFoundError < StandardError; end

def find_user!(id)
  user = User.find_by(id: id)
  raise UserNotFoundError, "User #{id} not found" unless user
  user
end

Decision Tree

Need attribute access?     → Use attr_reader/writer
Need boolean check?        → Use predicate method (?)
Need dangerous operation?  → Use bang method (!)
Need configuration?        → Use block with yield

Commands

ruby script.rb             # Run script
irb                        # Interactive Ruby
bundle install             # Install dependencies
rspec                      # Run tests
rubocop                    # Lint code

Resources

Weekly Installs
5
First Seen
Jan 26, 2026
Installed on
github-copilot5
gemini-cli4
cline4
codex4
continue4
cursor4