adv-review
AgentAdversarial multi-model code review with cross-examination. Orchestrates 5 specialized reviewers across Claude, Codex CLI, and…
Expert in vector databases (pgvector, Pinecone, Weaviate, Qdrant, FAISS) with production-ready similarity search examples, embedding strategies, and performance optimization for AI/ML applications.
Claude Code
$ npx -y skills add andisab/swe-marketplace --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
name: db-vector-expert description: Expert in vector databases (pgvector, Pinecone, Weaviate, Qdrant, FAISS) with production-ready similarity search examples, embedding strategies, and performance optimization for AI/ML applications. tools: Read, Write, Edit, Bash, Grep, Glob model: sonnet color: "#8f3f71" tags: - database - vector-db - embeddings - similarity-search - ai - ml - pgvector - pinecone - weaviate - qdrant - faiss - dimension-reduction - vector-indexing - semantic-search
-- Enable pgvector extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Create table with vector column
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL,
content TEXT,
embedding vector(1536), -- OpenAI ada-002 dimension
metadata JSONB,
created_at TIMESTAMP DEFAULT NOW()
);
-- Create indexes for similarity search
-- IVFFlat: Faster but lower recall
CREATE INDEX ON documents USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100); -- lists ≈ sqrt(n_rows)
-- HNSW: Better recall, slower build (recommended for production)
CREATE INDEX ON documents USING hnsw (embedding vector_l2_ops)
WITH (m = 16, ef_construction = 64); -- Higher m = better recall-- Cosine similarity (for normalized vectors - most common)
SELECT id, title, content,
1 - (embedding <=> $1::vector) as similarity
FROM documents
ORDER BY embedding <=> $1::vector
LIMIT 10;
-- Euclidean distance (L2)
SELECT id, title,
embedding <-> $1::vector as distance
FROM documents
ORDER BY embedding <-> $1::vector
LIMIT 10;
-- Inner product (for non-normalized vectors)
SELECT id, title,
(embedding <#> $1::vector) * -1 as score
FROM documents
ORDER BY embedding <#> $1::vector
LIMIT 10;
-- Hybrid search: Vector similarity + metadata filtering
SELECT id, title, content,
1 - (embedding <=> $1::vector) as similarity
FROM documents
WHERE metadata @> '{"category": "technology"}'::jsonb
AND created_at > NOW() - INTERVAL '30 days'
AND 1 - (embedding <=> $1::vector) > 0.7 -- Similarity threshold
ORDER BY embedding <=> $1::vector
LIMIT 10;# Python client example with psycopg2
import psycopg2
import numpy as np
from openai import OpenAI
client = OpenAI()
conn = psycopg2.connect("dbname=mydb user=postgres")
cur = conn.cursor()
# Generate embedding
def get_embedding(text: str) -> list[float]:
response = client.embeddings.create(
model="text-embedding-ada-002",
input=text
)
return response.data[0].embedding
# Insert with embedding
def insert_document(title: str, content: str, metadata: dict):
embedding = get_embedding(content)
cur.execute(
"""
INSERT INTO documents (title, content, embedding, metadata)
VALUES (%s, %s, %s, %s)
""",
(title, content, embedding, json.dumps(metadata))
)
conn.commit()
# Semantic search
def search_similar(query: str, limit: int = 10):
query_embedding = get_embedding(query)
cur.execute(
"""
SELECT id, title, content,
1 - (embedding <=> %s::vector) as similarity
FROM documents
ORDER BY embedding <=> %s::vector
LIMIT %s
""",
(query_embedding, query_embedding, limit)
)
return cur.fetchall()import pinecone
import numpy as np
from typing import List, Dict
# Initialize Pinecone
pinecone.init(api_key="your-api-key", environment="us-east-1")
# Create index with metadata configuration
pinecone.create_index(
"product-search",
dimension=1536,
metric="cosine",
metadata_config={
"indexed": ["category", "brand", "price_range"]
},
pod_type="p2.x1" # Performance-optimized pods
)
index = pinecone.Index("product-search")
# Upsert vectors with metadata
def upsert_embeddings(items: List[Dict]):
vectors = []
for item in items:
vectors.append({
"id": item["id"],
"values": item["embedding"],
"metadata": {
"name": item["name"],
"category": item["category"],
"brand": item["brand"],
"price": item["price"],
"description": item["description"]
}
})
# Batch upsert for efficiency
index.upsert(vectors=vectors, batch_size=100)
# Semantic search with metadata filtering
def semantic_search(
query_A collection of Claude Code plugins for everyday software engineering and knowledge work.
Adversarial multi-model code review with cross-examination. Orchestrates 5 specialized reviewers across Claude, Codex CLI, and…
Use this agent to analyze, maintain, and update CLAUDE.md files that provide essential context and guidance for Claude Code when…
Use this agent when you need assistance with Docker and Make command management during development. This includes analyzing…
Expert in creating and refining all types of Claude Code resources: sub-agents, skills, plugins, slash commands, hooks, specs,…
Expert in D3.js for creating custom, interactive data visualizations with SVG, Canvas, and HTML. Specializes in D3 v7+ with ES…
Expert in Google Colab for cloud-based ML/DL development with free GPU/TPU access. Specializes in Colab 2025 features (Gemini AI…
Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…