enumerable-refactor

Installation
SKILL.md

Enumerable Refactor

Overview

This skill identifies and refactors the most common Ruby anti-pattern: initializing an empty variable and populating it with .each. Almost every time you see this pattern, a purpose-built Enumerable method exists that is more concise, expressive, and often more performant.

The Core Anti-Pattern

# ANY time you see this shape, it can almost certainly be refactored:
result = []        # or {}, 0, "", Set.new, false, nil
something.each do |item|
  # ... build up result ...
end
result

When to Use This Skill

Related skills

More from nateberkopec/dotfiles

Installs
1
GitHub Stars
98
First Seen
Apr 7, 2026