.cursor/skills/supabase-skill/SKILL.md
Connects to Supabase-hosted PostgreSQL and pgvector vector databases. Use when storing or querying vector embeddings, building RAG pipelines with Supabase, using vecs for similarity search, or when the user mentions Supabase, pgvector, or vector databases.
npx skillsauth add chicagopeabodydev-sudo/library_bot_poc supabase-skillInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when data needs to be stored, retrieved, or managed in a Supabase-hosted database—including pgvector for vector similarity search and embeddings.
For general PostgreSQL operations (tables, auth, storage):
import os
from supabase import create_client, Client
url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)
When using OpenAI embeddings with vecs adapters, store the API key as an environment variable:
import os
os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
For vector stores, use the vecs client with a direct PostgreSQL connection URL:
pip install vecsimport vecs
DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"
vx = vecs.create_client(DB_CONNECTION)
Get your connection string from Supabase: Project Settings → Database → Connection string (URI).
Collections are groups of vector records. Records can be added or updated via upsert. Index collections for better query performance.
Vector record format:
Record (id: String, vec: Numeric[], metadata: JSON)
Underlying PostgreSQL table:
CREATE TABLE <collection_name> (
id TEXT PRIMARY KEY,
vec vector(<dimension>),
metadata jsonb
);
Indexes speed up similarity search. Only one index per collection. Create after upserting records (IVFFlat requires populated data; HNSW can be created on empty collections).
Distance measures: vecs.IndexMeasure.cosine_distance (default), l2_distance, l1_distance, max_inner_product
Index methods: vecs.IndexMethod.auto, vecs.IndexMethod.hnsw, vecs.IndexMethod.ivfflat
from vecs import IndexMethod, IndexMeasure, IndexArgsHNSW
docs = vx.get_or_create_collection(name="docs", dimension=384)
docs.create_index(
method=IndexMethod.hnsw,
measure=IndexMeasure.cosine_distance,
index_arguments=IndexArgsHNSW(m=8),
)
Metadata (key-value pairs on records) can filter queries, similar to SQL WHERE clauses.
Example: {"year": {"$eq": 2020}}
| Operator | Description |
|------------|---------------------------------------------------------------------|
| $eq | Matches values equal to a specified value |
| $ne | Matches values not equal to a specified value |
| $gt | Matches values greater than a specified value |
| $gte | Matches values greater than or equal to a specified value |
| $lt | Matches values less than a specified value |
| $lte | Matches values less than or equal to a specified value |
| $in | Matches values contained in a scalar list |
| $contains| Matches when a scalar is contained within an array metadata field |
development
Builds simple user interfaces in Python. Use when creating chatbots, dashboards, or data apps with Streamlit—especially chat UIs with st.chat_message and st.chat_input, or when the user mentions Streamlit.
data-ai
Defines structured data models with Pydantic BaseModel. Use when defining LLM outputs or inputs for RAG, LlamaIndex structured outputs, or when the user mentions Pydantic, structured output, or response schemas.
tools
NeMo Guardrails is an open-source Python package for adding programmable guardrails around LLM calls. Use it to block unsafe, malicious, off-topic, or policy-violating user inputs, retrieved RAG content, tool usage, and model responses.
data-ai
Used to supplement the data LLMs can use when answering questions by supplying them with custom data generated and managed by llama-index.