PostgreSQL intelligence skill for LLM coding agents.
Use it with Claude Code, Codex, Cursor, Windsurf, or any local agent that needs to safely connect to PostgreSQL, inspect schemas, run read-first SQL, and reason about query performance without exposing credentials.
LLM agents are useful for database exploration, but they should not read or print secrets. postgres-intelligence keeps the contract clear:
- humans configure
.env - scripts load credentials at runtime
- agents see only safe summaries, metadata, query results, and errors
- Multi-connection PostgreSQL config with
DB1_...DB10_... - Safe connection testing without printing passwords or full DSNs
- Schema metadata extraction from
information_schemaandpg_catalog - Read-only SQL by default:
SELECT,WITH,SHOW,EXPLAIN - Write/DDL guards with explicit
--allow-writeand--allow-ddl - Structured JSON output for LLM agents
- PostgreSQL guidance for
EXPLAIN, indexes, JSONB, and maintenance
git clone https://github.com/cskwork/postgres-intelligence.git
cd postgres-intelligence
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
cp .env.example .envEdit .env with your PostgreSQL connection details.
# Validate config without printing secrets
python scripts/config.py
# Test all configured connections
python scripts/db_connector.py
# Extract schema metadata
python scripts/schema_extractor.py
# Run read-only SQL
python scripts/query_executor.py --json-only "SELECT current_database(), current_schema();"Do not open or print .env directly. Let scripts load credentials.
SKILL.md
.env.example
requirements.txt
scripts/
config.py
db_connector.py
query_executor.py
schema_extractor.py
setup.py
references/
postgres_best_practices.md
MIT