pgvector-postgres
Design, review, migrate, measure, or debug PostgreSQL vector retrieval with pgvector.
Skill by Tom-R-Main
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tom-r-main-pgvector-postgres
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, backend, ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/pgvector-postgres
What's inside
- Skill name
pgvector-postgres- Description
- Design, review, migrate, measure, or debug PostgreSQL vector retrieval with pgvector. Use for vector, halfvec, bit, or sparsevec columns; exact nearest-neighbor queries; HNSW or IVFFlat indexes; cosine, L2, inner-product, L1, Hamming, or Jaccard distance; filtered or multi-tenant ANN; hybrid full-text/vector search; embedding-model or dimension changes; recall/latency evaluation; EXPLAIN plans; index builds; planner statistics; vacuum and churn; or retrieval incidents. Prefer live schema, query, plan, and workload evidence over generic tuning advice.
- License
- MIT
- Instructions
- 133 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (14)
- SKILL.md
- openai.yaml · agents/
- measurement-operations.md · references/
- primary-sources.md · references/
- query-index-design.md · references/
- schema-retrieval-patterns.md · references/
- compare_recall.py · scripts/
- inspect_plan.py · scripts/
- approximate-results.json · tests/fixtures/
- exact-results.json · tests/fixtures/
- integration.sql · tests/fixtures/
- plan.json · tests/fixtures/
- test_compare_recall.py · tests/
- test_inspect_plan.py · tests/
SKILL.md (first lines)
# Pgvector Postgres Treat vector retrieval as a measurable PostgreSQL workload, not as an index-selection exercise. Establish correctness and an exact baseline first; add approximation only when the workload demonstrates a need. Resolve bundled paths from this `SKILL.md`. Read `references/primary-sources.md` before making version-specific claims. The public skill is grounded only in PostgreSQL documentation and pgvector's official documentation and source. ## Establish the contract Freeze these inputs before proposing schema or index changes: - PostgreSQL and pgvector versions; - embedding model, version, dimensions, normalization, and distance metric; - authoritative row identity and tenant/security boundary; - update, delete, and re-embedding rates; - query shape, filters, requested `k`, and minimum acceptable result count; - latency target and concurrency; - recall target and exact comparison set; - migration, lock, disk, memory, and rollback constraints. If the metric or embedding lineage is unknown, stop before choosing an opclass. If production access is unavailable, label conclusions as design guidance rather than observed behavior. ## Inspect before changing Collect the extension version, vector columns, index definitions, table/index sizes, row estimates, statistics freshness, representative parameterized SQL, and plans. ```sql select extversion from pg_extension where extname = 'vector'; select schemaname, tablename, indexname, indexdef from pg_indexes where indexdef ilike '% using hnsw %' or indexdef ilike '% using ivfflat %'; explain (analyze, buffers, verbose, settings, format json) select id from items where tenant_id = $2 order by embedding <=> $1::vector limit 20; ``` `EXPLAIN ANALYZE` executes the query. Use a read-only transaction or a safe replica for queries with side effects. Summarize JSON plans with `scripts/inspect_plan.py`; never infer health from index existence alone. ## Separate four questions 1. **Correctness:** Are model, dimensions, metric, opclass, casts, filters, RLS, and ordering aligned? 2. **Eligibility:** Does the SQL expose an ascending distance operator directly in `ORDER BY` with `LIMIT`? 3. **Quality:** What is recall@k, result-count shortfall, and ranking stability against exact search? 4. **Cost:** What do latency distributions, buffers, plan estimates, index size, build time, and write/vacuum behavior show? A fast query with poor recall is not healthy. A sequential scan on a small or highly selective relation is not automatically unhealthy. ## Choose the smallest justified path - Start with exact ordered search when the candidate set is bounded or the latency target is already met. - Prefer HNSW when measured speed/recall is the priority and build time, memory, and write cost are acceptable. - Prefer IVFFlat only with representative training data and an explicit lists/probes evaluation. - Keep the distance operator and index opclass aligned. - For filtered ANN, measure result shortfall and recall before changing search breadth. Read `references/query-index-design.md` for iterative scans, partial indexes, and partitioning. - Do not propose a composite tenant/vector ANN index: pgvector's HNSW and IVFFlat access methods are single-column. Scope the search with an ordinary filter index, a partial ANN index, partitioning, or a separate table when evidence supports it. ## Measure exact versus approximate Run the same frozen query set against: - an exact baseline with approximate index scans disabled in a transaction; and - the candidate ANN configuration with identical filters and `k`. Record returned IDs and compare them with: ```bash python3 scripts/compare_recall.py \ --exact exact-results.json \ --approx approximate-results.json \ --k 20 ``` Measure recall across representative tenants, filter selectivities, data ages, and query classes. Report distributions and worst cases, not only a global mean. Read `references/measurement-operations.md` before tuning `hnsw.ef_search`, `ivfflat.probes`, list counts, or planner switches. ## Keep session state bounded Use transaction-local settings with pooled connections: ```sql begin; set local hnsw.ef_search = 100; select ... order by embedding <=> $1::vector limit 20; commit; ``` Do not use planner-disable settings as permanent tuning. They are diagnostic controls for comparing paths. ## Design migrations around retrieval identity Treat embedding model, dimensions, normalization, and metric as a versioned contract. For an incompatible model or dimension change: 1. add a new column or table; 2. backfill with observable progress and failure accounting; 3. validate coverage and exact-query correctness; 4. build the matching index; 5. compare recall and latency; 6. switch reads explicitly; 7. retain a rollback window; 8. remove the old representation only after verification. Run `CREATE INDEX CONCURRENTLY` outside transaction blocks. Inspect invalid indexes after interrupted builds. Read `references/schema-retrieval-patterns.md` for tenant, RLS, hybrid retrieval, and model-version patterns. ## Apply an evidence ladder Prefer changes in this order: 1. repair query, metric, cast, or opclass correctness; 2. refresh statistics and verify the real plan; 3. establish exact quality and latency; 4. tune query-local ANN breadth; 5. add or revise one index; 6. consider partial indexes or partitioning for stable, material filter boundaries; 7. consider precision reduction, quantization, or reranking; 8. change topology only after simpler interventions fail.
From Tom-R-Main/siftable-skills, MIT.
More from Tom-R-Main/siftable-skills
- 0.592score
filesystem-lifecycle
Tom-R-Main
Audit, classify, reclaim, and prevent regrowth of local filesystem cruft and agent-workspace storage.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
footwork-tools
Tom-R-Main
Equip an agent with observation and action tools for browser UI, native Mac apps, terminals/services, and saved artifacts.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
paper-design
Tom-R-Main
Create, inspect, edit, import, export, and hand off product or visual designs through Paper and its MCP server.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
grok-guide
Tom-R-Main
Use Grok 4.5 as an explicit strategic control plane above Codex for plan, replan, and completion-audit lifecycles.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
plan
siftable
Produce a visual, grounded plan for an objective.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
go
Tom-R-Main
Implement, review, debug, test, migrate, and optimize Go.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
c-systems-programming
Tom-R-Main
Implement, debug, and review C systems software.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
css
Tom-R-Main
Implement, debug, and review CSS and Tailwind styling.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
opengl-c-graphics
Tom-R-Main
Build, debug, review, and optimize core-profile OpenGL in C.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
mermaid
siftable
Create Mermaid diagrams and render them through an available host renderer.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
cloud-environment-runtime
Tom-R-Main
Establish the selected cloud task's execution, network, and credential context before using cloud tools.
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
generating-design-references
Tom-R-Main
Generate and critique a design-reference image when no existing visual precedent fits.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 12, 2026 (16 days ago)
- Last release
- Aug 14, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Tom-R-Main/siftable-skills
- Website
- siftable.io
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Tom-R-Main
- 0.592score
footwork-tools
Tom-R-Main
Equip an agent with observation and action tools for browser UI, native Mac apps, terminals/services, and saved artifacts.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
paper-design
Tom-R-Main
Create, inspect, edit, import, export, and hand off product or visual designs through Paper and its MCP server.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
grok-guide
Tom-R-Main
Use Grok 4.5 as an explicit strategic control plane above Codex for plan, replan, and completion-audit lifecycles.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
filesystem-lifecycle
Tom-R-Main
Audit, classify, reclaim, and prevent regrowth of local filesystem cruft and agent-workspace storage.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
css
Tom-R-Main
Implement, debug, and review CSS and Tailwind styling.
SkillAFreshness: A★ 1Claude Code +9 - 0.589score
go
Tom-R-Main
Implement, review, debug, test, migrate, and optimize Go.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
pgvector-postgres skill. Agent Mart. https://agentmart.dev/skills/tom-r-main-pgvector-postgres (last updated 2026-10-24)