Ruby
Write reliable Ruby avoiding mutable string traps, block pitfalls, and metaprogramming bugs.
by clawic★ 23 GitHub stars
Install Ruby in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
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 = smeans t also has "!" ==vsequal?vseql?—==value,equal?identity,eql?hash equality- Default hash value is shared —
Hash.new([])shares same array, use block form returnin proc returns from enclosing method — use lambda for local return- Block variable shadows outer scope —
x = 1; [2].each { |x| }; xis still 1 (3.0+) method_missingwithoutrespond_to_missing?— breaksrespond_to?checksprivatein Ruby is per-object —self.private_methodfails, implicit receiver works||=doesn't work for false/nil distinction —false ||= truereplaces false- Frozen string literals —
# frozen_string_literal: truemakes strings immutable Symbol#to_proc—&:method_nameonly works with no-argument methodsrescue => ewithout type — catches StandardError, not Exceptionensurealways runs — even after return, use for cleanup
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- _meta.json
- blocks.md
- collections.md
- metaprogramming.md
- methods.md
- objects.md
- rails.md
FAQ
What does the Ruby skill do?
Write reliable Ruby avoiding mutable string traps, block pitfalls, and metaprogramming bugs.
How do I install the Ruby skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Ruby skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…