postgres-aiops
FreeNo executable scriptsNot checkedUse this skill whenever the user needs to operate or troubleshoot a PostgreSQL server/cluster as a DBA — a one-shot cluster health overview; server reads…
by zw0081,862 installs in other catalogsAbout this skill
Postgres AIops
Audit availability: Real writes require a durable audit intent. Reads and previews can continue if audit storage fails; check the warning and audit health before relying on their audit trail.
Disclaimer: Community-maintained open-source project, not affiliated with, endorsed by, or sponsored by the PostgreSQL Global Development Group or any vendor. "PostgreSQL" and related trademarks belong to their owners. Source at github.com/AIops-tools/Postgres-AIops under the MIT license.
Governed PostgreSQL DBA operations — 35 MCP tools, every one wrapped with the bundled @governed_tool harness: a local unified audit log under ~/.postgres-aiops/, token/runaway budget guard, undo-token recording, and descriptive risk-tier labels. The role password is stored encrypted (~/.postgres-aiops/secrets.enc, Fernet + scrypt) — never plaintext on disk.
Standalone: the governance harness is bundled in the package (
postgres_aiops.governance) — postgres-aiops has no external skill-family dependency. Beyond the mock suite, the reads plus a governed write and its undo have been exercised against a live PostgreSQL 16.14 instance (seedocs/VERIFICATION.md).
What This Skill Does
| Domain | Tools | Count | Read or Write |
|---|---|---|---|
| Overview | cluster health snapshot | 1 | 1 read |
| Server | version, settings, extensions, databases, roles | 5 | 5 read |
| Activity | sessions, long-running queries, locks | 3 | 3 read |
| Queries | top-N (pg_stat_statements), EXPLAIN | 2 | 2 read |
| Indexes | unused, missing hints, bloat, invalid/duplicate | 4 | 4 read |
| Tables | sizes, dead-tuple bloat, autovacuum status | 3 | 3 read |
| Replication | status/lag, slots, WAL | 3 | 3 read |
| Analysis (flagship) | slow-query RCA, bloat/vacuum, blocking chains | 3 | 3 read |
| Writes | terminate, cancel, drop-index | 3 | 3 write (high) |
| vacuum, analyze, create-index, reindex, ALTER SYSTEM, reset-stats | 6 | 6 write (medium) |
The flagship analyses accept injected records for pure/offline analysis, or pull live from a configured target. top_queries / slow_query_rca require the pg_stat_statements extension; the read role should have pg_monitor.
Quick Install
uv tool install postgres-aiops
postgres-aiops init # interactive wizard: connection + encrypted password
postgres-aiops doctor
Or as an OpenClaw plugin, which installs this skill and its MCP server together:
openclaw plugins install clawhub:@zw008/postgres-aiops
openclaw skills info postgres-aiops # expect: Visible to model: yes
Needs uvx on PATH: the MCP server is fetched with uv, pinned to this release.
When to Use This Skill
- Triage a cluster (
overview): version/uptime, connections by state, idle-in-transaction, longest query, worst bloat, replica lag - Root-cause a slow query (
analyze slow-query/slow_query_rca): the worstpg_stat_statementsentry + EXPLAIN → cited cause and action - Decide what to vacuum (
analyze bloat-vacuum/bloat_and_vacuum_analysis): tables ranked by dead-tuple ratio + autovacuum lag - Untangle a lock pile-up (
analyze blocking/blocking_lock_chain_rca): the wait-for tree with the root blocker named - Find unused / missing / bloated indexes; check autovacuum status and table sizes; inspect replication lag and slots
- Terminate/cancel a backend, VACUUM/ANALYZE, create/drop an index (reversible), REINDEX, or ALTER SYSTEM SET — all with dry-run + double-confirm
Do NOT use when the target is OT/industrial equipment (use industrial-aiops), a hypervisor, a storage appliance, a backup product, a container cluster, or a non-PostgreSQL database.
Related Skills — Skill Routing
| If the user wants… | Use |
|---|---|
| PostgreSQL DBA-ops: slow queries, bloat, locks, index/vacuum maintenance | postgres-aiops (this skill) |
| OT / industrial edge (Modbus, OPC-UA, PLC, PROFINET) | the industrial-aiops line |
| Hypervisor VM lifecycle (power, snapshot, migrate) | a hypervisor ops skill |
| Container/cluster lifecycle | a cluster ops skill |
Common Workflows
"The app got slow this afternoon" — root-cause and add the missing index
postgres-aiops overview→ one-shot cluster picture: connections, database sizes, obvious saturationpostgres-aiops analyze slow-query→ the worstpg_stat_statementsentry with cited findings (seq scan, low cache-hit ratio, temp spill, high call count) and a concrete action for eachpostgres-aiops query explain "<sql>"→ confirm the plan yourself; a Seq Scan on a large table is the index signalpostgres-aiops index missing→ the tool's own index hints, to cross-check that step 3's conclusion is not a one-offpostgres-aiops remediate create-index <table> <col> --concurrently --dry-run→ preview the exact DDL; then run without `--
Install postgres-aiops in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
BashFAQ
What does the postgres-aiops skill do?
Use this skill whenever the user needs to operate or troubleshoot a PostgreSQL server/cluster as a DBA — a one-shot cluster health overview; server reads (version/uptime, settings, extensions, databases, roles); activity (sessions, idle-in-transaction, long-running queries, locks); query stats (pg_stat_statements top-N, EXPLAIN a statement); index health (unused indexes, missing-index hints, bloat, invalid/duplicate); table health (sizes, dead-tuple bloat, autovacuum status); replication (standby lag, replication slots, WAL); three flagship analyses — slow-query RCA (worst pg_stat_statements entry + EXPLAIN → cause/action), bloat & vacuum analysis (dead tuples + autovacuum lag → recommendation), and blocking lock-chain RCA (build the wait-for tree, name the root blocker); and guarded writes (terminate a backend, cancel a query, VACUUM/ANALYZE, create/drop an index, REINDEX, ALTER SYSTEM SET a parameter, reset query stats). Always use this skill for "postgres health check", "why is this query slow", "pg_stat_statements top queries", "EXPLAIN this", "table/index bloat", "which indexes are unused", "missing index", "autovacuum status", "who is blocking whom", "kill the backend holding the lock", "replication lag", "replication slots", "VACUUM this table", "create/drop an index", or "ALTER SYSTEM SET work_mem" when the context is a PostgreSQL database. Do NOT use when the target is OT / industrial equipment (Modbus, OPC-UA, PLCs — use industrial-aiops), a hypervisor, a storage appliance, a backup product, a container/cluster orchestrator, or a non-PostgreSQL database (negative routing hints only). Covers common PostgreSQL DBA operations with a built-in governance harness (audit, token budget, undo, risk-tiers). Beyond the mock suite, the reads plus a governed write and its undo have been exercised against a live PostgreSQL 16.14 instance (see docs/VERIFICATION.md).
How do I install the postgres-aiops skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the postgres-aiops skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic