Skip to content

Read-only PostgreSQL query skill that targets the right database by description and blocks writes.

CCM score
67 of 100
skills.sh installs
645
GitHub stars
462
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers listing databases, browsing tables and schemas, and running single SELECT, SHOW, EXPLAIN, or WITH queries
  • Provides --list, --tables, --schema, --query, and --limit flags via scripts/query.py for multiple configured connections
  • Enforces a read-only session, a 30-second statement timeout, and a 10,000-row cap per query
  • Designed for analysts who need to explore PostgreSQL data without risking writes to production

Install

$ npx -y skills add sanjay3290/ai-skills --skill postgres -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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

Details

Repository
github.com/sanjay3290/ai-skills
Category
Databases
License
Apache-2.0
First seen
Jun 3, 2026

Questions

What does the postgres skill let an agent do with PostgreSQL databases?

The postgres skill lets an agent run read-only SQL queries against one or more PostgreSQL databases, explore table lists and schemas, and check database contents. It only allows SELECT, SHOW, EXPLAIN and WITH queries and blocks write operations such as INSERT, UPDATE, DELETE and DROP.

How do I install the postgres skill?

Run npx -y skills add sanjay3290/ai-skills --skill postgres -y in a project to install it. The skill needs Python 3.8 or newer and the psycopg2-binary package, plus a connections.json file that lists your database connection details.

Which skills lead the Databases category, and how does postgres compare?

Other skills in the Databases category on Claude Marketplaces include supabase-postgres-best-practices and several Prisma skills. The postgres skill differs because it focuses on safe, read-only querying across multiple configured databases, with each connection described so the agent can pick the right one.

Is it safe to let an agent query my production database with this skill?

The skill connects in PostgreSQL read-only mode, rejects multiple statements per query, and enforces a 30-second timeout and a 10,000-row cap. It also recommends setting connections.json to file permission 600 because the file holds credentials, and using a read-only database user.

How do I set up database connections for the postgres skill?

Create connections.json in the skill directory or at ~/.config/claude/postgres-connections.json, listing each database with a name, a description, host, database name, user and password. The description is used to auto-select the right database for a user's question.

More from sanjay3290/ai-skills

All 20

Similar to Postgres

More Databases