All skills
Skillintermediate
/search-similar - Search Similar Items
Find semantically similar items using vector similarity search.
Claude Code Knowledge Pack7/10/2026
Overview
/search-similar - Search Similar Items
Find semantically similar items using vector similarity search.
Steps
- Take the search query text from the user
- Generate an embedding for the query using the same model as the index
- Perform approximate nearest neighbor search in the vector store
- Retrieve the top-K most similar items (default: 10)
- Calculate and display similarity scores for each result
- Apply metadata filters if specified (category, date range, source)
- Re-rank results using cross-encoder for improved precision
- Deduplicate results that are too similar to each other (similarity > 0.95)
- Format results with: rank, similarity score, source text, metadata
- Provide a relevance assessment for the top results
- Suggest query refinements if results are not satisfactory
- Cache the query embedding for repeated searches
Rules
- Use the same embedding model for queries and indexed items
- Set a minimum similarity threshold to filter irrelevant results (default: 0.5)
- Return metadata with results for context and source attribution
- Handle empty results gracefully with alternative search suggestions
- Limit result count to avoid overwhelming output (max 50)
- Include the similarity metric used (cosine, dot product, euclidean)
- Cache frequently searched queries for faster response times