oop-service-objects

Installation
SKILL.md

Service Objects

What it is

A Service Object is a plain Ruby class that encapsulates one business operation. It has a single entry point (conventionally call), accepts input, performs the work, and returns a result. It's a fallback for operations that genuinely don't belong to any model — not a default architecture.

Warning: Rails' own idiom (the DHH/37signals tradition) is to put behavior on models, not to extract it into services. An app full of *Service classes is the anemic domain model antipattern. Start there. Come back here when you've exhausted simpler options.

Would a fat model / concern / form object do?

Run through this checklist before creating a service object:

  1. Does it belong on one model? → Add a method to that model.
  2. Does it involve a form or multi-model input? → Use a form object.
  3. Is it complex query logic? → Use a query object.
  4. Is it shared behavior across models? → Use a concern.
  5. Does it span multiple models with no natural home?Now consider a service object.
Installs
2
First Seen
May 8, 2026
oop-service-objects — gierd-inc/dev-skills