postgres-intelligencelisted
Install: claude install-skill cskwork/postgres-intelligence
# postgres-intelligence
PostgreSQL intelligence for LLM coding agents. It gives Claude Code, Codex, and other local agents a credential-safe way to discover PostgreSQL schemas, run read-first SQL, inspect query errors, and reason about performance.
The core rule is simple: the agent should not open or print `.env` directly. Scripts load credentials at runtime, and the agent only sees safe summaries, query results, and metadata.
## What It Does
- Loads one or more PostgreSQL connections from `.env` using `DB1_...DB10_...`.
- Tests connectivity without printing passwords or full DSNs.
- Extracts schema metadata from `information_schema` and `pg_catalog`.
- Executes read-only SQL by default: `SELECT`, `WITH`, `SHOW`, and `EXPLAIN`.
- Blocks writes and DDL unless explicit flags are passed after user approval.
- Returns structured JSON that any LLM agent can parse.
- Provides PostgreSQL-specific guidance for indexes, JSONB, `EXPLAIN`, and maintenance.
## Install
```bash
cd postgres-intelligence
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
cp .env.example .env
python scripts/config.py
python scripts/db_connector.py
python scripts/schema_extractor.py
```
Use `.env.example` as the public template. Keep real `.env`, `.venv`, and `schema_metadata.json` out of git.
## Configure
```bash
DB1_HOST=localhost
DB1_PORT=5432
DB1_USER=your_username
DB1_PASSWORD=your_password
DB1_DATABASE=your_database
DB1_NAME=primary
DB1_SSLMODE=prefer
DB1_CONNE