Ruby

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

kimtth 67464ba 1.0 KB Updated

File contents

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

kimtth/agent-skill-100-lines-or-less/tree/main/skills/ruby commit 67464ba906

Frequently asked questions

npx skillmds@latest add kimtth/ruby