Skip to main content
skill Claude Code CX Codex Cursor

similarity-search-patterns — Claude Code skill

This skill helps build similarity search with vector databases for semantic search, RAG retrieval, nearest-neighbor queries, and hybrid search.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add wshobson/agents
/plugin install llm-application-dev@claude-code-workflows
Open on GitHub

What similarity-search-patterns does

similarity-search-patterns covers patterns for similarity search in vector databases. It fits semantic search, RAG retrieval, recommendation engines, and nearest-neighbor queries. The material explains cosine, Euclidean, dot-product, and Manhattan distance, plus the trade-offs between Flat, HNSW, and IVF+PQ indexes.

The skill shows how to tune ef_search and nprobe, combine semantic and keyword search, pre-filter the search space, and measure recall. Templates and worked examples are stored in references/details.md. It also covers search latency, P99, and the cost of vector storage.

Install it when a project needs vector retrieval or RAG and the team will measure result quality. A regular full-text search without vector data does not need this skill.

What it helps with

  • build semantic search over vector data
  • implement nearest-neighbor queries
  • choose an index for the dataset size
  • combine semantic and keyword results
  • tune recall and search latency

Example prompts for the agent

  • Design semantic search for this project and choose an appropriate index.
  • Compare Flat, HNSW, and IVF+PQ for our use case and explain the trade-offs.
  • Add hybrid search with pre-filtering and define how to measure recall.

How to install similarity-search-patterns

1Plugin marketplace

/plugin marketplace add wshobson/agents
/plugin install llm-application-dev@claude-code-workflows

This installs the whole llm-application-dev plugin with all its skills

2Skills CLI (Vercel)

npx skills add wshobson/agents --skill similarity-search-patterns -a claude-code

3Manually: put the files in place

~/.claude/skills/similarity-search-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/similarity-search-patterns/

From the same set213

The whole set →
typescript-advanced-types Seth Hobson Guides an agent through advanced TypeScript types, from generics to conditional and mapped types. Use it for typed libraries, API clients, or strict configuration objects. Claude Code CX Codex Cursor 92,169installs tailwind-design-system Seth Hobson Helps build design systems with Tailwind CSS v4, from theme tokens to component variants. Use it when a project needs shared UI patterns. Claude Code CX Codex Cursor 70,180installs brand-landingpage Travis D. Elliott This skill interviews you about the product and its visual direction, then builds a landing page through Stitch. Use it when there’s no established design yet. Claude Code CX Codex Cursor 39,476installs python-testing-patterns Seth Hobson This skill guides Python testing with pytest, fixtures and mocks. Use it when building a test suite or tracking down failing checks. Claude Code CX Codex Cursor 36,943installs python-performance-optimization Seth Hobson This skill profiles Python code to locate CPU and memory bottlenecks. Use it when an application responds slowly or consumes too many resources. Claude Code CX Codex Cursor 35,675installs nextjs-app-router-patterns Seth Hobson This skill covers Next.js App Router patterns for rendering, routing, and data fetching. Use it when starting an App Router project or moving from Pages Router. Claude Code CX Codex Cursor 32,529installs api-design-principles Seth Hobson Use this skill to plan or review REST and GraphQL APIs. It helps when writing a specification or setting API conventions for a team. Claude Code CX Codex Cursor 30,348installs code-review-excellence Seth Hobson This skill guides pull request reviews, catches logic and security issues, and helps teams give specific feedback. Use it for review standards or developer mentoring. Claude Code CX Codex Cursor 30,193installs

Similar

prisma-database-setup prisma A deprecated compatibility name for prisma-orm-setup, which handles Prisma setup and database connection repair. Claude Code CX Codex Cursor +1 388,400installs prisma-cli prisma Prisma ORM 7 CLI reference for AI agents. Guides client generation, schema migrations, and local database workflows while preventing accidental data loss. Claude Code CX Codex Cursor +1 386,800installs prisma-postgres prisma A deprecated compatibility name for prisma-postgres-setup. Use it only when explicitly invoked; new projects should select prisma-postgres-setup instead. Claude Code CX Codex Cursor +1 380,400installs prisma-driver-adapter-implementation prisma Reference guide for implementing SQL adapters in Prisma ORM 7. Required for transaction handling, savepoint support, value mapping, and database error preservation. Claude Code CX Codex Cursor +1 375,000installs xlsx official anthropics Creates, reads, edits, and converts spreadsheet files. Use it when the requested deliverable is an Excel workbook or another tabular file. Claude Code Claude.ai 187,223installs google-agents-cli-observability official Google This skill guides you through tracing and monitoring AI agents, including ADK agents. Use it when you need to inspect agent execution or monitor a deployed agent. Claude Code CX Codex Cursor +1 509,900installs caveman-evidence-review JuliusBrussee A read-only skill reviews Caveman Cloud evidence on LLM spend, traces, and routing. Use it to see where a project’s model budget goes. Claude Code CX Codex Cursor +1 103,500installs migration JuliusBrussee Enforces reversible, compatibility-safe transitions for schema, data, and API updates. Useful whenever data loss or rollout downtime is unacceptable. Claude Code CX Codex Cursor +1 102,900installs

Questions about similarity-search-patterns

How do I install similarity-search-patterns in Claude Code?

Run npx skills add wshobson/agents --skill similarity-search-patterns -a claude-code. The skill file is placed at ~/.claude/skills/similarity-search-patterns/SKILL.md.

What does similarity-search-patterns do?

It provides patterns for similarity search with vector databases. The skill covers distance metrics, index selection, search tuning, hybrid retrieval, and recall checks.

Which platforms support similarity-search-patterns?

The skill is available for Claude Code, Codex, and Cursor. Each platform has its own install command and skill-file path.

Source text

SKILL.md · MIT
---
name: similarity-search-patterns
description: Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.
---

# 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

© Seth Hobson · MIT · wshobson/agents

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor