postgres

postgres is a skill for Claude Code, Codex from arbazkhan971/godmode. It costs 20 tokens per session (1,524 once invoked), scanned A, original, MIT.

A guide to advanced PostgreSQL features, database design, performance tuning, replication, partitioning, connection pooling, and extensions. PostgreSQL is a relational database that stores structured data in tables.

In plain words
What is it for?
Use it to design PostgreSQL schemas, write migrations, tune databases, configure replication or pooling, analyze statistics, and add features such as pgvector search.
Why use it?
It helps diagnose database performance and make informed choices about indexes, schemas, queries, maintenance, and scaling. It also explains features such as JSONB, full-text search, and vector search.

Skill for Claude CodeCodex

Part of the godmode plugin — 133 skills, 1 command, 9 agents, 3 MCP servers 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/arbazkhan971/godmode/postgres
Any agent
npx skills add arbazkhan971/godmode --skill postgres
Clone the repo
git clone --depth 1 https://github.com/arbazkhan971/godmode

Made for: Claude Code, Codex.

Or install godmode, the plugin that ships this one along with the rest of its 133 skills, 1 command, 9 agents, 3 MCP servers.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/arbazkhan971/godmode/postgres.svg)](https://agentmods.dev/skills/arbazkhan971/godmode/postgres)
Your own site
<a href="https://agentmods.dev/skills/arbazkhan971/godmode/postgres"><img src="https://agentmods.dev/badge/skills/arbazkhan971/godmode/postgres.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,524 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00020 $0.01524
Opus 5 $0.00010 $0.00762
Sonnet 5 $0.00004 $0.00305
Haiku 4.5 $0.00002 $0.00152

Measured yesterday against content hash 48418a033877, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

postgres scanned grade A with 1 finding 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 yesterday.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s http://localhost:8080/health/db
skills/postgres/SKILL.md · 197 lines

How it starts

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

Activate When

  • /godmode:postgres, "postgres performance"
  • "tune postgres", "replication", "partition table"
  • "pgbouncer", "pgvector", "full-text search"
  • "VACUUM", "ANALYZE", "bloat", "pg_stat"
  • "postgres migration", "write a migration", "postgres schema"

Workflow

1. Environment Assessment

SELECT version();
SHOW shared_buffers;
SHOW work_mem;
SHOW max_connections;
Version: PostgreSQL 14|15|16|17
Hosting: self-managed|RDS|Aurora|Supabase|Neon
Workload: OLTP|OLAP|mixed
Size: <total GB>, Tables: <N>, Largest: <N rows>

2. Advanced Features

CTEs: recursive for hierarchies, materialized for repeated subqueries (PG 12+ auto-optimizes).

Window Functions: ROW_NUMBER, RANK, LAG/LEAD, running totals with SUM() OVER().

JSONB: GIN index for containment (@>), use jsonb_path_query for complex extraction. Keep structured data in columns, metadata in JSONB.

Full-Text Search: tsvector + GIN index. to_tsvector('english', col) with @@ operator. IF FTS sufficient: skip Elasticsearch.

3. Extensions

  • pgvector: vector similarity (RAG, embeddings). Use ivfflat (fast, approximate) or hnsw (accurate). IF <1M vectors: pgvector over Pinecone.
  • PostGIS: geospatial. ST_DWithin for proximity.
  • TimescaleDB: time-series. Hypertables with automatic partitioning by time.
  • pg_stat_statements: ALWAYS install. Non-negotiable for understanding query performance.

4. Replication

Streaming (physical): byte-for-byte copy. Use for HA failover + read replicas. wal_level=replica.

Logical: table-level, selective. Use for cross- version upgrades, specific table replication, CDC. Requires wal_level=logical.

IF HA failover needed: streaming replication. IF selective table sync: logical replication.

5. Partitioning

CREATE TABLE events (
  id bigserial, created_at timestamptz, data jsonb
) PARTITION BY RANGE (created_at);
CREATE TABLE events_2024_q1 PARTITION OF events
  FOR VALUES FROM ('2024-01-01') TO ('2024-04-01');
  • Range: time-series, logs (partition by month/quarter)
  • List: known categories (partition by region/status)
  • Hash: uniform distribution (partition by user_id)

Read the full file on GitHub · 197 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. yesterday First seen · 197 lines · 20 tokens per session scan A 48418a033877

Subscribe to this mod's changes

postgres is a skill published in the GitHub repository arbazkhan971/godmode (26 stars, last pushed 7d ago), licensed MIT. It adds 20 tokens to every session and 1,524 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

cloud-sql-postgres-vectorassist

Use these skills to set up and optimize production-ready vector workloads by simply expressing your intent and performance requirements.

tmolavi/mcp-agent-skills-hub · 29 tokens

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

database-patterns

DB schema design and query tuning: normalization, indexing, N+1, transactions, EXPLAIN. Triggers: schema, index, slow query, N+1, PostgreSQL, MySQL, EXPLAIN, deadlock, query plan.

softspark/ai-toolkit · 55 tokens

ai-vector-brain

Builds vector-brain implementations for repos, docs hubs, and compliance corpora. Use when creating pgvector retrieval brains with scripts, SQL, manifests, and evals.

vasilyu1983/AI-Agents-public · 40 tokens

postgres-semantic-search

PostgreSQL-based semantic and hybrid search with pgvector and ParadeDB. Use when implementing vector search, semantic search, hybrid search, or full-text search in PostgreSQL. Covers pgvector indexing, hybrid FTS/BM25 + RRF, ParadeDB, reranking, halfvec, multilingual search, query translation, and domain evals.…

laguagu/claude-code-nextjs-skills · 228 tokens