Skip to content
Skill

Pgvector semantic search

Guides an agent through pgvector setup, HNSW indexing and tuning for semantic search

Pgvector semantic search is an open-source agent skill for databases. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
1.9K
Last commit
License
Apache-2.0
Listing updated

Similar skills

About Pgvector semantic search

This skill gives the agent a PostgreSQL-focused playbook for storing embeddings and running nearest neighbor queries with the pgvector extension. It sets a default configuration that uses halfvec columns, cosine distance and HNSW indexes, then explains how to adjust index build parameters and query-time recall settings for a given workload.

The guidance also covers harder cases: binary quantization with a re-ranking step for very large datasets, filtered search using iterative scans, partial indexes or partitioning, bulk loading order, and vacuum and reindex maintenance. A troubleshooting table maps common symptoms such as missing index use, sparse filtered results and high latency to likely fixes, and the skill includes SQL for checking index size and comparing approximate against exact results.

The skill assumes PostgreSQL 15 or later with pgvector 0.8.0 or newer. It leaves embedding model choice and text chunking out of scope, so the agent will not pick a model or split documents for you.

When your agent uses it

Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. **Trigger when user asks to:** - Store or search vector embeddings in PostgreSQL - Set up semantic search, similarity search, or nearest neighbor search - Create HNSW or IVFFlat indexes for vectors - Implement RAG (Retrieval Augmented Generation) with PostgreSQL - Optimize pgvector performance, recall, or memory usage - Use binary quantization for large vector datasets **Keywords:** pgvector, embeddings, semantic search, vector similarity, HNSW, IVFFlat, halfvec, cosine distance, nearest neighbor, RAG, LLM, AI search Covers: halfvec storage, HNSW index configuration (m, ef_construction, ef_search), quantization strategies, filtered search, bulk loading, and performance tuning.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (15 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the pg plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add timescale/pg-aiguide
/plugin install pg@aiguide

Or copy only this skill to ~/.claude/skills/pgvector-semantic-search:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/pgvector-semantic-search &&
cp -R "$tmp/skills/pgvector-semantic-search" ~/.claude/skills/pgvector-semantic-search &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/pgvector-semantic-search inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/pgvector-semantic-search to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/pgvector-semantic-search &&
cp -R "$tmp/skills/pgvector-semantic-search" ~/.agents/skills/pgvector-semantic-search &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/pgvector-semantic-search inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/pgvector-semantic-search to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/pgvector-semantic-search &&
cp -R "$tmp/skills/pgvector-semantic-search" ~/.cursor/skills/pgvector-semantic-search &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/pgvector-semantic-search inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/timescale/pg-aiguide.git --path skills/pgvector-semantic-search

Or copy the folder to ~/.gemini/skills/pgvector-semantic-search yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/pgvector-semantic-search:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/pgvector-semantic-search &&
cp -R "$tmp/skills/pgvector-semantic-search" ~/.copilot/skills/pgvector-semantic-search &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/pgvector-semantic-search inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/timescale/pg-aiguide.git

Then copy pg-aiguide/skills/pgvector-semantic-search into your agent's skills folder as pgvector-semantic-search. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Default HNSW configuration
Recommends halfvec storage, cosine distance and HNSW indexes with starting parameters for typical text embedding workloads.
Index parameter tuning
Explains m, ef_construction and ef_search trade-offs between recall, memory and query speed.
Binary quantization with re-ranking
Provides a two-stage query pattern using bit vectors for candidate retrieval and halfvec distance for final ordering.
Filtered search strategies
Covers iterative scans, B-tree prefiltering, partial indexes and partitioning for queries with WHERE clauses.
Bulk loading and maintenance
Describes building indexes after COPY loads, concurrent index creation, VACUUM and REINDEX practices.
Troubleshooting reference
Maps symptoms like unused indexes, sparse results and high latency to likely causes and fixes.

Good for

  • Set up a PostgreSQL table to store and search text embeddings
  • Create an HNSW index tuned for my dataset size
  • Add filtered vector search to an existing pgvector table
  • Diagnose why my pgvector queries are slow or returning few results
  • Reduce memory use for a large embedding table with binary quantization

Pgvector semantic search FAQ

What does the skill require in the database?

It requires PostgreSQL 15 or later with the pgvector extension, and its features rely on pgvector 0.8.0 or newer.

Does Pgvector semantic search choose an embedding model or split text into chunks?

No. The guide states that embedding model selection and text chunking are outside its scope.

Which index type does Pgvector semantic search recommend by default?

It recommends HNSW for most workloads and only suggests IVFFlat for write-heavy or memory-constrained cases.

Does Pgvector semantic search include scripts?

No scripts are included; the skill consists of a single SKILL.md file with guidance and SQL examples.

How do I install Pgvector semantic search in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/pgvector-semantic-search to use it in all your projects, or to .claude/skills/pgvector-semantic-search in one project. Or install the pg plugin, which includes it: /plugin marketplace add timescale/pg-aiguide, then /plugin install pg@aiguide.

Does Pgvector semantic search run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Pgvector semantic search?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Pgvector semantic search?

The closest alternatives to Pgvector semantic search are Postgres hybrid text search, Postgres, PostgreSQL optimization, Qdrant hybrid search and Qdrant search quality diagnosis.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from timescale/pg-aiguide

  1. Guides an agent in designing PostGIS spatial tables, types, SRIDs and indexes

    • Open source
    • 1.9K GitHub stars
    • Databases
  2. Guides an agent through PostgreSQL table design, types, constraints and indexing

    • Open source
    • 1.9K GitHub stars
    • Databases
  3. Scores existing PostgreSQL tables to find which should become TimescaleDB hypertables

    • Open source
    • 1.9K GitHub stars
    • Databases
  4. Guides an agent through PostgreSQL schema design, indexing, search, TimescaleDB

    • Open source
    • 1.9K GitHub stars
    • Databases
  5. Guides an agent through planning, testing and running PostgreSQL schema migrations safely

    • Open source
    • 1.9K GitHub stars
    • Databases