postgres-admin
PostgreSQL server administration & operations — DBA work on a running cluster. Use when configuring a server (postgresql.conf, ALTER SYSTEM, reload vs restart, GUCs), managing roles & privileges (CREATE ROLE, GRANT/REVOKE, DEFAULT PRIVILEGES, predefined roles, membership), authentication (pg_hba.conf, scram-sha-256, peer/cert/ldap), backups & restore (pg_dump/pg_dumpall/pg_restore, pg_basebackup, incremental backups, PITR), replication & HA (streaming, logical publications/subscriptions, replication slots, failover, synchronous commit), pg_upgrade, or monitoring (pg_stat_activity, pg_stat_io, pg_stat_progress_*, log settings, checkpoints, connections). Server-side ops — for the psql client use `psql`, for SQL & query syntax `postgres-sql`, for query tuning & autovacuum mechanics `postgres-performance`, for contrib modules `postgres-extensions`. Features added in a release are tagged inline like `(pg16+)`; untagged items are bedrock (PostgreSQL 9.x or earlier). Verify with `SHOW server_version`.
What this skill does
# PostgreSQL Administration (DBA / Server Operations)
## Overview
This skill covers **operating a PostgreSQL server**: configuring it, securing access,
backing it up, replicating it, upgrading it, and watching it run. It is about the
**server and cluster**, not about writing application SQL.
**Mental model — the cluster hierarchy:**
```
PostgreSQL instance (one postmaster, one data directory $PGDATA, one port)
└── cluster = all databases managed by that instance
├── global objects: roles/users, tablespaces, replication slots (shared, cluster-wide)
└── database → schema → object (table/view/sequence/function)
```
- **One running server** (`postgres`/postmaster) serves **many databases**; roles and
tablespaces are **cluster-global**, not per-database.
- Configuration lives in **`postgresql.conf`** + **`postgresql.auto.conf`** in `$PGDATA`;
authentication in **`pg_hba.conf`**; runtime state in the **`pg_stat_*`** views.
- The server is a **long-running daemon**: most admin actions are *reload* (cheap, no
downtime) or, for a minority of settings, *restart* (brief downtime).
- Write-ahead log (**WAL**) is the foundation of crash recovery, backups (PITR), and
replication — almost everything operational ties back to it.
## Related skills (disambiguation)
| If you need… | Use skill |
|---|---|
| **Server config, roles/auth, backups, replication, upgrades, monitoring** | **postgres-admin** (this skill) |
| The `psql` client, meta-commands (`\d`, `\dt`), scripting the shell | `psql` |
| SQL syntax, DDL/DML, data types, functions, query writing | `postgres-sql` |
| Query tuning, `EXPLAIN`, indexes, **autovacuum mechanics/tuning** | `postgres-performance` |
| contrib extensions (`pg_stat_statements`, `postgis`, `pgcrypto`, …) | `postgres-extensions` |
> Overlap notes: this skill covers the **server-config / GUC** side of vacuum, checkpoints,
> and WAL (the knobs and what they mean operationally); deep autovacuum/query tuning lives in
> `postgres-performance`. `pg_stat_statements` is a contrib module — monitoring with it is in
> `postgres-extensions`; this skill points you at the built-in `pg_stat_*` views.
## Version awareness
PostgreSQL ships **one major version per year** (pg10 = 2017 … **pg18 = 2025 stable**,
**pg19 = 2026 beta**). This skill tags features added in **PostgreSQL 10 or later** inline as
`(pgNN+)` **only where a release note sources it**; anything from the **9.x era or earlier is
bedrock** and left untagged. Full sourced map: [references/version-features.md](references/version-features.md).
**Check what you're running** (annotations are a hard floor — a `(pg17+)` feature simply does
not exist on pg16):
```bash
psql -c "SHOW server_version" # e.g. 18.1
psql -c "SELECT version()" # full build string
postgres --version # the server binary
pg_config --version # build/devel version
psql -c "SHOW server_version_num" # 180001 → easy to compare numerically
```
## 1. Server configuration
Settings are **GUCs** (Grand Unified Configuration). Three layers, last-wins:
`postgresql.conf` → `postgresql.auto.conf` (written by `ALTER SYSTEM`) → per-session `SET`.
```sql
SHOW shared_buffers; -- one setting
SHOW all; -- everything
SELECT name, setting, unit, context, pending_restart
FROM pg_settings WHERE name = 'work_mem';
SELECT name, setting, source, sourcefile, sourceline -- where did this value come from?
FROM pg_settings WHERE source NOT IN ('default','override');
ALTER SYSTEM SET work_mem = '64MB'; -- persists to postgresql.auto.conf (since 9.4)
ALTER SYSTEM RESET work_mem; -- remove the override
SELECT pg_reload_conf(); -- apply reload-able changes, no downtime
SET work_mem = '128MB'; -- this session only
RESET work_mem; -- back to the configured value
```
```bash
pg_ctl reload -D $PGDATA # SIGHUP — apply reloadable settings (also: systemctl reload)
pg_ctl restart -D $PGDATA # required for some settings (see below)
```
**Reload vs restart** — a setting's `context` in `pg_settings` tells you:
| `context` | How to apply | Examples |
|---|---|---|
| `user` / `superuser` | `SET` in-session, or reload | `work_mem`, `statement_timeout` |
| `sighup` | **reload** (`pg_reload_conf()`) | `log_*`, `autovacuum`, `archive_command`, `checkpoint_timeout`, `max_wal_size` |
| `postmaster` | **restart** | `shared_buffers`, `max_connections`, `listen_addresses`, `port`, `wal_level`, `shared_preload_libraries` |
After editing, `pending_restart = true` in `pg_settings` flags settings that need a restart.
`ALTER SYSTEM` **cannot** set a few bootstrap params (e.g. it warns on settings that have no
effect post-start). Full GUC tour, key parameters, and units: [references/config.md](references/config.md).
## 2. Roles & privileges
Roles are **cluster-global**. A "user" is just a role `WITH LOGIN`.
```sql
CREATE ROLE app LOGIN PASSWORD 'secret'; -- a login user
CREATE ROLE readonly NOLOGIN; -- a group role
CREATE ROLE deployer LOGIN CREATEDB CREATEROLE;
ALTER ROLE app VALID UNTIL '2027-01-01' CONNECTION LIMIT 20;
ALTER ROLE app SET search_path = app, public; -- per-role GUC default
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; -- existing tables only
ALTER DEFAULT PRIVILEGES IN SCHEMA public -- future tables too
GRANT SELECT ON TABLES TO readonly;
GRANT readonly TO app; -- role membership
REVOKE INSERT ON orders FROM app;
```
- **Privileges don't apply retroactively** — `GRANT … ON ALL TABLES` covers tables that exist
*now*; use `ALTER DEFAULT PRIVILEGES` for objects created *later* (and it's per-creator).
- **`public` schema hardening (pg15+):** new clusters **no longer grant `CREATE` on `public`
to `PUBLIC`** (CVE-2018-1058 mitigation). On upgraded clusters, consider
`REVOKE CREATE ON SCHEMA public FROM PUBLIC` yourself.
- **Predefined roles** grant capabilities without superuser: `pg_monitor`,
`pg_read_all_settings`, `pg_read_all_stats`, `pg_signal_backend`, `pg_read_all_data` /
`pg_write_all_data` (pg14+), `pg_database_owner` (pg14+), `pg_checkpoint` (pg15+),
`pg_use_reserved_connections` (pg16+), `pg_create_subscription` (pg16+), `pg_maintain`
(pg17+, with the `MAINTAIN` privilege), `pg_signal_autovacuum_worker` (pg18+).
- **Role membership options (pg16+):** `GRANT g TO u WITH INHERIT {TRUE|FALSE}, SET
{TRUE|FALSE}, ADMIN {TRUE|FALSE}` — membership inheritance is now per-grant, not just the
member's `INHERIT` attribute. (Pre-16, new memberships always inherited per the member role.)
Full role attribute / GRANT / object-privilege reference: [references/auth-roles.md](references/auth-roles.md).
## 3. Authentication (`pg_hba.conf`)
`pg_hba.conf` is matched **top-to-bottom, first match wins** (no fall-through). Format:
```
# TYPE DATABASE USER ADDRESS METHOD
local all all peer # Unix socket, OS-user match
host all all 127.0.0.1/32 scram-sha-256 # TCP, localhost
hostssl app app 10.0.0.0/8 scram-sha-256 # require TLS
host all all 0.0.0.0/0 reject # deny the rest
```
```bash
psql -c "SELECT pg_reload_conf()" # pg_hba changes apply on RELOAD, not restart
psql -c "TABLE pg_hba_file_rules" # see parsed rules + any errors (pg10+)
psql -c "TABLE pg_ident_file_mappings" # parsed pg_ident.conf (pg15+)
```
- **Methods:** `scram-sha-256` (pg10+, the modern default — set `password_encryption =
scram-sha-256`, the **default since pg14**), `md5` (legacy, **deprecated pg18+**), `peer`
(local OS user), `cert` (TLS client cert), `ldap`, `gss`/`sspi`, `radius`, `trust` (no
auth — dev only), `reject`, and `oauth` (pg18+Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.