Write reliable Ruby avoiding mutable string traps, block pitfalls, and metaprogramming bugs.
Scanned 9/6/2026
Install to Claude Code
npx -y skills add clawic/skills --skill ruby --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Ruby?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/clawic-ruby)More formats (shields.io, HTML) on the badges page.
---
name: Ruby
slug: ruby
version: 1.0.1
description: Write reliable Ruby avoiding mutable string traps, block pitfalls, and metaprogramming bugs.
homepage: https://clawic.com/skills/ruby
metadata:
clawdbot:
emoji: 💎
requires:
bins:
- ruby
os:
- linux
- darwin
- win32
displayName: Ruby
---
## Quick Reference
| Topic | File |
|-------|------|
| Mutable strings, object equality | `objects.md` |
| Proc vs lambda, return behavior | `blocks.md` |
| Visibility, method_missing | `methods.md` |
| Array/hash mutation traps | `collections.md` |
| define_method, eval traps | `metaprogramming.md` |
| ActiveRecord, N+1, callbacks | `rails.md` |
## Critical Rules
- Strings are mutable — `s = "hi"; s << "!"; t = s` means t also has "!"
- `==` vs `equal?` vs `eql?` — `==` value, `equal?` identity, `eql?` hash equality
- Default hash value is shared — `Hash.new([])` shares same array, use block form
- `return` in proc returns from enclosing method — use lambda for local return
- Block variable shadows outer scope — `x = 1; [2].each { |x| }; x` is still 1 (3.0+)
- `method_missing` without `respond_to_missing?` — breaks `respond_to?` checks
- `private` in Ruby is per-object — `self.private_method` fails, implicit receiver works
- `||=` doesn't work for false/nil distinction — `false ||= true` replaces false
- Frozen string literals — `# frozen_string_literal: true` makes strings immutable
- `Symbol#to_proc` — `&:method_name` only works with no-argument methods
- `rescue => e` without type — catches StandardError, not Exception
- `ensure` always runs — even after return, use for cleanup
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!