postgresql-cli
Skill by sickn33
Reference and usage guide for psql, PostgreSQL's interactive terminal. It covers connecting, inspecting database objects, running queries and scripting batch operations from the command line.
Install postgresql-cli
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agentic-awesome-skills/skills/postgresql-cli ~/.claude/skills/postgresql-cliRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sickn33/agentic-awesome-skills /tmp/agentic-awesome-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agentic-awesome-skills/skills/postgresql-cli ~/.gemini/antigravity-cli/skills/postgresql-cliAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a reference and usage guide for psql, PostgreSQL's interactive terminal. It covers connecting with CLI flags, connection URIs, environment variables, ~/.pgpass and pg_service.conf. It also lists the \d object inspection commands, query execution options such as \g, \gexec and \watch, and the pattern matching rules used by \d commands.
According to the source, psql can write and run queries, import and export data, script batch operations and customize output. The guide asks the assistant to confirm the authorized database, role and operation scope before writes, imports, grants or shell commands. It recommends a least-privileged account, ON_ERROR_STOP for reviewed scripts and verified TLS for remote connections.
Written from the project's SKILL.md and checked against it.
What it can do
- Connecting to PostgreSQLExplains connection methods using CLI flags, URIs, environment variables, ~/.pgpass and service files.
- Object inspectionLists the \d command family for tables, views, indexes, functions, roles, schemas and more.
- Query executionCovers running queries and files, and options such as \g, \gexec, \gset, \crosstabview and \watch.
- Pattern matchingDescribes wildcard and schema rules for \d commands, including case handling with double quotes.
- Output formattingCovers expanded display, unaligned output, tuples-only mode and one-shot formatting with \g options.
- Safe usage guidanceGives execution boundary advice on scope checks, least privilege, ON_ERROR_STOP and verified TLS.
What you need
- psql client tools, from the postgresql-client package or libpq
- Access to a PostgreSQL instance to connect to
- Windows users need the official installer or WSL
- macOS, Ubuntu/Debian, CentOS/RHEL or Alpine for the install commands shown
Try asking
- Show me how to connect to a remote PostgreSQL database with verified TLS using psql.
- List all tables and views in my_schema using the psql \d commands.
- Run migration.sql in a single transaction with ON_ERROR_STOP using psql.
Good to know
- ECHO is not a dry-run, and rollback cannot undo every side effect.
- Passwords in connection URIs or PGPASSWORD are visible in process listings.
- The reference includes psql 18 features, so check client and server versions separately.
- After a failed connection in script mode, later database commands fail until a successful \c.
Security check
C- Asks for administrator rights (sudo)In
skills/postgresql-cli/SKILL.md:sudo
Checked automatically: skills/postgresql-cli/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md30 KB -
references/cli-options-and-variables.md21 KB -
references/meta-commands-core.md18 KB -
references/meta-commands-formatting.md7 KB -
references/meta-commands-inspection.md7 KB
Show all 7 files
-
references/tips-advanced.md8 KB -
references/tips-workflows.md10 KB
Alternatives to postgresql-cli
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
postgresql-cli: common questions
Does this skill need a local PostgreSQL server?
No. The source says the server is not required, and the client is enough to connect to a remote PostgreSQL instance.
Where should passwords be stored according to this guide?
The guide recommends ~/.pgpass for production use, since passwords in URIs and PGPASSWORD can appear in shell history or process listings.
What license does this skill use?
The front matter lists the license as Apache-2.0, with the source repository at chaunsin/agent-skills.
How do I install postgresql-cli?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is postgresql-cli free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is postgresql-cli safe to use?
It scores 92 of 100. Grades: maintenance A, licence A, quality A. Security check: grade C (asks for administrator rights (sudo)). Review the code before you install. How grades work.
What are alternatives to postgresql-cli?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
