# Postgres

> Manage PostgreSQL databases via the psql CLI. Use when querying, inspecting schema, or managing PostgreSQL databases.

- Skill: `fworks-tech/postgres` (Agent Skill)
- Install (CLI): `npx skillmds@latest add fworks-tech/postgres`
- Raw SKILL.md: https://api.skillmd.com/api/skills/fworks-tech/postgres/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: fworks-tech (https://skillmd.com/u/fworks-tech)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/fworks-tech/postgres

---


# psql

Use `psql` to interact with PostgreSQL databases.

## Common Commands

### Connection
- Connect: `psql "postgresql://user:password@host:port/dbname"`
- Connect with env var: `psql "${DATABASE_URL}"`

### Inspection
- List databases: `\l`
- List tables: `\dt`
- Describe table: `\d <table_name>`
- List schemas: `\dn`

### Queries
- Execute query: `psql -c "SELECT * FROM table LIMIT 10" "${DATABASE_URL}"`
- Execute from file: `psql -f migration.sql "${DATABASE_URL}"`
- Quit: `\q`

## Notes
- Requires `psql` installed. Set `DATABASE_URL` environment variable for connection string.

