Agent skill

Postgres

by sanjay3290 in sanjay3290/ai-skills

Execute read-only SQL queries against multiple PostgreSQL databases.

Apache-2.0Auto-check passedDatabases

Install Postgres

skills CLI
$ npx skills add sanjay3290/ai-skills --skill postgres -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sanjay3290/ai-skills postgres --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sanjay3290/ai-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/postgres .claude/skills/postgres && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
postgres
GitHub stars
430
Used in
1 other repo
Token cost
~975 tokens
SKILL.md length
298 words
Files
6 (incl. scripts)
Skills in repo
24
Repo updated
First seen
Licence
Apache-2.0

At a glance

Execute read-only SQL queries against multiple PostgreSQL databases.

  • Works in 4 steps: Run --list to show available databases → Match user intent to database description → Run --tables or --schema to explore… → …
  • Querying PostgreSQL databases
  • SKILL.md covers Requirements, Setup, Usage and Database Selection, plus 4 more sections
  • Runs Python scripts from its folder; calls python3 and pip

What it does

Postgres is an agent skill from sanjay3290/ai-skills. Execute read-only SQL queries against multiple PostgreSQL databases. Use when: (1) querying PostgreSQL databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.

Its SKILL.md is about 980 tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts (for example `README.md`, `connections.example.json` and `scripts/query.py`).

It sits in Databases, covering SQL, Database schema design and Data analysis. It works with PostgreSQL and SQL. The repository describes itself as: 24 cross-platform agent skills for Claude Code, Cursor, Codex & Gemini CLI — databases, messaging, research, TTS, DevOps, and Google Workspace. The licence is Apache-2.0.

When your agent uses it

  • Querying PostgreSQL databases
  • Exploring database schemas/tables
  • Running SELECT queries for data analysis
  • Checking database contents

Example prompts

  • “/postgres”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Run --list to show available databases
  2. Match user intent to database description
  3. Run --tables or --schema to explore structure
  4. Execute query with appropriate LIMIT

What it can do on your machine

Read from SKILL.md and the folder at commit 281d88d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Postgres loads about 975 tokens when it runs. Until then it costs about 101 tokens; SKILL.md has 298 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~101
When it runs · the whole SKILL.md, loaded when a task matches
~975

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from sanjay3290/ai-skills at commit 281d88d, republished under its Apache-2.0 licence (© sanjay3290). 298 words, ~975 tokens.

Download SKILL.mdSave it as .claude/skills/postgres/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
postgres
description
Execute read-only SQL queries against multiple PostgreSQL databases. Use when: (1) querying PostgreSQL databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.
license
Apache-2.0
metadata.author
sanjay3290
metadata.version
1.0

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:

bash
chmod 600 connections.json
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
FieldRequiredDescription
nameYesIdentifier for the database (case-insensitive)
descriptionYesWhat data this database contains (used for auto-selection)
hostYesDatabase hostname
portNoPort number (default: 5432)
databaseYesDatabase name
userYesUsername
passwordYesPassword
sslmodeNoSSL mode: disable, allow, prefer (default), require, verify-ca, verify-full

Usage

List configured databases
bash
python3 scripts/query.py --list
Query a database
bash
python3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"
List tables
bash
python3 scripts/query.py --db production --tables
Show schema
bash
python3 scripts/query.py --db production --schema
Limit results
bash
python3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100

Database Selection

Match user intent to database description:

User asks aboutLook for description containing
users, accountsusers, accounts, customers
orders, salesorders, transactions, sales
analytics, metricsanalytics, metrics, reports
logs, eventslogs, events, audit

If unclear, run --list and ask user which database.

Safety Features

  • Read-only session: Connection uses PostgreSQL readonly=True mode (primary protection)
  • Query validation: Only SELECT, SHOW, EXPLAIN, WITH queries allowed
  • Single statement: Multiple statements per query rejected
  • SSL support: Configurable SSL mode for encrypted connections
  • Query timeout: 30-second statement timeout enforced
  • Memory protection: Max 10,000 rows per query to prevent OOM
  • Column width cap: 100 char max per column for readable output
  • Credential sanitization: Error messages don't leak passwords

Troubleshooting

ErrorSolution
Config not foundCreate connections.json in skill directory
Authentication failedCheck username/password in config
Connection timeoutVerify host/port, check firewall/VPN
SSL errorTry "sslmode": "disable" for local databases
Permission warningRun chmod 600 connections.json

Exit Codes

  • 0: Success
  • 1: Error (config missing, auth failed, invalid query, database error)

Workflow

  1. Run --list to show available databases
  2. Match user intent to database description
  3. Run --tables or --schema to explore structure
  4. Execute query with appropriate LIMIT

© sanjay3290, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts) in skills/postgres of sanjay3290/ai-skills.

  • SKILL.md
  • .gitignore
  • README.md
  • connections.example.json
  • requirements.txt
  • scripts/query.py

