active-record-querying

Installation
SKILL.md

Active Record Querying Expert

Write efficient, correct, and maintainable Active Record queries. Avoid N+1s, unnecessary memory allocation, and query anti-patterns.

Philosophy

  1. Let the database do the work — Filter, sort, count, and aggregate in SQL, not Ruby
  2. Load only what you need — Don't SELECT * when you need one column
  3. Prevent N+1 by default — Always think about associations before iterating
  4. Scopes over ad-hoc queries — Named, composable, testable
  5. Fail loudly — Use bang methods when a missing record is a bug

Decision Trees

Finding a Single Record

Need a record by primary key?
  → find(id)                    # Raises if not found — this is usually what you want
Related skills

More from thinkoodle/rails-skills

Installs
4
GitHub Stars
4
First Seen
12 days ago