psql

Run SQL queries and psql meta-commands against PostgreSQL databases from the CLI.

5|Updated Dec 28, 2025
One-click install
npx skills add https://github.com/Bind/skillz.sh --skill psql-bind
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: psql
Source: https://github.com/Bind/skillz.sh/tree/main/docs/registry/skills/psql
Command: npx skills add https://github.com/Bind/skillz.sh --skill psql-bind

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables running SQL queries and psql meta-commands directly from the CLI against PostgreSQL databases, without maintaining a persistent connection.

Core Features & Use Cases

  • Ad-hoc querying: Run inline SQL statements and psql meta-commands quickly from the terminal.
  • File-based migrations: Execute SQL files for migrations or batch changes.
  • Environment-based access: Leverage configured PGHOST/PGUSER/etc. for seamless database access in development and operations.

Quick Start

bun .opencode/skill/psql/query.js "SELECT version();" bun .opencode/skill/psql/query.js --file migrations/001_init.sql

Frequently Asked Questions about psql

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

FAQPage Schema
How do I run PostgreSQL queries from the CLI?▼

Run PostgreSQL queries from the CLI by executing the query script with bun and passing your SQL statement as an argument. This approach enables ad-hoc data exploration and routine database administration directly from the terminal.

Can I execute SQL migration files against a PostgreSQL database?▼

Yes, you can execute SQL migration files against a PostgreSQL database by running the query script with the --file flag followed by the migration path. This processes batch changes and schema migrations seamlessly.

How do I configure PostgreSQL connection variables for CLI access?▼

Configure PostgreSQL connection variables for CLI access by setting environment variables like PGHOST, PGDATABASE, PGUSER, and PGPASSWORD. This environment-based access enables seamless database connections without persistent sessions.

Do I need the bun runtime to run psql meta-commands?▼

Yes, you need the bun runtime and the psql client installed to run psql meta-commands. This Skill leverages bun to execute the underlying scripts that interface with your PostgreSQL database.

What is the best way to inspect a database schema from the terminal?▼

The best way to inspect a database schema from the terminal is using psql meta-commands through this CLI Skill. It supports schema inspection by passing meta-commands directly without maintaining a persistent connection.

Does this approach maintain a persistent connection to the PostgreSQL database?▼

No, this approach does not maintain a persistent connection to the PostgreSQL database. It executes individual queries and psql meta-commands directly from the CLI for ad-hoc data exploration and administration.