
pgvector
pgvector Postgres extension. Covers vector types, distance operators, indexing (HNSW/IVFFlat), and client library usage. Use when storing vectors in PostgreSQL, running nearest-neighbor searches, or configuring HNSW/IVFFlat indexes. Keywords: pgvector, PostgreSQL, vector search, HNSW, IVFFlat.
- Installs
- 43
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/itechmeat/llm-code --skill pgvector- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads pgvector automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
pgvector
PostgreSQL extension for storing vectors and running exact/approximate nearest-neighbor search in SQL.
Quick Navigation
- Installation:
references/installation.md - Core concepts and SQL recipes:
references/core.md - Indexing (HNSW / IVFFlat) and tuning:
references/indexing.md - Filtering, iterative scans, and performance:
references/performance-and-filtering.md - Types and functions reference (vector/halfvec/bit/sparsevec):
references/types-and-functions.md - Troubleshooting:
references/troubleshooting.md - Client libraries (priority):
- Python:
references/python.md - Go:
references/go.md - Node (JS/TS):
references/node.md - Java:
references/java.md - Swift:
references/swift.md
- Python:
When to Use
- You need vector similarity search inside Postgres (keep vectors with relational data).
- You want SQL-native ANN indexes (HNSW or IVFFlat) with tunable recall/speed.
- You want consistent patterns to store/query embeddings across multiple application languages.
Quick Start (already installed)
Prerequisite: pgvector is installed on the Postgres server. See: references/installation.md.
Enable per database and run a first query:
CREATE EXTENSION vector;
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
Choosing distance operators
- L2 (Euclidean): use
<-> - Inner product: use
<#>(note: returns negative inner product) - Cosine distance: use
<=> - L1: use
<+> - Binary vectors: Hamming
<~>/ Jaccard<%>
Indexing rules of thumb
- Exact search: no pgvector index; may use parallel scan on large tables.
- ANN search:
- Prefer HNSW for better speed/recall, higher build time/memory.
- Use IVFFlat when you need faster builds/lower memory.
- Create one index per distance function/operator class you plan to use.
Critical Prohibitions / Gotchas
- Approximate indexes can change results (recall vs speed).
- Index usage typically requires
ORDER BY <distance-op> ... LIMIT .... <#>returns negative inner product; multiply by-1to get the actual value.NULLvectors are not indexed; for cosine distance, zero vectors are not indexed.
Links
- Docs / repo: https://github.com/pgvector/pgvector
- Client libs:
- Releases/tags: https://github.com/pgvector/pgvector/tags
FAQ
What does the pgvector skill do?
pgvector Postgres extension. Covers vector types, distance operators, indexing (HNSW/IVFFlat), and client library usage. Use when storing vectors in PostgreSQL, running nearest-neighbor searches, or configuring HNSW/IVFFlat indexes. Keywords: pgvector, PostgreSQL, vector search, HNSW, IVFFlat.
How do I install pgvector?
Run npx skills add https://github.com/itechmeat/llm-code --skill pgvector in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/pgvector/ (personal) or .claude/skills/pgvector/ (project).
Which AI agents can use pgvector?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is pgvector safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains pgvector?
It is published by itechmeat in itechmeat/llm-code. It has 43 recorded installs.
More from itechmeat/llm-code
react-testing-library
itechmeat/llm-code
React Testing Library: user-centric component testing with queries, user-event simulation, async utilities, and accessibility-first API. Use when writing React component tests, selecting elements by role/label/text, simulating user events, or testing async UI behavior. Keywords: React Testing Library, @testing-library/react, user-event, queries, render.
openspec
itechmeat/llm-code
OpenSpec artifact-driven workflow. Covers OPSX commands, schemas, project config. Use when applying the artifact-driven workflow (OPSX), planning or reviewing changes based on artifact dependencies, or working with OPSX commands and schema/template resolution. Keywords: OPSX, artifact graph, /opsx:.
mantine-dev
itechmeat/llm-code
Open the skill to read its SKILL.md instructions.
social-writer
itechmeat/llm-code
Open the skill to read its SKILL.md instructions.
base-ui
itechmeat/llm-code
Open the skill to read its SKILL.md instructions.
refine-dev
itechmeat/llm-code
Open the skill to read its SKILL.md instructions.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.