postgres-semantic-search

postgres-semantic-search is a skill for Claude Code from laguagu/claude-code-nextjs-skills. It costs 80 tokens per session (2,965 once invoked), scanned A, original, MIT.

A guide to building semantic and hybrid search inside PostgreSQL, the database system, using vector similarity and text search.

In plain words
What is it for?
Use it to implement vector, full-text, or hybrid search with pgvector and ParadeDB, including indexes, multilingual queries, reranking, and evaluations.
Why use it?
It helps search find results by meaning as well as exact words, including combined ranking from both approaches.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the nextjs-ai-skills plugin — 24 skills, 2 agents shipped together

Good fit Use it to implement vector, full-text, or hybrid search with pgvector and ParadeDB, including indexes, multilingual queries, reranking, and evaluations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laguagu/claude-code-nextjs-skills --skill postgres-semantic-search
Clone the repo
git clone --depth 1 https://github.com/laguagu/claude-code-nextjs-skills

Made for: Claude Code.

Or install nextjs-ai-skills, the plugin that ships this one along with the rest of its 24 skills, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for postgres-semantic-search

README.md
[![agentmods](https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search/github.svg)](https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search)
Your own site
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for postgres-semantic-search

Your own site · 80×15
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/postgres-semantic-search.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,965 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium MCP Rug Pull · line 58
    Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
    Fix: Pin the image: image:tag or image@sha256:abc123
  • medium MCP Rug Pull · line 64
    Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
    Fix: Pin the image: image:tag or image@sha256:abc123
  • medium MCP Rug Pull · line 70
    Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
    Fix: Pin the image: image:tag or image@sha256:abc123
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00080 $0.02965
Opus 5.5 $0.00032 $0.01186
Sonnet 5.5 $0.00016 $0.00593
Haiku 4.5 $0.00008 $0.00297

Measured 6d ago against content hash 185e7b2f6591, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

postgres-semantic-search scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/postgres-semantic-search/SKILL.md · 216 lines

How it starts

The opening of the file, as written. The whole thing — 216 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Decisions, measured findings and silent failure modes for search built on Postgres, plus tested SQL building blocks in scripts/. Syntax the official docs cover well is left to them; what is here goes wrong without an error.

Build order

  1. Look at what users actually type: identifiers and codes, one-to-three-word terms, full questions, which languages. That decides which arms you need.
  2. Start with the simplest retrieval suited to those queries: exact/keyword lookup or vector search. For approximate vector search, keep exact vector search as the recall baseline.
  3. Build two eval sets, long questions and short terms, before tuning (evaluation.md).
  4. Add another arm and fuse with RRF only where it improves the baseline on the queries that need it (hybrid-search.md).
  5. Add a reranker last, over the head of a good shortlist (reranking.md).

Change one thing at a time. Predefine the acceptance rule; by default require a gain beyond measured run-to-run spread on the affected query population, without a material loss on the other eval set. Inspect per-query wins/losses and require the agreed latency and cost budget to hold. The numerical findings below are corpus-specific observations, not universal performance guarantees.

Choosing

  • Column type by dimensions, not provider: vector(N) indexes up to 2,000; up to 4,000 index a halfvec cast (or use a halfvec column); above that, binary quantization or Matryoshka truncation.
  • HNSW by default, IVFFlat when memory or build time rules HNSW out. No row count decides it: measure recall and latency against exact search.
  • Models change every few months. Pick embedding and reranker models from the provider's current docs, prefer multilingual models for non-English text, and evaluate on the target language before committing.
  • Hybrid when users type both questions and terms. On a Finnish transcript corpus keyword alone was weak on long questions (24 % right first), vector alone on short terms (53 %); hybrid tied vector on long questions and led on short terms (53 % and 93 %; hybrid-search.md).
  • BM25 is not available everywhere: managed hosts differ (Neon removed pg_search). Plain FTS with the fixes below is often enough.

Read the full file on GitHub · 216 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago Changed · -3 lines 185e7b2f6591
  2. 13d ago Changed · -1 lines f69b9f35f20f
  3. 24d ago Changed · +31 lines · -99 tokens per session 9cac3a3e5814
  4. 27d ago Changed · -187 lines · -49 tokens per session d75e8404a2ca
  5. 28d ago Changed · -1 lines · -31 tokens per session f1efcd825fd9
  6. 1mo ago Changed · +2 lines · +31 tokens per session d5bc607ff762
  7. 1mo ago Changed · -34 lines 82f6fc33ed58
  8. 1mo ago Changed · -14 lines e7b630edc821
  9. 1mo ago First seen · 423 lines · 228 tokens per session scan A 8c74cf080aa1

Subscribe to this mod's changes

postgres-semantic-search is a skill published in the GitHub repository laguagu/claude-code-nextjs-skills (70 stars, last pushed 6d ago), licensed MIT. It adds 80 tokens to every session and 2,965 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pgvector-semantic-search

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…

timescale/pg-aiguide · 190 tokens

postgres-hybrid-text-search

Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF). Trigger when user asks to: Combine keyword and semantic search Implement hybrid search or multi-modal retrieval Use BM25/pgtextsearch with pgvector together Implement RRF (Reciprocal…

timescale/pg-aiguide · 162 tokens

vector-db-rag-expert

Expert guide for high-performance Vector Databases, Deep RAG architectures, pgvector 0.8+ HNSW, Reciprocal Rank Fusion (RRF), Cross-Encoder Re-ranking, and Late Chunking / Panduan ahli Vector DB, arsitektur Deep RAG, pgvector HNSW, RRF, dan Re-ranking.

roedyrustam/vibes-plug · 77 tokens

ai-vector-brain

Creates reusable vector-brain implementations: repo, docs, compliance. Use when building pgvector SQL, manifests, ingest scripts. Not for context design (dev-context-engineering).

vasilyu1983/AI-Agents-public · 40 tokens

pgvector

PostgreSQL extension for storing vectors and running exact/approximate nearest-neighbor search in SQL.

itechmeat/llm-code · 75 tokens

laravel-vector-search

Use when implementing semantic/vector search in Laravel 13 with PostgreSQL + pgvector.

fusengine/agents · 22 tokens