hyde-retrieval
HyDE (Hypothetical Document Embeddings) for improved semantic retrieval. Use when queries don't match document vocabulary, retrieval quality is poor, or implementing advanced RAG patterns.
npx skills add majiayu000/claude-skill-registry --skill hyde-retrieval --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# HyDE (Hypothetical Document Embeddings) Generate hypothetical answer documents to bridge vocabulary gaps in semantic search. ## The Problem Direct query embedding often fails due to vocabulary mismatch: ``` Query: "scaling async data pipelines" Docs use: "event-driven messaging", "Apache Kafka", "message brokers" → Low similarity scores despite high relevance ``` ## The Solution Instead of embedding the query, generate a hypothetical answer document: ``` Query: "scaling async data pipelines" → LLM generates: "To scale asynchronous data pipelines, use event-driven messaging with Apache Kafka. Message brokers provide backpressure..." → Embed the hypothetical document → Now matches docs using similar terminology ``` ## Implementation ```python from openai import AsyncOpenAI from pydantic import BaseModel, Field class HyDEResult(BaseModel): """Result of HyDE generation.""" original_query: str hypothetical_doc: str embedding: list[float] async def generate_hyde( query: str, llm: AsyncOpenAI, embed_fn: callable, max_tokens: int = 150, ) -> HyDEResult: """Generate hypothetical document and embed it.""" # Generate hypothetical answer response = await llm.chat.completions.create( model="g
- The Problem
- The Solution
- Implementation
- With Caching
- Per-Concept HyDE (Advanced)
- Overview
- Fallback Strategy
- Performance Tips
- Related Skills
- Key Decisions
- References
What does the hyde-retrieval skill do?
HyDE (Hypothetical Document Embeddings) for improved semantic retrieval. Use when queries don't match document vocabulary, retrieval quality is poor, or implementing advanced RAG patterns.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill hyde-retrieval --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.
