Agent skill · Databases

postgresql-cli

PostgreSQL interactive terminal (psql) reference and usage guide. Use this skill whenever the user mentions psql, PostgreSQL command-line client, backslash commands, meta-commands, \d commands, database inspection, SQL scripting in PostgreSQL, importing/exporting data with psql, \copy,...

Nick44,086★ · +407/wk · 1 repos on radarProfile →
claude-codecodexcursorMIT
Install
npx skills add sickn33/agentic-awesome-skills --skill postgresql-cli --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 7
SKILL.md size: 29 KB
Bundled scripts: none
Path: skills/postgresql-cli/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 44,414 · +328 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

The skill instructs the agent on how to use psql for interacting with PostgreSQL, covering connection methods, object inspection commands, query execution techniques, data import/export options (including the client-side \copy), and output formatting and large object operations. It enumerates specific commands, flags, and backslash/meta-commands the agent can employ to perform typical database tasks.

How it works

It provides explicit procedures and command examples to:

  • Verify and establish a psql connection using CLI flags, environment variables, service files, or connection URIs.
  • Inspect database objects with the \d family of commands and their modifiers, detailing what each command shows (tables, views, data types, etc.).
  • Execute queries and control the result display using \g, \watch, \crosstabview, and related data-output options.
  • Perform data import/export with server-side COPY or client-side \copy, including handling of CSV formats and NULLs, and notes on security considerations like using ~/.pgpass.
  • Manage output formatting settings and large objects (\lo_ commands).
  • Use scripting and control flow features such as \i for file inclusion.

When to use it

Use when the user references psql, PostgreSQL command-line client, backslash commands, meta-commands, \d commands, database inspection, SQL scripting in PostgreSQL, importing/exporting data with psql, or the \copy utility.

What it can touch

The skill references and relies on tools/commands such as: "psql", backslash commands like "\d", and client-side commands like "\copy". It also mentions environment variables and file paths (e.g., ~/.pgpass) for authentication and file handling. (Note: The review describes the commands and their usage; it does not execute them.)

Caveats

It notes security considerations, such as the visibility of passwords in shell history/process listings and recommends using ~/.pgpass for production. It also warns that the server-side COPY requires superuser privileges for file access and highlights potential command injection when using the program option in \copy FROM/TO with untrusted data.

From the SKILL.md

# psql — PostgreSQL Interactive Terminal psql is PostgreSQL's feature-rich interactive terminal. It lets you write and execute queries, inspect database objects, import/export data, script batch operations, and customize output formatting — all from the command line. ## Prerequisites Before using psql, verify it is installed and available: ```bash # Check if psql is installed psql --version # If not found, install PostgreSQL client tools: # macOS (Homebrew) brew install libpq brew link --force libpq # Ubuntu / Debian sudo apt install postgresql-client # CentOS / RHEL sudo yum install postgresql # Alpine apk add postgresql-client # Windows — install PostgreSQL via the official installer or use WSL ``` psql ships as part of the `postgresql-client` package. The server (`postgresql`) is not required — you only need the client to connect to a remote PostgreSQL instance. ## Quick Reference ### Connecting ``` # 1. CLI flags psql -h host -p port -U user -d dbname # 2. Connection URI # WARNING: Password in URI is visible in shell history and process listings. # Prefer ~/.pgpass for production use (see method 4 below). psql "postgresql://user:YOUR_PASSWORD@host:port/dbname" # 3. Environment

What's inside
Steps it walks through
  1. Prerequisites
  2. Quick Reference
  3. Connecting
  4. Object Inspection (\d family)
  5. Query Execution
  6. Data Import/Export
  7. Output Formatting
  8. Large Objects
  9. Scripting & Control Flow
  10. Session Management
  11. Pipeline Mode (PostgreSQL 14+)
  12. \watch Syntax
  13. Exit Codes
  14. Security Considerations
Ships with 6 files
  • references/cli-options-and-variables.md
  • references/meta-commands-core.md
  • references/meta-commands-formatting.md
  • references/meta-commands-inspection.md
  • references/tips-advanced.md
  • references/tips-workflows.md
Commands it runs
Check if psql is installed
psql --version
If not found, install PostgreSQL client tools:
macOS (Homebrew)
brew install libpq
brew link --force libpq
Ubuntu / Debian
sudo apt install postgresql-client
CentOS / RHEL
sudo yum install postgresql
More from agentic-awesome-skills
All skills →
About this skill
What does the postgresql-cli skill do?

PostgreSQL interactive terminal (psql) reference and usage guide. Use this skill whenever the user mentions psql, PostgreSQL command-line client, backslash commands, meta-commands, \d commands, database inspection, SQL scripting in PostgreSQL, importing/exporting data with psql, \copy,...

How do I install it?

Run `npx skills add sickn33/agentic-awesome-skills --skill postgresql-cli --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From sickn33/agentic-awesome-skills, a repository with 44,414 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going