postgresql-cli

postgresql-cli is a skill for Claude Code, Codex from abdullahkhawer/devops-skills. It costs 30 tokens per session (916 once invoked), scanned B, original, Apache-2.0.

A command-line skill for PostgreSQL, a database system that stores structured application data. It uses named connection services and protected password files to inspect schemas, run read-only queries, and troubleshoot databases.

In plain words
What is it for?
Use it to inspect PostgreSQL schemas, query data without changing it, and investigate database problems across environments.
Why use it?
It reduces the risk of leaking database credentials in commands or shell history. It also makes the selected production or staging connection explicit.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect PostgreSQL schemas, query data without changing it, and investigate database problems across environments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/abdullahkhawer/devops-skills/postgresql-cli
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add abdullahkhawer/devops-skills --skill postgresql-cli
Clone the repo
git clone --depth 1 https://github.com/abdullahkhawer/devops-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for postgresql-cli

README.md
[![agentmods](https://agentmods.dev/badge/skills/abdullahkhawer/devops-skills/postgresql-cli/github.svg)](https://agentmods.dev/skills/abdullahkhawer/devops-skills/postgresql-cli)
Your own site
<a href="https://agentmods.dev/skills/abdullahkhawer/devops-skills/postgresql-cli"><img src="https://agentmods.dev/badge/skills/abdullahkhawer/devops-skills/postgresql-cli/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for postgresql-cli

Your own site · 80×15
<a href="https://agentmods.dev/skills/abdullahkhawer/devops-skills/postgresql-cli"><img src="https://agentmods.dev/badge/skills/abdullahkhawer/devops-skills/postgresql-cli.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 916 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00916
Opus 5.5 $0.00012 $0.00366
Sonnet 5.5 $0.00006 $0.00183
Haiku 4.5 $0.00003 $0.00092

Measured 23d ago against content hash 792108af1a46, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

postgresql-cli scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 23d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

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 w
skills/postgresql-cli/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

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:

psql "service=<connection-service-name>" -c "<SQL>"

Examples

# 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>"

Available Commands

Read-only (safe, no confirmation needed)

Command Description
\l List databases
\dt [pattern] List tables
\d <table> Describe a table's schema
\dn List schemas
\du List roles/users
\di List indexes
SELECT ... Any read-only query
EXPLAIN <query> Show a query plan without executing it
\timing Toggle query timing (informational)

Mutating operations (confirm with user before running)

Read the full file on GitHub · 90 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 23d ago First seen · 90 lines · 30 tokens per session scan B 792108af1a46

Subscribe to this mod's changes

postgresql-cli is a skill published in the GitHub repository abdullahkhawer/devops-skills (8 stars, last pushed 24d ago), licensed Apache-2.0. It adds 30 tokens to every session and 916 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-23.

Related

Other skills, from other repositories

alembic-migration

Create, review, and apply database schema changes with Alembic. Use whenever a SQLAlchemy model is added or changed, a column/index/constraint needs to change, or a data backfill is required — anything that alters the PostgreSQL schema.

vstorm-co/full-stack-ai-agent-template · 56 tokens

supabase-cli

This skill should be used when user asks to "use supabase CLI", "supabase init", "supabase start", "run migrations", "deploy edge functions", "manage Supabase project", or works with the supabase command-line tool for local development and project management.

fcakyon/claude-codex-settings · 60 tokens

supabase-js

This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

fcakyon/claude-codex-settings · 64 tokens

mongodb-query-optimizer

Help with MongoDB query optimization and indexing. Use only when the user asks for optimization or performance: "How do I optimize this query?", "How do I index this?", "Why is this query slow?", "Can you fix my slow queries?", "What are the slow queries on my cluster?", etc. Do not invoke for general MongoDB query…

fcakyon/claude-codex-settings · 98 tokens

polar-local-environment

This skill should be used when setting up or managing Polar local development environment with Docker.

fcakyon/claude-codex-settings · 22 tokens

sql-optimizer

Analyzes SQL queries for missing indexes, N+1 patterns, suboptimal joins, and full table scans. Interprets EXPLAIN, detects anti-patterns, rewrites queries. Triggers on: "optimize this query", "slow query", "add indexes", "explain plan", "N+1 query", "why is this query slow".

Mathews-Tom/armory · 78 tokens