agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/languages/ruby/SKILL.md

ruby

Skill15 starsChanged 41 days agoMITView on GitHub

Expert Ruby programming assistance covering blocks, metaprogramming, Bundler, gems, and modern Ruby 3.x features. Use when developing Rails web apps, writing CLI utilities, or managing Ruby gems.

11 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use grill-me.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    grill-me

    A relentless interview to sharpen a plan or design.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every value in Ruby is a full-fledged object.

    line 40
  2. Distinctive:

    Use Ruby 3 native pattern matching:

    line 91
  3. Distinctive:

    Use RuboCop with Modern Presets: Enforce style consistency and detect security pitfalls with automated RuboCop linting.

    line 113
  4. Very specific:

    Use Sorbet or RBS for Type Checking: Add static typing to mission-critical business modules.

    line 115
  5. Distinctive:

    Use monkey-patching in application code: Overriding core methods globally creates fragile, untraceable bugs across gems.

    line 119

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Ruby

A dynamic, interpreted language known for its elegant syntax.

When to Use

  • Rapid Web Application Development (Ruby on Rails): Building full-stack web applications, startups, and MVPs with unmatched developer velocity.
  • E-Commerce & Digital Storefronts: Powering platforms like Shopify, Spree Commerce, and custom checkout flows.
  • Developer Tooling & Automation: Authoring automated DevOps scripts, Homebrew formulas, and Fastlane mobile deployment pipelines.
  • Background Processing & Queues: Executing asynchronous jobs using Sidekiq backed by Redis.

Quick Start

puts "Hello, World!"

class Greeter
  def initialize(name)
    @name = name
  end

  def say_hi
    puts "Hi #{@name}!"
  end
end

g = Greeter.new("Alice")
g.say_hi

Core Concepts

Object-Oriented Everything & Dynamic Metaprogramming

Every value in Ruby is a full-fledged object; classes can be modified dynamically at runtime:

class Integer
  def to_usd
    "$#{format('%.2f', self)}"
  end
end

puts 100.to_usd # "$100.00"

Blocks, Procs & Enumerable Power

Passes executable code blocks to methods for clean data manipulation:

orders = [
  { id: 1, total: 45.0, status: :completed },
  { id: 2, total: 120.0, status: :pending },
  { id: 3, total: 85.0, status: :completed }
]

completed_revenue = orders
  .select { |o| o[:status] == :completed }
  .sum { |o| o[:total] }

puts "Completed Revenue: $#{completed_revenue}" # 130.0

Modern Concurrency (Fibers & Ractor)

Runs true parallel execution without Global VM Lock (GVL) contention using Ractors (Ruby 3+):

# Parallel computation across multiple CPU cores
r = Ractor.new do
  # Completely isolated memory space
  1_000_000.times.reduce(:+)
end

puts "Ractor Result: #{r.take}"

Common Patterns

Pattern Matching with Value Extraction (Ruby 3+)

Problem: Verbose nested if/elsif conditionals when handling structured JSON API responses.

Solution: Use Ruby 3 native pattern matching:

def handle_response(response)
  case response
  in { status: 200, data: { user: { name:, email: } } }
    puts "User found: #{name} <#{email}>"
  in { status: 404, error: msg }
    warn "Not found: #{msg}"
  in { status: (500..) }
    raise "Server error occurred"
  else
    puts "Unknown response format"
  end
end

Best Practices

Do:

  • Enable YJIT in Production: Launch Ruby with --yjit to enable the native Just-in-Time compiler, boosting performance 20-40%.
  • Use RuboCop with Modern Presets: Enforce style consistency and detect security pitfalls with automated RuboCop linting.
  • Freeze String Literals: Add # frozen_string_literal: true at the top of files to reduce heap string allocations.
  • Use Sorbet or RBS for Type Checking: Add static typing to mission-critical business modules.

Don't:

  • Use monkey-patching in application code: Overriding core methods globally creates fragile, untraceable bugs across gems.
  • Query the database inside loops (N+1): Use .includes() or .preload() in ActiveRecord to eager-load associations.
  • Rescue Exception: Always rescue StandardError (rescue => e); rescuing Exception catches system exit and termination signals.

Troubleshooting

ErrorCauseSolution
NoMethodError: undefined method '...' for nil:NilClassCalling method on a nil object.Use safe navigation operator object&.method_name.
LoadError: cannot load such file -- ...Gem not installed or missing in Gemfile.Run bundle install and execute script via bundle exec ruby script.rb.
NameError: uninitialized constantConstant/Class not required or module nesting typo.Check file require paths and ensure file naming matches Zeitwerk conventions.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.