Agent skill · data analytics · wshobson

similarity-search-patterns

Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.

Why this skill is useful

Provides domain-specific knowledge on distance metrics and index types for efficient similarity search that the AI wouldn't reliably generate on its own.

What it needs

About 1k tokens when loaded. Last updated 2026-08-05. 38,570 stars on the source repository.

What this skill does

Similarity Search Patterns Patterns for implementing efficient similarity search in production systems. When to Use This Skill Building semantic search systems Implementing RAG retrieval Creating recommendation engines Optimizing search latency Scaling to millions of vectors Combining semantic and keyword search Core Concepts 1. Distance Metrics Metric Formula Best For ------------------ ------------------ --------------------- --- -------------- Cosine 1 - (A·B)/(‖A‖‖B‖) Normalized embeddings Euclidean (L2) √Σ(a-b)² Raw embeddings Dot Product A·B Magnitude matters Manhattan (L1) Σ a-b Sparse vectors 2. Index Types 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 Use appropriate index - HNSW for most cases Tune parameters - efsearch, nprobe for recall/speed Implement hybrid search - Combine with keyword search Monitor recall - Measure search quality Pre-filter when possible - Reduce search space Don'ts Don't skip evaluation - Measure before optimizing Don't over-index - Start with flat, scale up Don't ignore latency - P99 matters for UX Don't forget costs - Vector storage adds up

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills wshobson/similarity-search-patterns

View the source on GitHub

Browse the @skills marketplace