ClaudeCodeMod

All shelves / Skills

similarity-search-patterns

wshobson/agents · 11.3k installs · 42.1K stars

Skill Patterns for implementing efficient similarity search in production systems.

Marked External Downloads · Credentials Unsafe · Command Execution

Install

The repo has no one-line install. Follow its README.

Open the repo

Files

SKILL.md

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
┌─────────────────────────────────────────────────┐
│                 Index Types                      │
├─────────────┬───────────────┬───────────────────┤
│    Flat     │     HNSW      │    IVF+PQ         │
│ (Exact)     │ (Graph-based) │ (Quantized)       │
├─────────────┼───────────────┼───────────────────┤
│ O(n) search │ O(log n)      │ O(√n)             │
│ 100% recall │ ~95-99%       │ ~90-95%           │
│ Small data  │ Medium-Large  │ Very Large        │
└─────────────┴───────────────┴───────────────────┘

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 - ef_search, 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

Facts

Kind
Skill
Repo
wshobson/agents
Group
Uncategorized
Installs
11.3k
Stars
42.1K

Same name on this shelf 1

  1. 23177similarity-search-patternssickn33/antigravity-awesome-skills188

Same repo on other shelves

Marketplaces

  1. 16wshobson/agentswshobson/agentsMulti-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi42.8k

From the same repo

  1. 2725vector-index-tuningwshobson/agents11.3k
  2. 2740hybrid-cloud-networkingwshobson/agents11.2k
  3. 2742pci-compliancewshobson/agents11.2k
  4. 2744turborepo-cachingwshobson/agents11.2k
  5. 2765projection-patternswshobson/agents11.2k
  6. 2768employment-contract-templateswshobson/agents11.2k