Index of every page on this site: llms.txt
All skills
wshobson avatar

/hybrid-search-implementation

@4220308
by Seth Hobsonwshobson/agents43k stars
4,518
Run it yourself

Combine vector and keyword search for improved retrieval. Use when implementing RAG systems, building search engines, or when neither approach alone provides sufficient recall.

Use this Skill: https://skilld.dev/gh/wshobson/agents/hybrid-search-implementation

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈52 tokens for metadata: the name and description. ≈450 when used: this file. ≈4k more on demand in 1 file.

Description uses 2.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈207 characters, or 2.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Hybrid Search Implementation

Patterns for combining vector similarity and keyword-based search.

When to Use This Skill

  • Building RAG systems with improved recall
  • Combining semantic understanding with exact matching
  • Handling queries with specific terms (names, codes)
  • Improving search for domain-specific vocabulary
  • When pure vector search misses keyword matches

Core Concepts

1. Hybrid Search Architecture

Query → ┬─► Vector Search ──► Candidates ─┐
        │                                  │
        └─► Keyword Search ─► Candidates ─┴─► Fusion ─► Results

2. Fusion Methods

Method Description Best For
RRF Reciprocal Rank Fusion General purpose
Linear Weighted sum of scores Tunable balance
Cross-encoder Rerank with neural model Highest quality
Cascade Filter then rerank Efficiency

Templates and detailed worked examples

Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.

Best Practices

Do's

  • Tune weights empirically - Test on your data
  • Use RRF for simplicity - Works well without tuning
  • Add reranking - Significant quality improvement
  • Log both scores - Helps with debugging
  • A/B test - Measure real user impact

Don'ts

  • Don't assume one size fits all - Different queries need different weights
  • Don't skip keyword search - Handles exact matches better
  • Don't over-fetch - Balance recall vs latency
  • Don't ignore edge cases - Empty results, single word queries

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides safe, high-quality reference implementation patterns and code templates for combining vector and keyword search (hybrid search) using various platforms including PostgreSQL, Elasticsearch, and custom pipelines. No security vulnerabilities, malicious intent, or suspicious behaviors were identified.

  • Socket2mo

    1 alert: gptAnomaly

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer8mo

    1/1 file flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 4220308. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 6 months ago
  • hybrid-search
  • vector-search
  • keyword-search
  • rag
  • retrieval
  • search-ranking
  • fusion
  • reranking

README badge

README badge for wshobson/agents/hybrid-search-implementation

Combines vector similarity and keyword search for improved retrieval in RAG systems and search engines. Provides fusion methods (RRF, linear weighting, cross-encoder reranking, cascade filtering) to balance semantic understanding with exact term matching, handling domain-specific vocabulary and queries vector search alone would miss.

Generated from the current SKILL.md.

What fusion methods does this skill cover?
The skill covers RRF (Reciprocal Rank Fusion), linear weighted sum, cross-encoder reranking, and cascade filtering. RRF is recommended for general-purpose use without tuning.
Does this skill include concrete implementation templates?
Yes. Detailed templates and worked examples are in references/details.md within the skill.
What search libraries or frameworks does this integrate with?
The SKILL.md does not specify integration with particular search libraries or frameworks. It focuses on architectural patterns and fusion methods that can be applied across different search backends.
Can this improve vector-only search recall?
Yes. Combining vector search with keyword search improves recall by handling exact matches and domain-specific vocabulary that pure vector search may miss.

Generated from the current SKILL.md. These answers refresh after source changes.