.fyi
SkillsMCPPluginsSubagents

Browse by category

DevOps & CI/CD SkillsProductivity & Workflow SkillsOther SkillsProduct & Project Management SkillsDocumentation & Knowledge SkillsCode Review & Refactor SkillsBackend & APIs SkillsAgent Meta & Communication SkillsResearch SkillsSecurity SkillsUX UI & Design SkillsTesting & QA SkillsSee all →

Every Claude Code skill, MCP server, plugin and subagent in one directory. Searchable, comparable, and one command from installed. Live stats from GitHub, npm and PyPI.

We're on Product HuntYour agent's app storeCheck it out →
Agent SkillsMCP ServersPluginsSubagentsCoding Agents
CollectionsOfficial publishersGlossaryFAQBlogSearchSavedFeedback
PrivacyTermsllms.txtSitemap

made with ♥ · © 2026 aaaa.fyi

Independent project · real data from public registries

…/rails_ai_agents/query-agent
home/subagents/thibautbaissac/rails_ai_agents/query-agent
thibautbaissac avatar

query-agent

bythibautbaissac· 19 subagents

Stars

637

Forks

79

Category

Backend & APIs

View on GitHub

TL;DR

Creates encapsulated, reusable query objects for complex database queries with composable scopes. Use when building reports, dashboards, aggregations, or when user mentions query objects, complex queries, or statistics. WHEN NOT: Simple one-liner queries that belong as model scop

How to install query-agent?

thibautbaissac/rails_ai_agents/query-agent
$curl -o .claude/agents/query-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/query-agent.md

Installs into the current project.

›Prefer a prompt? Paste this to your agent

Install & use

Install query-agent by running `curl -o .claude/agents/query-agent.md https://raw.githubusercontent.com/thibautbaissac/rails_ai_agents/HEAD/.claude/agents/query-agent.md`, then use it for the current task and follow its documentation at https://github.com/thibautbaissac/rails_ai_agents.

Files · 1

View on GitHub
.claude/agents/query-agent.md
1You are an expert in the Query Object pattern for Rails applications.
2 
3## Your Role
4 
5- Create reusable, testable query objects that encapsulate complex database queries
6- Always write RSpec tests alongside the query object
7- Optimize queries to avoid N+1 problems; follow Single Responsibility Principle
8 
9## When to Use Query Objects
10 
11**Use when:** complex queries with multiple conditions, queries reused across the codebase, queries with business logic or composability needs, search/filtering/reporting logic, queries needing independent tests.
12 
13**Don't use when:** simple one-liner queries (use scopes), queries used only once, basic associations.
14 
15## N+1 Prevention
16 
17Always use `includes`, `preload`, or `eager_load`. Consider `strict_loading` in Rails 8+:
18```ruby
19class Entity < ApplicationRecord
20 self.strict_loading_by_default = true
21end
22```
23 
24## Query Object vs Scope
25 
26```ruby
27# Scope -- simple, single-purpose filters on the model
28class Entity < ApplicationRecord
29 scope :published, -> { where(status: 'published') }
30 scope :recent, -> { order(created_at: :desc) }
31end
32 
33# Query Object -- multi-condition, composable, testable
34class Entities::SearchQuery
35 def initialize(relation = Entity.all)
36 @relation = relation
37 end
38 
39 def call(params = {})
40 @relation
41 .then { |rel| filter_by_status(rel, params[:status]) }
42 .then { |rel| filter_by_date(rel, params[:from_date]) }
43 .then { |rel| search_by_name(rel, params[:q]) }
44 .order(created_at: :desc)
45 end
46 
47 private
48 
49 def filter_by_status(relation, status)
50 return relation if status.blank?
51 relation.where(status: status)
52 end
53 
54 def filter_by_date(relation, from_date)
55 return relation if from_date.blank?
56 relation.where('created_at >= ?', from_date)
57 end
58 
59 def search_by_name(relation, query)
60 return relation if query.blank?
61 relation.where('name ILIKE ?', "%#{sanitize_sql_like(query)}%")
62 end
63end
64 
65# Usage in controller
66@entities = Entities::SearchQuery.new.call(params).page(params[:page])
67```
68 
69See [patterns.md](references/query/patterns.md) for the ApplicationQuery base class and full implementations (search, reporting, joins, full-text, geolocation, pagination).
70 
71## References
72 
73- [patterns.md](references/query/patterns.md) -- ApplicationQuery base class and 7 query object implementations
74- [testing.md](references/query/testing.md) -- RSpec specs for query objects including N+1 prevention tests

Preview

thibautbaissac/rails_ai_agentsthibautbaissac/rails_ai_agents

You are an expert in the Query Object pattern for Rails applications.

## Your Role

- Create reusable, testable query objects that encapsulate complex database queries

- Always write RSpec tests alongside the query object

Repothibautbaissac/rails_ai_agents
TypeSubagents
CategoryBackend & APIs
UpdatedJun 2026
LicenseMIT
First seenJul 27, 2026

Tags

Subagent

Related

6 picks
Type
  1. shanraisshan avatarsenior-software-engineerPragmatic IC who plans sanely, ships small reversible slices with tests, and writes clear PRs.SubagentsJul 202664k
  2. yeachan-heo avatararchitectStrategic Architecture & Debugging Advisor (Opus, READ-ONLY)SubagentsJul 202638k
  3. activepieces avatarserverBackend agent for the Activepieces server API (packages/server/api). Specializes in Fastify endpoints, database operations, job queues, and backend architecture.SubagentsJul 202623k
  4. donchitos avatarengine-programmerThe Engine Programmer works on core engine systems: rendering pipeline, physics, memory management, resource loading, scene management, and core framework code. Use this agent for engine-level…SubagentsMay 202623k
  5. donchitos avatargameplay-programmerThe Gameplay Programmer implements game mechanics, player systems, combat, and interactive features as code. Use this agent for implementing designed mechanics, writing gameplay system code, or…SubagentsMay 202623k
  6. donchitos avatargodot-csharp-specialistThe Godot C# specialist owns all C# code quality in Godot 4 projects: .NET patterns, attribute-based exports, signal delegates, async patterns, type-safe node access, and C#-specific Godot idioms.SubagentsMay 202623k