← ClaudeAtlas

postgresql-clilisted

Perform PostgreSQL operations using the psql CLI. Use for inspecting schemas, running read-only queries, and troubleshooting databases across environments.
abdullahkhawer/devops-skills · ★ 7 · API & Backend · score 78
Install: claude install-skill abdullahkhawer/devops-skills
# PostgreSQL CLI Skill Use the connection table and rules below when constructing all `psql` commands. ## Configuration Update the table below with your connection details before using this skill: | Environment | Connection Service Name | Credential File | |---|---|---| | Production | `<your-prod-service>` | `~/.postgresql/prod.pgpass` | | Staging / Non-Prod | `<your-nonprod-service>` | `~/.postgresql/staging.pgpass` | If the target environment is unclear, ask the user before running any command. ### Prerequisites (one-time setup by user) If `psql` is not installed or no connection service is configured, inform the user that setup is required and ask them to complete the following steps manually. Do not perform these steps yourself. ```bash brew install libpq && brew link --force libpq ``` Configure `~/.pg_service.conf` with a named `[service]` section per environment, and store credentials in a `.pgpass` file (`hostname:port:database:username:password`, `chmod 600`). Never share credential file contents with the assistant. ## Command Format Always use `service=<name>` from `~/.pg_service.conf` — never pass raw host/user/password on the command line, where they could leak into shell history or process listings: ```bash psql "service=<connection-service-name>" -c "<SQL>" ``` ### Examples ```bash # Non-Prod — list tables psql "service=<your-nonprod-service>" -c "\dt" # Non-Prod — describe a table psql "service=<your-nonprod-service>" -c "\d <table_name>" ``` ##