Open the folder on GitHubat commit 281d88d

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in sanjay3290/ai-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Postgres next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Postgres compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Postgres this skillsanjay3290/ai-skills4301 repos~975Automated safety check: PassApache-2.0
Schema Explorationtimescale/pg-aiguide1.9k—~1.1kAutomated safety check: PassApache-2.0
Database FundamentalsDanielPodolsky/ownyourcode2901 repos~1.6kAutomated safety check: PassMIT
Golang Databaseunxed/f42402 repos~2.9kAutomated safety check: PassMIT
Semantic Analystsidequery/sidemantic129—~982Automated safety check: PassAGPL-3.0
DB ContextSilvioBaratto/optimizer176—~6.4kAutomated safety check: NotesCustom licence

Similar skills

  • Schema Exploration

    timescale/pg-aiguide

    Explore an existing PostgreSQL database before answering questions about its data or writing SQL.

    1.9k GitHub stars~1.1k tokensUpdated 6 days ago
    DatabasesAuto-check passed
  • Database Fundamentals

    DanielPodolsky/ownyourcode

    Reviews schema design, SQL queries, ORM patterns. An agent skill from DanielPodolsky/ownyourcode.

    290 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    240 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed
  • Semantic Analyst

    sidequery/sidemantic

    Answer analytical, KPI, metric, trend, cohort, and business-performance questions through a Sidemantic semantic layer.

    129 GitHub stars~982 tokensUpdated today
    DatabasesAuto-check passed
  • DB Context

    SilvioBaratto/optimizer

    Complete knowledge of the optimizer PostgreSQL database: 57 ingestion tables, schema, relationships, live row counts, query patterns, and conventions.

    176 GitHub stars~6.4k tokensUpdated yesterday
    DatabasesAuto-check: notes
  • Expert Database

    ReJeCtAll/ExpertTeam-Codex

    数据库优化专家入口。用于 Codex CLI 的 $expert-database 调用. An agent skill from ReJeCtAll/ExpertTeam-Codex.

    113 GitHub stars~692 tokensUpdated 3 mo ago
    DatabasesAuto-check passed

More from sanjay3290/ai-skills

All 24 skills in this repo
  • Deep Research

    sanjay3290/ai-skills

    Execute autonomous multi-step research using Google Gemini Deep Research Agent.

    430 GitHub starsUsed in 10 repos~683 tokens
    Auto-check: notes
  • Imagen

    sanjay3290/ai-skills

    Generate images using Google Gemini's image generation capabilities.

    430 GitHub starsUsed in 7 repos~657 tokens
    Auto-check passed
  • Notebooklm

    sanjay3290/ai-skills

    Query and manage Google NotebookLM notebooks with persistent profile auth, source sync, batch/multi queries, and structured exports.

    430 GitHub stars~655 tokensUpdated 26 days ago
    Auto-check passed
  • Whatsapp

    sanjay3290/ai-skills

    Send and receive WhatsApp messages via the unofficial linked-device client pywhats (pip install pywhats) — pair with QR, send text/images, group chat, read receipts, presence/typing, and a…

    430 GitHub stars~1.1k tokensUpdated 26 days ago
    Auto-check passed
  • Elevenlabs

    sanjay3290/ai-skills

    Convert documents and text to audio using ElevenLabs text-to-speech.

    430 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Atlassian

    sanjay3290/ai-skills

    Manage Jira issues and Confluence wiki pages in Atlassian Cloud.

    430 GitHub stars~1.6k tokensUpdated 26 days ago
    Auto-check passed

Works with

Categories

Questions about Postgres

What does Postgres do?

Execute read-only SQL queries against multiple PostgreSQL databases. Postgres is an agent skill from sanjay3290/ai-skills. Execute read-only SQL queries against multiple PostgreSQL databases.

When should I use Postgres?

Postgres fits situations like: querying PostgreSQL databases; exploring database schemas/tables; running SELECT queries for data analysis; checking database contents.

How do I install Postgres in Claude Code?

Run `npx skills add sanjay3290/ai-skills --skill postgres -a claude-code`. Or copy the skill folder (skills/postgres in sanjay3290/ai-skills) into .claude/skills/postgres in your project. Claude Code loads it when a task matches its description.

How do I install Postgres in Codex?

Run `npx skills add sanjay3290/ai-skills --skill postgres -a codex`. Or copy the skill folder (skills/postgres in sanjay3290/ai-skills) into .agents/skills/postgres in your project. Codex loads it when a task matches its description.

Can I use Postgres in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sanjay3290/ai-skills --skill postgres -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/postgres, .gemini/skills/postgres, .github/skills/postgres and .opencode/skills/postgres in your project.

What does Postgres need to run?

Going by SKILL.md and its folder, Postgres needs Python for the scripts in its folder and the command-line tools its instructions call (python3 and pip). Our summary lists: Python 3.

Does Postgres access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Postgres safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Postgres use?

Postgres is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Postgres use?

About 975 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Postgres?

Skills that share tags, products or a category with Postgres: Schema Exploration (timescale/pg-aiguide, 1.9k stars), Database Fundamentals (DanielPodolsky/ownyourcode, 290 stars), Golang Database (unxed/f4, 240 stars) and Semantic Analyst (sidequery/sidemantic, 129 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Postgres?

sanjay3290 (a GitHub user) maintains it in sanjay3290/ai-skills, which has 430 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on September 10, 2026.

Source: sanjay3290/ai-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.