Command Palette

Search for a command to run...

Back to skills
skill № 38752

data-vector-databases

Use when the user asks to pick an index type for vector similarity search, pgvector, Qdrant, Milvus, Pinecone, Weaviate, HNSW vs IVF vs PQ, metadata filtering…

FreeNo executable scripts
j4flmaoby j4flmao★ 47 GitHub stars

Install data-vector-databases in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Vector Databases

Purpose

Store embedding vectors with metadata and return the nearest neighbors of a query vector fast enough for interactive use. Exact search compares the query with every vector (O(N·d)); approximate nearest neighbor (ANN) indexes trade a measurable amount of recall for large speedups. The work is choosing the store, the index and its parameters, and proving recall on your own data.

Agent Protocol

Trigger

"vector database", "vector db", "pgvector", "qdrant", "milvus", "pinecone", "weaviate", "hnsw", "ivfflat", "ivf-pq", "ann", "similarity search", "store embeddings", "hybrid search", "recall@k".

Input Context

  • Number of vectors now and in 12 months, dimensions, embedding model, update rate.
  • Query latency SLO and QPS, filter requirements (tenant, ACL, dates), existing database.
  • Accuracy target (recall@k vs exact search).

Output Artifact

Store choice + schema + index parameters + evaluation plan. No file unless requested.

Response Format

Scale: {N vectors} x {d dims} {dtype} ≈ {GB raw}
Store: {pgvector|Qdrant|Milvus|managed...} because {reason}
Index: {HNSW m/ef_construction/ef_search | IVF nlist/nprobe | +PQ/quantization}
Filtering: {pre/in-index/post}
Eval: recall@{k} vs exact on {n} queries, p95 latency

Completion Criteria

  • Distance metric matches how the embedding model was trained (cosine / dot / L2).
  • Recall@k measured against exact (brute-force) results on a sample of real queries.
  • Filters applied inside the query, with a check that filtered queries still return k results.
  • Re-embedding plan when the model changes (never mix models in one index).

Embeddings Basics

  • Embedding models map text/images to fixed-length float vectors; similar meaning → nearby vectors. Dimensions depend on the model (e.g. OpenAI text-embedding-3-small defaults to 1536 and can be shortened with its dimensions parameter).
  • Normalize vectors to unit length to make cosine similarity equal to dot product (faster in most engines).
  • Memory: N x d x 4 bytes for float32. 10M x 1536 ≈ 61 GB raw, before index overhead.

Why Approximate Search

  • Exact k-NN is perfectly feasible for small collections (up to roughly a few hundred thousand vectors on CPU, more on GPU, e.g. FAISS flat index) and is the ground truth for evaluation.
  • For random high-dimensional data, distances concentrate (nearest and farthest neighbors become similar), which defeats space-partitioning trees such as k-d trees. Real embeddings have lower intrinsic dimension, which is why graph and clustering indexes work well on them.

Index Types

Index How Tune Trade-offs
Flat (exact) Scan all vectors none Perfect recall; linear cost
HNSW Multi-layer proximity graph; greedy search from top layer M (links/node), ef_construction, ef_search High recall at low latency; high memory; slow builds; deletes leave tombstones
IVF (ivfflat) k-means clusters; search nprobe nearest clusters nlist (~√N to 4√N), nprobe Less memory, fast build; needs training data; recall drops at cluster boundaries
PQ / IVF-PQ Compress vectors into sub-vector codes m sub-quantizers, bits 10-60x smaller; lower recall, rerank with full vectors
Scalar / binary quantization int8 or 1-bit per dimension rescoring factor Large memory savings; rescore top candidates with original vectors
DiskANN-style Graph on SSD, compressed vectors in RAM beam width Billion-scale on one node; SSD latency

Choosing a Store

Situation Choice
Already on PostgreSQL, < tens of millions of vectors, need joins/transactions pgvector
Dedicated, high QPS, rich payload filtering, self-hosted Qdrant, Milvus, Weaviate
No ops team, pay per usage Managed (Pinecone, cloud-hosted variants of the above)
Search engine already in place with keyword search OpenSearch / Elasticsearch k-NN
Offline/batch similarity, research FAISS library (not a database)

pgvector Example

CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE documents (
    id         BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    tenant_id  BIGINT NOT NULL,
    content    TEXT NOT NULL,
    embedding  vector(1536) NOT NULL
);

-- HNSW with cosine distance; build after bulk load for speed
CREATE INDEX documents_embedding_hnsw ON documents
    USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);
CREATE INDEX documents_tenant ON documents (tenant_id);

-- query: <=> cosine distance, <-> L2 distance, <#> negative inner product
SET hnsw.ef_search = 100;               -- higher = better recall, slower
SELECT id, content, embedding <=> $1 AS distance
FROM documents
WHERE tenant_id = $2
ORDER BY embedding <=> $1
LIMIT 10;

Filtered HNSW queries can return fewer than LIMIT rows when the filter is selective, because the index returns ef_search candidates before filterin

Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/advanced-rag-chunking.md
  • references/indexing-algorithms.md

FAQ

What does the data-vector-databases skill do?

Use when the user asks to pick an index type for vector similarity search, pgvector, Qdrant, Milvus, Pinecone, Weaviate, HNSW vs IVF vs PQ, metadata filtering or storing embeddings. Produces vector store choice, collection schema and ANN index settings for recall, latency and memory. Not for full RAG pipeline design (use llm-rag-retrieval-internals).

How do I install the data-vector-databases skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the data-vector-databases skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare data-vector-databases with