simplifying-ruby-code
Installation
SKILL.md
Simplifying Ruby Code
Core Principle
Prefer simple data structures (Hash, Array, Struct, Data) and pure functions over unnecessary classes and abstractions.
MANDATORY: Identify whether code is a decision (pure logic) or effect (I/O). Keep them separate. See writing-code skill.
When to Use
- Command objects with single
callmethod and no state - Value objects that just wrap data without behavior
- Service classes that could be module functions
- Custom classes for simple data (coordinates, ranges, tuples)
- Deep inheritance where composition would work
- Missing Ruby protocols (
to_h,to_a,each) - Tests require extensive mocking (indicates mixed concerns)