What problem does it solve?
It solves the problem of tangled, hard-to-test ActiveRecord query logic by turning complex database reads into focused, reusable query objects with tests first.
Core Features & Use Cases
- TDD workflow for complex queries: write failing tests under test/queries first, then implement app/queries, and iterate until tests go GREEN.
- Multi-tenant safe scoping: enforce account-scoped filtering so data from other tenants cannot appear in results.
- Clear result contracts: design query objects to return chainable ActiveRecord::Relation for lists or Hash for aggregations, exposing a consistent call method.
Use case: You need a dashboard that aggregates stats and filtered records across many conditions, and you want the logic isolated from controllers while staying testable and tenant-safe.
Quick Start
Ask the skill to generate a TDD Rails query object that takes an account: parameter, writes a matching test under test/queries/, and implements the corresponding app/queries/ query with a call method that returns the expected result type.