All skills
sanjay3290 avatar

/postgres

@eab1642

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.

Use this Skill: https://skilld.dev/gh/sanjay3290/ai-skills/postgres

This session only. Nothing lands on disk.

README.md

≈460 tokens on demand. Your agent reads this file only when SKILL.md points to it.

postgres

Read-only PostgreSQL query skill. Query multiple databases safely with write protection.

Setup

  1. Copy the example config:
cp connections.example.json connections.json
  1. Add your database credentials:
{
  "databases": [
    {
      "name": "prod",
      "description": "Production - users, orders, transactions",
      "host": "db.example.com",
      "port": 5432,
      "database": "app_prod",
      "user": "readonly",
      "password": "secret",
      "sslmode": "require"
    }
  ]
}
  1. Secure the config:
chmod 600 connections.json

Usage

# List configured databases
python3 scripts/query.py --list

# List tables
python3 scripts/query.py --db prod --tables

# Show schema
python3 scripts/query.py --db prod --schema

# Run query
python3 scripts/query.py --db prod --query "SELECT * FROM users" --limit 100

Config Fields

Field Required Default Description
name Yes - Database identifier
description Yes - What data it contains (for auto-selection)
host Yes - Hostname
port No 5432 Port
database Yes - Database name
user Yes - Username
password Yes - Password
sslmode No prefer disable, allow, prefer, require, verify-ca, verify-full

Safety Features

  • Read-only sessions: PostgreSQL readonly=True mode blocks writes at database level
  • Query validation: Only SELECT, SHOW, EXPLAIN, WITH allowed
  • Single statement: No multi-statement queries (prevents SELECT 1; DROP TABLE)
  • Timeouts: 30s query timeout, 10s connection timeout
  • Memory cap: Max 10,000 rows per query
  • Credential protection: Passwords sanitized from error messages

Requirements

pip install psycopg2-binary

Source: SKILL.md on GitHub

2 warnings17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides a safe, read-only mechanism for querying configured PostgreSQL databases. It includes robust controls to prevent data modification and sanitize errors.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: MEDIUM · 1 issue

  • Runlayer7mo

    6/6 files flagged

  • ZeroLeaks5mo

    1 finding · Score: 82/100

Signed by skilld at eab1642. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 7 months ago
metadata
{
  "author": "sanjay3290",
  "version": "1.0"
}

README badge

README badge for sanjay3290/ai-skills/postgres