# Query Retriever

> Finds document sections most relevant to a user query using semantic similarity search. Use when you need to locate specific information within processed documents for answering questions.

- Skill: `praveen7287/query-retriever` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add praveen7287/query-retriever`
- Raw SKILL.md: https://api.skillmd.com/api/skills/praveen7287/query-retriever/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Praveen7287 (https://skillmd.com/u/praveen7287)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/praveen7287/query-retriever

---

# Query Retrieval Instructions

## Retrieval Methodology

1. **Embed document chunks** using sentence-transformers model
2. **Embed user query** using same model
3. **Calculate cosine similarity** between query and chunk embeddings
4. **Return top-k results** with similarity scores above threshold

## Advanced Features

- **Hybrid search**: Combine semantic and keyword matching
- **Query expansion**: Add synonyms and related terms
- **Reranking**: Use cross-encoder for better precision
- **Caching**: Store embeddings to avoid recomputation

## Implementation

```python
def retrieve_relevant_chunks(query, chunks, top_k=5):
    # Implementation here
    pass
