oop-repository-pattern

Installation
SKILL.md

Repository Pattern

You probably don't need this. ActiveRecord already implements the Repository pattern. Post.where(...), Post.find(...), post.save — that's your repository. This skill documents when and how to add a repository layer on top of AR, and why the bar is high.

What it is

The Repository pattern places a seam between your domain objects and the persistence mechanism. Code that needs data calls a repository; the repository decides how to fetch or store it. In a pure implementation, domain objects don't know about ActiveRecord at all.

When AR is enough (almost always)

  • You're using a relational database and have no plans to change
  • You can test by hitting the real DB (Rails fixtures + Minitest — fast, honest)
  • Scopes and query objects cover your query complexity

When the repository pattern earns its cost

Installs
2
First Seen
May 8, 2026
oop-repository-pattern — gierd-inc/dev-skills