reranking-patterns
Reranking patterns for improving search precision. Use when implementing cross-encoder reranking, LLM-based relevance scoring, or improving retrieval quality in RAG pipelines.
npx skills add majiayu000/claude-skill-registry --skill reranking-patterns --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.
# Reranking Patterns Improve search precision by re-scoring retrieved documents with more powerful models. ## Overview - Improving precision after initial retrieval - When bi-encoder embeddings miss semantic nuance - Combining multiple relevance signals - Production RAG systems requiring high accuracy Improve search precision by re-scoring retrieved documents with more powerful models. ## Why Rerank? Initial retrieval (bi-encoder) prioritizes speed over accuracy: - Bi-encoder: Embeds query and docs separately → fast but approximate - Cross-encoder/LLM: Processes query+doc together → slow but accurate **Solution**: Retrieve many (top-50), rerank few (top-10) ## Pattern 1: Cross-Encoder Reranking ```python from sentence_transformers import CrossEncoder class CrossEncoderReranker: def __init__(self, model_name: str = "cross-encoder/ms-marco-MiniLM-L-6-v2"): self.model = CrossEncoder(model_name) def rerank( self, query: str, documents: list[dict], top_k: int = 10, ) -> list[dict]: """Rerank documents using cross-encoder.""" # Create query-document pairs pairs = [(query, doc["content"]) for doc in documents] # Score all pairs scores = self.model.predict(pairs) # Sort by score scored_doc
- Overview
- Why Rerank?
- Pattern 1: Cross-Encoder Reranking
- Pattern 2: LLM Reranking (Batch)
- Pattern 3: Cohere Rerank API
- Pattern 4: Combined Scoring
- Complete Reranking Service
- Model Selection Guide
- Best Practices
- Related Skills
- Key Decisions
- References
What does the reranking-patterns skill do?
Reranking patterns for improving search precision. Use when implementing cross-encoder reranking, LLM-based relevance scoring, or improving retrieval quality in RAG pipelines.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill reranking-patterns --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.
