polygres-retrieval-design

polygres-retrieval-design is a skill for Claude Code, Codex from Evokoa/polygres-skills. It costs 95 tokens per session (930 once invoked), scanned A, original, Apache-2.0.

A planning guide for choosing how an application searches PostgreSQL data, including relational, graph, text, combined, and AI-supported approaches.

In plain words
What is it for?
Use it to plan and review database search, embedding or graph inputs, grounded RAG (answers based on retrieved data), and migrations from existing vector search.
Why use it?
It helps you choose a retrieval method from the available data and requirements before configuring search or writing application code.

Skill for Claude CodeCodex

Part of the polygres plugin — 5 skills shipped together

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.

agentmods
npx agentmods add skills/evokoa/polygres-skills/polygres-retrieval-design
Any agent
npx skills add Evokoa/polygres-skills --skill polygres-retrieval-design
Clone the repo
git clone --depth 1 https://github.com/Evokoa/polygres-skills

Made for: Claude Code, Codex.

Or install polygres, the plugin that ships this one along with the rest of its 5 skills.

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 polygres-retrieval-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/evokoa/polygres-skills/polygres-retrieval-design.svg)](https://agentmods.dev/skills/evokoa/polygres-skills/polygres-retrieval-design)
Your own site
<a href="https://agentmods.dev/skills/evokoa/polygres-skills/polygres-retrieval-design"><img src="https://agentmods.dev/badge/skills/evokoa/polygres-skills/polygres-retrieval-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 930 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00095 $0.00930
Opus 5 $0.00048 $0.00465
Sonnet 5 $0.00019 $0.00186
Haiku 4.5 $0.00010 $0.00093

Measured 4d ago against content hash fe08fba9c40e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

polygres-retrieval-design 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 4d 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.

plugins/polygres/skills/polygres-retrieval-design/SKILL.md · 82 lines

How it starts

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

Polygres Retrieval Design

Produce a reviewable plan before retrieval configuration or application work. This skill is advisory: it must not mutate a project directly.

Workflow

  1. Extract the user outcome, authorization, latency, freshness, and expected result shape from the prompt and inspected application. Ask only for a missing fact that changes the recommendation; representative questions are useful evidence, not a mandatory interview.
  2. Resolve project mode, then inspect the supplied schema, verified row identifiers, sample data, and existing retrieval configuration. Label missing evidence as unresolved; never infer production facts from a table or column name.
  3. Select the smallest sufficient strategy using references/strategy-selection.md. Reject an unsupported strategy rather than inventing a capability.
  4. For graph retrieval, apply references/graph-modeling.md. For an existing vector configuration, TSVector, or fuzzy retrieval, apply references/vector-and-text-design.md.
  5. For pgContext collections, point synchronization, registered filters, or Context retrieval modes, apply references/context-design.md.
  6. For multi-stage retrieval or RAG, apply references/hybrid-and-rag-plan.md.
  7. Write the result with references/plan-template.md. When called by $polygres-data-pipeline, return the selected and omitted components plus exact public-interface handoffs in a machine-readable section so the caller can continue without another interview.
  8. In a design-only request, stop before mutation. In an active data-pipeline setup, return control to the orchestrating skill; its consolidated review and approval govern the implementation.

Design rules

  • Prefer relational retrieval for exact predicates, joins, aggregates, and transactions that do not need a retrieval index.
  • For a synced project, keep exact SQL, transactions, and source mutations in the source PostgreSQL database. Use only the supported Runtime retrieval and retrieval-configuration surfaces on Polygres.
  • Treat graph, vector, text, and Context indexes and point mappings as derived project resources whose readiness and refresh behavior must be validated.
  • Use exact schema identifiers and stable row ID values from verified data. Do not use invented row IDs or fuzzy-match schema names.
  • Bound graph direction, depth, fan-out, result count, and cycle behavior.
  • Record the embedding model, dimensions, metric, input construction, and response to a dimension mismatch or empty embedding.
  • Default new semantic retrieval plans to a Polygres AI Context collection. Decide explicitly whether distinct embeddings belong as named vectors in one collection or require separate collection-level source and policy settings. Record any existing pgvector configuration that must remain compatible or needs a migration plan. Never treat those resources as interchangeable. On a synced project, use only an existing synchronized source table and embedding column; do not plan add_column or new_table on the target.
  • State TSVector language/configuration choices and fuzzy thresholds.
  • For hybrid retrieval, define stage order, provenance, deduplication, authorization, and token budget.
  • Include rebuild or reindex triggers, readiness checks, and rollback or fallback behavior.

Read the full file on GitHub · 82 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 82 lines · 95 tokens per session scan A fe08fba9c40e

Subscribe to this mod's changes

polygres-retrieval-design is a skill published in the GitHub repository Evokoa/polygres-skills (10 stars, last pushed 15d ago), licensed Apache-2.0. It adds 95 tokens to every session and 930 once invoked, about $0.0005 per session on Opus 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-31.

Related

Other skills, from other repositories

safe-sql-execution

Use whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix and never says "security," "injection," or "SafeSqlFragment." This covers: writing or editing any pg-meta function, query builder, or endpoint…

supabase/supabase · 221 tokens

studio-e2e-tests

Write and run Playwright E2E tests for Supabase Studio (e2e/studio). Use when asked to run e2e tests, write new E2E tests, or debug flaky or failing Playwright tests. Covers running commands, avoiding race conditions, waiting strategies, selectors, helper functions, and CI vs local differences.

supabase/supabase · 74 tokens

studio-queries

React Query conventions for data fetching in Supabase Studio. Use when writing or reviewing query hooks, mutation hooks, or query keys in apps/studio/data/ — including adding the first fetch or mutation for a new API endpoint or resource. Covers queryOptions pattern, keys.ts structure, mutation hook template, and…

supabase/supabase · 68 tokens

write-the-docs

Draft new or updated Supabase docs content for a feature or launch, grounded in product intent (Linear when available), a read of the actual code, and the docs style guide once one exists. Use when asked to write docs for a new feature, a product launch, or a Linear ticket that needs net-new content rather than a bug…

supabase/supabase · 104 tokens

sql-database-support

Guides classifying, gap-analyzing, and scaffolding support for a new SQL database in pREST (wire-compatible variants like TimescaleDB or new dialects). Use when adding database support, creating integration/ /, DIFFERENCES.md, adapters/ , per-DB docker-compose or GitHub workflows, or planning where config/app wiring…

prest/prest · 79 tokens

upgrading-chart

Upgrades Helm chart dependencies (PostgreSQL, Vault) in the Chainloop project, including vendorized charts, container images, and CI/CD workflows. Use when the user mentions upgrading Helm charts, Bitnami dependencies, PostgreSQL chart, or Vault chart. CRITICAL - Major version upgrades are FORBIDDEN and must be…

chainloop-dev/chainloop · 73 tokens