postgres

postgres is a skill for Claude Code from sanjay3290/ai-skills. It costs 79 tokens per session (918 once invoked), scanned B, a copy of mssql, Apache-2.0.

A read-only tool for querying configured PostgreSQL databases, which are databases commonly used by applications to store structured data. It can choose among multiple database connections based on their descriptions.

In plain words
What is it for?
Use it to run SELECT queries, explore tables and schemas, and inspect application data across configured PostgreSQL databases.
Why use it?
It lets you inspect schemas and data without changing database contents. Read-only access reduces the risk of accidental updates during investigation or analysis.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the ai-skills plugin — 24 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/sanjay3290/ai-skills/postgres
Any agent
npx skills add sanjay3290/ai-skills --skill postgres
Clone the repo
git clone --depth 1 https://github.com/sanjay3290/ai-skills

Made for: Claude Code.

Or install ai-skills, the plugin that ships this one along with the rest of its 24 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 postgres

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanjay3290/ai-skills/postgres.svg)](https://agentmods.dev/skills/sanjay3290/ai-skills/postgres)
Your own site
<a href="https://agentmods.dev/skills/sanjay3290/ai-skills/postgres"><img src="https://agentmods.dev/badge/skills/sanjay3290/ai-skills/postgres.svg" alt="Measured on agentmods" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 918 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin 89% copy Near-identical to another mod 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.00079 $0.00918
Opus 5 $0.00039 $0.00459
Sonnet 5 $0.00016 $0.00184
Haiku 4.5 $0.00008 $0.00092

Measured 6d ago against content hash 64daa7590591, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

postgres scanned grade B 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 6d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/query.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 600 connections.json
Origin

This is a copy

89% identical to mssql — 40 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/postgres/SKILL.md · 130 lines

How it starts

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

PostgreSQL Read-Only Query Skill

Execute safe, read-only queries against configured PostgreSQL databases.

Requirements

  • Python 3.8+
  • psycopg2-binary: pip install -r requirements.txt

Setup

Create connections.json in the skill directory or ~/.config/claude/postgres-connections.json.

Security: Set file permissions to 600 since it contains credentials:

chmod 600 connections.json
{
  "databases": [
    {
      "name": "production",
      "description": "Main app database - users, orders, transactions",
      "host": "db.example.com",
      "port": 5432,
      "database": "app_prod",
      "user": "readonly_user",
      "password": "your-password",
      "sslmode": "require"
    }
  ]
}

Config Fields

Field Required Description
name Yes Identifier for the database (case-insensitive)
description Yes What data this database contains (used for auto-selection)
host Yes Database hostname
port No Port number (default: 5432)
database Yes Database name
user Yes Username
password Yes Password
sslmode No SSL mode: disable, allow, prefer (default), require, verify-ca, verify-full

Usage

List configured databases

python3 scripts/query.py --list

Query a database

python3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"

List tables

python3 scripts/query.py --db production --tables

Show schema

python3 scripts/query.py --db production --schema

Limit results

python3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100

Database Selection

Match user intent to database description:

User asks about Look for description containing
users, accounts users, accounts, customers
orders, sales orders, transactions, sales
analytics, metrics analytics, metrics, reports
logs, events logs, events, audit

Read the full file on GitHub · 130 lines

Files

What ships with it

5 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. 6d ago First seen · 130 lines · 79 tokens per session scan B 64daa7590591

Subscribe to this mod's changes

postgres is a skill published in the GitHub repository sanjay3290/ai-skills (417 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 79 tokens to every session and 918 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). It is 89% identical to mssql, differing in 40 lines, and is treated as a copy.

Related

Other skills, from other repositories

postgresql

PostgreSQL database documentation - SQL queries, database design, administration, performance tuning, and advanced features. Use when working with PostgreSQL databases, writing SQL, or managing database systems.

aiskillstore/marketplace · 40 tokens

timescaledb

TimescaleDB - PostgreSQL extension for high-performance time-series and event data analytics, hypertables, continuous aggregates, compression, and real-time analytics.

aiskillstore/marketplace · 33 tokens

db-whisperer

Diagnoses and improves application-layer databases: Postgres, MySQL, SQLite, and MongoDB. Covers EXPLAIN ANALYZE, slow query detection, index strategy, N+1 detection, schema migrations with up/down scripts, connection pooling, replication setup, and vacuum/analyze operations. Use this skill when the user says "this…

mturac/hermes-supercode-skills · 131 tokens

postgres-expert

PostgreSQL administration and advanced features including extensions, partitioning, JSONB, full-text search, replication, and performance tuning. Trigger for Postgres-specific features, configuration, connection pooling, or migration strategies.

FutureJJ/claude-skills · 46 tokens

database-optimizer

Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.

Jeffallan/claude-skills · 54 tokens

postgres-pro

Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.

Jeffallan/claude-skills · 41 tokens