# Ruby

> Use when: write or review idiomatic, readable Ruby with clear objects and expressive methods.

- Skill: `kimtth/ruby` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kimtth/ruby`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kimtth/ruby/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: kimtth (https://skillmd.com/u/kimtth)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kimtth/ruby

---


Goal: readable, well-factored Ruby that reads like intent.

Use for:
- new Ruby code, scripts, or Rails-adjacent logic
- reviewing object design, naming, and method length
- untangling long methods or god objects

Workflow:
1. Keep methods short and named for what they do.
2. Favor small objects with single responsibilities.
3. Use enumerable methods (map, select, reduce) over manual loops.
4. Raise specific exceptions; rescue narrowly.
5. Prefer immutable data and frozen constants where sensible.
6. Verify with RSpec/Minitest and RuboCop.

Idioms:
- blocks and yield for iteration and resource handling
- keyword arguments for clear call sites
- guard clauses over nested conditionals
- duck typing with clear method contracts

Rules:
- rescue specific errors, never bare rescue
- keep methods small; extract when they grow
- avoid metaprogramming unless it clearly pays off
- name things for behavior, not implementation

