query

Encapsulate complex database queries into reusable query objects for Rails apps.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/reckerswartz/resume_builder --skill query-reckerswartz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query
Source: https://github.com/reckerswartz/resume_builder/tree/main/.devin/skills/query
Command: npx skills add https://github.com/reckerswartz/resume_builder --skill query-reckerswartz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Encapsulates complex database queries into reusable, composable query objects to reduce duplication and improve testability.

Core Features & Use Cases

  • Encapsulated query logic in app/queries that can be composed with .call or other methods
  • Prevents N+1 problems via includes/preload and well-chosen eager loading
  • Supports multi-tenant patterns and test-driven development with dedicated specs
  • Ideal for building reports, dashboards, and analytics across Rails applications

Quick Start

Define a new query under app/queries, write its RSpec tests under spec/queries, and use the query in a controller or service to fetch a relation.

Frequently Asked Questions about query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I encapsulate complex ActiveRecord queries in Rails to reduce duplication?

Build reusable query objects under app/queries to encapsulate complex ActiveRecord queries. These composable classes return ActiveRecord::Relation objects, reducing duplication and improving testability across Rails applications.

What is a query object in Rails and when should I use one?

A query object is a reusable class encapsulating complex database queries. Use query objects in Rails when building reports, dashboards, or analytics to isolate data access logic and prevent N+1 problems via eager loading.

How do I prevent N+1 query problems in Rails analytics dashboards?

Prevent N+1 query problems in Rails analytics dashboards by building query objects that utilize includes or preload for eager loading. This encapsulates data access patterns and ensures scalable querying for reports.

Can I use query objects to support multi-tenant patterns in Rails applications?

Yes, you can use query objects to support multi-tenant patterns in Rails applications. Placing composable query logic under app/queries isolates tenant-specific data access and returns scoped ActiveRecord::Relation objects.

How do I test query objects in Rails with RSpec?

Test query objects in Rails by writing dedicated RSpec tests under spec/queries. This test-driven development approach ensures encapsulated database queries function correctly and return expected ActiveRecord::Relation results.