postgres

Execute read-only SQL queries against multiple configured PostgreSQL databases.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/AnderHonorato/Mem-rias-IA---Infinity --skill postgres-anderhonorato
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres
Source: https://github.com/AnderHonorato/Mem-rias-IA---Infinity/tree/main/Manus/Skills/snapshots/sanjay-postgres
Command: npx skills add https://github.com/AnderHonorato/Mem-rias-IA---Infinity --skill postgres-anderhonorato

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires psycopg2-binary, and includes scripts (resource) components.

What problem does it solve? Querying PostgreSQL databases from an AI assistant normally risks accidental writes, credential leaks, and runaway queries. This Skill provides a controlled, read-only query executor that connects to multiple pre-configured databases and blocks all write operations at both the session and validation level. ## Core Features & Use Cases - Read-only enforcement: Uses PostgreSQL readonly session mode plus client-side validation that only allows SELECT, SHOW, EXPLAIN, and WITH statements, and rejects multi-statement queries. - Multi-database support: Configure several databases in connections.json with descriptions, then list them, inspect tables and schemas, and pick the right one for each question. - Built-in safeguards: 30-second query timeout, 10-second connection timeout, 10,000-row cap, column width limits, and credential sanitization in error messages. - Use Case: Ask which database contains order data, list its tables, inspect the schema, and run "SELECT * FROM orders LIMIT 100" to analyze sales data without any risk of modifying production records. ## Quick Start Configure your database credentials in connections.json, then ask the assistant to list the available databases and run a SELECT query against the production database.

Frequently Asked Questions about postgres

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run read-only PostgreSQL queries from Python?

Use psycopg2 with conn.set_session(readonly=True, autocommit=True) to enforce read-only mode at the database level. This Skill's query.py script adds client-side validation that only allows SELECT, SHOW, EXPLAIN, and WITH statements before execution.

How do I configure multiple PostgreSQL database connections?

Create a connections.json file with a databases array containing name, description, host, port, database, user, password, and sslmode for each connection. The script searches the skill directory and ~/.config/claude/postgres-connections.json, and you select a database by name with the --db flag.

Can this tool modify or delete data in my PostgreSQL database?

No. The connection uses PostgreSQL readonly session mode as primary protection, and queries are validated to allow only SELECT, SHOW, EXPLAIN, and WITH. Multi-statement queries like SELECT 1; DROP TABLE are rejected before execution.

Why does my PostgreSQL connection fail with an authentication error?

Authentication failures usually mean wrong username or password in connections.json. Also verify the host and port are reachable, check firewall or VPN rules, and try setting sslmode to disable for local databases if you get SSL errors.

What are the limits when querying large PostgreSQL tables?

Queries are capped at 10,000 rows per execution with a 30-second statement timeout and 10-second connection timeout. Use the --limit flag to add a LIMIT clause, and note that output columns are truncated at 100 characters for readability.