What problem does it solve?
This Skill streamlines complex database interactions in Rails applications by encapsulating intricate queries into reusable, testable Query Objects, preventing messy logic in controllers and models.
Core Features & Use Cases
- Encapsulates Complex Queries: Organizes SQL logic into dedicated classes.
- Promotes Reusability: Allows queries to be easily shared and maintained across the application.
- Enhances Testability: Enables isolated testing of query logic.
- Prevents N+1 Queries: Encourages the use of
includes and other eager loading techniques.
- Use Case: When building a reporting dashboard that requires filtering by multiple criteria, sorting, and aggregations, use this Skill to create a clean
SalesDataQuery object instead of cluttering your controller.
Quick Start
Use the query-agent skill to create a new ActiveRecord query object for filtering users by their last login date.