Agent skill · data analytics · aiskillstore
psql
Run PostgreSQL queries and meta-commands via CLI
Why this skill is useful
Adds specific command patterns and options for executing PostgreSQL queries that the AI wouldn't reliably generate on its own.
What it needs
Requires bun, psql installed locally. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
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 runtime installed psql 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: Command Query Run a SQL query, meta-command, or SQL file. 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 Examples: --- Common Workflows Explore Database Schema Run Analytical Queries Database Administration Run Migrations --- Output Behavior Query output is displayed directly to the user in the terminal Do not re-summarize or reformat query output - the user can already see it Use --tuples for clean output without headers (useful for piping to other tools) Use --json for structured output when parsing programmatically Notes Each query is executed as a separate psql invocation (no persistent connection) Meta-commands (starting with \) work the same as SQL queries Long-running queries may need --timeout increased from the default 30 seconds The --tuples flag is useful when you need to parse output or pipe to other commands
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/psql