Agent skill · Code Review & Quality

multi-query

Use when search queries need better recall through query expansion - generates multiple query variants, retrieves with each, and fuses results using RRF for improved retrieval quality especially with ambiguous or under-specified queries

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill multi-query --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 22 KB
Bundled scripts: none
Version: 0.5.0
Path: skills/ai-llm/multi-query/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Generates multiple variants of a given query, searches with each variant independently, and then fuses the results using Reciprocal Rank Fusion (RRF) to return a unified, deduplicated set of results. It supports two expansion modes: a fast heuristic variant and an optional LLM-based semantic variant, configurable by max_query_variants and query_expansion settings. It is designed for queries that are ambiguous or underspecified and aims to balance recall and latency.

How it works

  • Generates query variants from the original query using heuristic rules (and optionally LLM-based methods when enabled).
  • For each variant, performs a separate search (executed sequentially in the described examples).
  • Applies RRF fusion to combine variant results into a final result list, deduplicating by chunk_id and computing an aggregate rrf_score per chunk.
  • Returns the fused results, with each result carrying an rrf_score reflecting consensus across variants.
  • Supports configuration for enabling/disabling expansion per query, setting max_query_variants, and optional reranking and metadata filtering integrations.

When to use it

Use when queries are ambiguous or under-specified, or when you want to capture different phrasings and perspectives to improve recall. Consider it for short or vague queries where recall benefits from multiple lexical or semantic variants. Avoid for very specific queries or when latency is critical; expansion adds overhead and multiple variant searches.

What it can touch

  • Executes multiple searches per variant (variants are searched sequentially as shown in examples).
  • Uses RRF fusion to combine results across variants.
  • Can enable optional LLM-based expansion and adjust max_query_variants (1-5 practical range).
  • Can apply metadata_filter and date_from for scoped searches; supports reranking configurations when combined.

Caveats

  • Expansion mode can add latency; heuristic mode is faster (<1ms per variant) while LLM-based mode introduces higher latency (50-200ms) and requires API keys.
  • Default max_query_variants is 3; practical range is 1-5.
  • RRF uses a constant k=50 in scoring to temper top-ranked results.
  • Deduplication is by chunk_id across variants.
From the SKILL.md

# LLMemory Multi-Query Expansion ## Installation ```bash uv add llmemory # or pip install llmemory ``` ## Overview Multi-query expansion improves search recall by: 1. Generating multiple query variants from the original query 2. Searching with each variant independently 3. Fusing results using Reciprocal Rank Fusion (RRF) 4. Returning unified, deduplicated results **Two expansion modes:** - **Heuristic (default)**: Fast lexical variants using keyword extraction, OR clauses, and phrase matching. No LLM calls, <1ms latency. - **LLM-based (configurable)**: Semantic query variants using GPT-4o-mini or similar. Better recall, 50-200ms latency, requires API key. **When to use multi-query expansion:** - Queries are ambiguous or under-specified - Want to capture different perspectives or phrasings - Improve recall for complex information needs - User queries tend to be short or vague **When NOT to use:** - Queries are already very specific - Latency is critical (multi-query adds overhead) - Simple keyword lookups ## Quick Start ```python from llmemory import LLMemory, SearchType async with LLMemory(connection_string="postgresql://localhost/mydb") as memory: # Enable query expansion results

What's inside
Steps it walks through
  1. Installation
  2. Overview
  3. Quick Start
  4. Complete API Documentation
  5. search() with Query Expansion
  6. How Multi-Query Works
  7. Query Variant Generation
  8. Search Execution
  9. RRF Fusion
  10. Practical Examples
  11. Customer Support Search
  12. Product Documentation Search
  13. Research & Discovery
  14. E-commerce Search
Ships with 1 file
  • metadata.json
Commands it runs
uv add llmemory
or
pip install llmemory
Environment variables
More from claude-skill-registry
All skills →
About this skill
What does the multi-query skill do?

Use when search queries need better recall through query expansion - generates multiple query variants, retrieves with each, and fuses results using RRF for improved retrieval quality especially with ambiguous or under-specified queries

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill multi-query --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going