psqllisted
Install: claude install-skill aiskillstore/marketplace
## Overview
CLI tool for running SQL queries and psql meta-commands against PostgreSQL databases. Each query is executed directly via the `psql` CLI - no persistent connection required.
## Prerequisites
- [bun](https://bun.sh) runtime installed
- [psql](https://www.postgresql.org/docs/current/app-psql.html) client installed
- PostgreSQL connection environment variables set in `<git-root>/.env` or exported
## Environment Variables
Set these in your `.env` file or export them:
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `PGHOST` | Yes | - | Database host |
| `PGPORT` | No | `5432` | Database port |
| `PGDATABASE` | Yes | - | Database name |
| `PGUSER` | Yes | - | Database user |
| `PGPASSWORD` | Yes | - | Database password |
| `PGSSLMODE` | No | - | SSL mode (disable, require, etc.) |
Example `.env`:
```bash
PGHOST=localhost
PGPORT=5432
PGDATABASE=myapp
PGUSER=myapp
PGPASSWORD=secret
PGSSLMODE=disable
```
## Command
### Query
Run a SQL query, meta-command, or SQL file.
```bash
bun .opencode/skill/psql/query.js <query> [options]
bun .opencode/skill/psql/query.js --file <path> [options]
```
**Arguments:**
- `query` - SQL query or meta-command to execute
**Options:**
- `--file <path>` - Execute SQL file instead of inline query
- `--tuples` - Tuples only output (no headers or row count)
- `--timeout <ms>` - Query timeout in milliseconds (default: 30000)
- `--json` - Wrap output in JSON
- `--help` - Show help
**Exam