postgres-aiops
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).
Rank
62
Safety
84
Downloads
1.4k
Updated
Oct 10, 2026
Version
0.10.3
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.4K downloadsadoption · observed Oct 10, 2026
- Latest release
- 0.10.3release · observed Sep 15, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s171xgnmqse0nqvgqvqnaq5f9183kyre:postgres-aiops- Install using `clawhub skill install s171xgnmqse0nqvgqvqnaq5f9183kyre:postgres-aiops` in an isolated environment before connecting it to live workloads.
- No published capability contract is available yet, so validate auth and request/response behavior manually.
- Review the upstream CLAWHUB listing at https://clawhub.ai/zw008/postgres-aiops before using production credentials.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-zw008-postgres-aiops/snapshot"
Documentation
CLAWHUB
149,442 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: postgres-aiops
slug: postgres-aiops
displayName: "Postgres AIops"
summary: "Governed PostgreSQL DBA ops: slow-query RCA, bloat/vacuum & blocking-lock analysis; 35 MCP tools."
license: MIT
homepage: https://github.com/AIops-tools/Postgres-AIops
tags: [aiops, mcp, governance, postgres]
description: >
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).
installer:
kind: uv
package: postgres-aiops
argument-hint: "[pid / table / index name or describe your DBA task]"
allowed-tools:
- Bash
metadata: {"openclaw":{"requires":{"anyBins":["postgres-aiops","uvx"]},"optional":{"env":["POSTGRES_AIOPS_CONFIG","POSTGRES_AIOPS_MASTER_PASSWORD"]},"homepage":"https://github.com/AIops-tools/Postgres-AIops","emoji":"🐘","os":["macos","linux"]}}
compatibility: >
Standalone, self-governed PostgreSQL DBA operations. The governance harness (audit, token/runaway budget, undo, risk-tiers) is bundled in the package — no external skill-family dependency. Connects via psycopg 3 and reads the system catalogs and pg_stat_* views.
All write operations are audited to a local SQLite DB under ~/.postgres-aiops/ (relocatable via POSTGRES_AIOPS_HOME)_meta.json
{
"ownerId": "kn7b067awq2s97bn3d7p5qfhw5827pxc",
"slug": "postgres-aiops",
"version": "0.10.3",
"publishedAt": 1789452914292
}references/agent-guardrails.md
# Agent guardrails — running postgres-aiops with a smaller / local model
If you drive these tools with a local model (Llama, Qwen, Mistral … via Goose,
Ollama, LM Studio, or any OpenAI-compatible runtime), you will get noticeably
better results with a short system prompt. This page gives you one, and — more
importantly — tells you which guardrails you **no longer need to write**, because
the tool now enforces them itself.
The distinction matters. A guardrail in a prompt is a request. A guardrail in the
harness is a guarantee. Anything below that we could move into the harness, we did.
## What the tool now enforces — do not waste prompt budget on these
| You might be tempted to prompt | Why you don't need to |
|---|---|
| "Don't invent a value when a field is missing" | A column the server returned as SQL `NULL` comes back as `null`, never as `""`. `lastAutovacuum: null` means the table was *never* autovacuumed; `unit: null` means the setting is not a numeric quantity; `plugin: null` means the replication slot is physical, not logical. Absent and empty are distinguishable in the payload. |
| "Tell me if the output was cut off" | Anything with a `limit` returns `{"statements": [...], "returned": N, "limit": L, "truncated": true/false}`. Truncation is **measured** — one extra row is fetched — not guessed from the row count happening to equal the limit. An analysis that pulled a truncated read also carries `sourceTruncated`. |
| "Preserve the ordering / tell me what's most urgent" | Ranked reads are already ordered worst-first (`table_bloat` by dead tuples, `index_bloat` by estimated bloat, `blocking_lock_chain_rca` by how many backends a root blocker holds up), and every finding cites the number that triggered it. |
| "Confirm before anything destructive" | Destructive operations require a `--dry-run`-able preview + double confirmation at the CLI for high-risk tiers such as `terminate_backend` and `drop_index`. |
| "Log what you did" | Every call is audited to `~/.postgres-aiops/audit.db` regardless of what the model says it did. Reversible writes (`create_index`, `drop_index`, `update_setting`) also record an undo token capturing the pre-change state. |
**Authorization is not this tool's job.** Whether a write is permitted is decided by the account
you connect it with (connect with a PostgreSQL role that has no write privileges — a read-only
role, or one without INSERT/UPDATE/DELETE/DDL — and the write fails at the server) or by your
agent's prompt. `POSTGRES_AUDIT_APPROVED_BY` / `POSTGRES_AUDIT_RATIONALE` are optional annotations
recorded on the audit row; they are never required and never block a call.
## What still needs a prompt
These are model-behaviour problems the harness cannot fix from the outside.
Copy this into your agent's system prompt:
```text
You operate a PostgreSQL server through the postgres-aiops MCP tools.
TOOL USE
- Before answering any question about the current database, you MUST call a
tool. Never answer from memoreferences/capabilities.md
# postgres-aiops capabilities
> 35 MCP tools (25 read, 10 write). Catalog / `pg_stat_*` queries have been
> exercised against a live PostgreSQL 16.14 instance (see docs/VERIFICATION.md).
> `top_queries` / `slow_query_rca` require the `pg_stat_statements` extension;
> the read role should have `pg_monitor`.
## Read tools (25)
| Tool | Source | Returns |
|------|--------|---------|
| `overview` | several reads (resilient) | version, uptime, connections by state, idleInTransaction, longestQuery, worstBloatTable, replicas |
| `server_version` | `version()`, `pg_postmaster_start_time()` | version, serverVersion, uptime, inRecovery, dataDirectory |
| `show_settings` | `pg_settings` | name, setting, unit, category, context, source, pendingRestart |
| `list_extensions` | `pg_extension` + available | name, installedVersion, defaultVersion, updateAvailable |
| `list_databases` | `pg_database` | name, owner, encoding, sizeBytes, sizePretty |
| `list_roles` | `pg_roles` | name, superuser, canLogin, replication, connLimit |
| `list_activity` | `pg_stat_activity` | total, byState, idleInTransaction[], sessions[] |
| `long_running_queries` | `pg_stat_activity` | thresholdSeconds, count, queries[] (oldest first) |
| `list_locks` | `pg_locks`⋈`pg_stat_activity` | total, waitingCount, waiting[], locks[] |
| `top_queries` | `pg_stat_statements` | orderBy, statements[] (calls, total/mean ms, cacheHitRatioPct) |
| `explain_query` | `EXPLAIN (FORMAT JSON)` | analyze, plan (JSON) |
| `unused_indexes` | `pg_stat_user_indexes` | count, reclaimableBytes, indexes[] (idx_scan=0) |
| `missing_index_hints` | `pg_stat_user_tables` | tables[] with high seq_scan vs idx_scan |
| `index_bloat` | `pg_class`/`pg_index` | indexes[] with estBloatBytes/estBloatPct (coarse) |
| `invalid_indexes` | `pg_index` | invalid[], duplicates[] |
| `table_sizes` | `pg_class` | tables[] total/table/index/toast bytes |
| `table_bloat` | `pg_stat_user_tables` | tables[] deadPct (dead/(live+dead)) |
| `autovacuum_status` | `pg_stat_user_tables` | dead tuples, modSinceAnalyze, last (auto)vacuum/analyze |
| `replication_status` | `pg_stat_replication` | replicas[] with replayLagBytes |
| `replication_slots` | `pg_replication_slots` | slots[], inactive[] (retain WAL) |
| `wal_status` | WAL fns + `pg_stat_archiver` | currentLsn, walLevel, max/minWalSize, archiver |
| `slow_query_rca` | pg_stat_statements + EXPLAIN | worst{}, findings[] (cited cause/action) |
| `bloat_and_vacuum_analysis` | table-bloat rows | recommendations[] (cited reasons + action) |
| `blocking_lock_chain_rca` | `pg_blocking_pids` pairs | roots[], worstRootPid, deadlockSuspected |
| `undo_list` | local undo store | recorded, not-yet-applied reversible writes: undoId, ts, originalTool, inverseTool, note |
The flagship analyses accept injected records (`statements=` / `tables=` /
`pairs=`) for pure/offline analysis, or pull live from a configured `target`.
## Write tools (10)
| Tool | Risk | SQL | Undo / safety |
|------|------|---references/cli-reference.md
# postgres-aiops CLI reference > Catalog / `pg_stat_*` queries have been exercised against a live PostgreSQL 16.14 instance > (see docs/VERIFICATION.md). ## Setup & diagnostics ```bash postgres-aiops init # interactive onboarding wizard postgres-aiops doctor [--skip-auth] # config + secret store + connectivity (SELECT version()) postgres-aiops overview [--target <t>] # one-shot cluster health snapshot postgres-aiops mcp # start the MCP server (stdio transport) ``` ## Secrets (encrypted store ~/.postgres-aiops/secrets.enc) ```bash postgres-aiops secret set <target> [--value <pw>] # store password (hidden prompt if no --value) postgres-aiops secret list # names only — values never shown postgres-aiops secret rm <target> postgres-aiops secret migrate # import legacy plaintext .env (PG_<T>_PASSWORD) postgres-aiops secret rotate-password # re-encrypt under a new master password ``` ## Read commands ```bash postgres-aiops server version # version, uptime, recovery state postgres-aiops server settings [pattern] # pg_settings (optional name filter) postgres-aiops server databases # databases + sizes postgres-aiops server roles postgres-aiops server extensions postgres-aiops activity list [--state active] # pg_stat_activity + per-state counts postgres-aiops activity long [--min-seconds 60] postgres-aiops activity locks postgres-aiops query top [--order-by total_time] [--limit 20] # pg_stat_statements postgres-aiops query explain "<sql>" [--analyze] postgres-aiops index unused # zero-scan indexes postgres-aiops index missing # missing-index hints postgres-aiops index bloat [--limit 50] postgres-aiops index invalid # invalid + duplicate postgres-aiops table sizes [--limit 20] postgres-aiops table bloat [--limit 50] # dead-tuple bloat proxy postgres-aiops table autovacuum [--limit 50] postgres-aiops repl status # standby lag postgres-aiops repl slots postgres-aiops repl wal postgres-aiops analyze slow-query [--explain "<sql>"] [--limit 20] # flagship RCA postgres-aiops analyze bloat-vacuum [--limit 50] postgres-aiops analyze blocking ``` ## Write commands (governed; risk tier in parentheses) ```bash postgres-aiops remediate terminate <pid> [--dry-run] # (high) no undo; double confirm postgres-aiops remediate cancel <pid> [--dry-run] # (high) no undo; double confirm postgres-aiops remediate drop-index <name> [--concurrently] [--dry-run] # (high) reversible; double confirm postgres-aiops remediate vacuum <table> [--full] [--analyze] [--dry-run] # (medium) postgres-aiops remediate analyze-table <table> [--dry-run] # (medium) postgres-aiops remediate create-index <table> <cols...> [--name N] [--unique] [--concurrently] [--dry-run] # (medium) reversible postg
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/zw008/skills/postgres-aiops",
"sourceUrl": "https://clawhub.ai/zw008/skills/postgres-aiops",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T12:45:12.703Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-zw008-postgres-aiops/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-zw008-postgres-aiops/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T12:45:12.703Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.4K downloads",
"href": "https://clawhub.ai/zw008/postgres-aiops",
"sourceUrl": "https://clawhub.ai/zw008/postgres-aiops",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T12:45:12.703Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.10.3",
"href": "https://clawhub.ai/zw008/postgres-aiops",
"sourceUrl": "https://clawhub.ai/zw008/postgres-aiops",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-09-15T06:15:14.292Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-zw008-postgres-aiops/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-zw008-postgres-aiops/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.10.3",
"description": "- Removed the sample skill-card.md file from the package. - No changes to features or functionality.",
"href": "https://clawhub.ai/zw008/postgres-aiops",
"sourceUrl": "https://clawhub.ai/zw008/postgres-aiops",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-09-15T06:15:14.292Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
