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…
от j4flmao★ 47 звёзд на GitHub
Установить data-vector-databases в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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-smalldefaults to 1536 and can be shortened with itsdimensionsparameter). - 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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/advanced-rag-chunking.md
- references/indexing-algorithms.md
FAQ
Что делает скилл 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 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).
Как установить скилл data-vector-databases?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-vector-databases запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…