{"slug":"postgres-2","title":"postgres","summary":"Operate PostgreSQL instances safely: configuration review, index and query-plan analysis, vacuum and bloat management, WAL archiving and point-in-time recovery, replication and failover, extensions, major-version upgrades, and evidence-based diagnostics with the bundled read-only","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-08T21:25:11.868088Z","repo":{"url":"https://github.com/magnus919/agent-skills","stars":96,"forks":9,"license":"MIT","updatedAt":"2026-09-25T05:53:13Z"},"bodyHtml":"<h1>PostgreSQL — Operational Skill for PostgreSQL</h1>\n<p>Operate PostgreSQL safely: configuration review, index and query-plan analysis, vacuum and bloat management, WAL archiving and point-in-time recovery, replication and failover, extensions, major-version upgrades, and diagnostics with evidence.</p>\n<h2>Why Install This Skill</h2>\n<p>Your agent can run PostgreSQL operations instead of guessing: review configuration against the workload, find the index and query-plan evidence behind a slow query, verify that autovacuum is keeping up, check that WAL archiving is actually working (not just configured), measure replication lag, plan a failover or a major-version upgrade, and diagnose incidents in a fixed evidence order.</p>\n<p>It ships a read-only diagnostic script (<code>pgdiag</code>) that collects the operator-critical evidence in one bounded JSON payload — server version, configuration values, connection pressure, index usage, bloat signals, archiver health, replication state, extensions, and database sizes. Every session opens read-only (<code>default_transaction_read_only=on</code>), so the tool cannot mutate anything even by mistake, and <code>--help</code> works with no cluster and no psql installed.</p>\n<p>The references are distilled from the official PostgreSQL documentation with dated sources and verification-first guidance. Schema design, application-level data access, and cross-engine methodology deliberately route to the skills that own them (<code>data-architect</code>, <code>backend-engineering</code>, <code>data-engineering</code>); this skill owns the day-to-day operation of PostgreSQL itself.</p>\n<h2>What You Get</h2>\n<table>\n<thead>\n<tr>\n<th>Directory</th>\n<th>Purpose</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>SKILL.md</code></td>\n<td>Agent-facing operating loop, mutation gates, and verification boundaries</td>\n</tr>\n<tr>\n<td><code>references/</code></td>\n<td>Nine dated references: configuration, indexes/plans, vacuum/bloat, backups/WAL/PITR, replication/failover, extensions, upgrades, diagnostics, source index</td>\n</tr>\n<tr>\n<td><code>scripts/pgdiag</code></td>\n<td>Read-only diagnostic collector: stdlib-only Python, <code>--json</code>, <code>--check</code> subsets, <code>--plan-for</code> (EXPLAIN JSON), <code>--help</code> without a cluster</td>\n</tr>\n<tr>\n<td><code>tests/</code></td>\n<td>Deterministic tests against a fake psql stub, including the read-only contract</td>\n</tr>\n<tr>\n<td><code>evals/evals.json</code></td>\n<td>Six output-quality evaluation cases for agent runs</td>\n</tr>\n</tbody>\n</table>\n<h2>Quick Start</h2>\n<pre><code># Help works with no cluster and no psql installed\nscripts/pgdiag --help\n\n# Full read-only diagnostics, machine-readable\nscripts/pgdiag --json\n\n# Against a specific instance\nscripts/pgdiag --host db1.example.com --dbname app --user ops --json\n\n# Targeted checks\nscripts/pgdiag --check identity --check wal_archive --check replication --json\n\n# Add an EXPLAIN plan for one read-only statement\nscripts/pgdiag --plan-for \"SELECT * FROM orders WHERE id = 42\" --json\n</code></pre>\n<p>The script shells out to <code>psql</code> (override the binary with <code>--psql /path/to/psql</code>; connection defaults come from the usual <code>PGHOST</code>/<code>PGPORT</code>/<code>PGUSER</code>/<code>PGDATABASE</code> environment variables or the flags above). Exit codes: 0 ok, 1 runtime/collection error, 2 usage error, 127 psql not found, 124 timeout.</p>\n<h2>Triggers</h2>\n<p>Load this skill for <code>postgres</code>/<code>PostgreSQL</code>/<code>psql</code> operations: configuration review and <code>postgresql.conf</code> tuning, slow queries and <code>EXPLAIN</code> plan analysis, index usage measurement, vacuum and bloat, WAL archiving and point-in-time recovery, backups and restore drills, replication and standby lag, failover planning, extension installs and upgrades, minor or major version upgrades (<code>pg_upgrade</code>), or any PostgreSQL incident that needs evidence-first diagnosis. Do not load it for application data-access code (that's <code>backend-engineering</code>), schema design (that's <code>data-architect</code>/<code>data-engineering</code>), Supabase platform administration (that's <code>supabase</code>), or other database engines (those stay in <code>data-engineering</code>).</p>\n<h2>Requirements</h2>\n<ul>\n<li>Python 3.9+ for the <code>pgdiag</code> script (<code>--help</code> needs nothing else).</li>\n<li>The <code>psql</code> client (PostgreSQL 10+ server) for live diagnostics; it must be on <code>PATH</code> or passed with <code>--psql</code>.</li>\n<li>Socket or network access to the target instance and, for read-only diagnostics, a role that can read the system catalogs and statistics views.</li>\n</ul>\n","files":[{"path":"evals/evals.json","sizeBytes":11563,"isText":true},{"path":"README.md","sizeBytes":4061,"isText":true},{"path":"references/00-source-index.md","sizeBytes":2999,"isText":true},{"path":"references/01-configuration.md","sizeBytes":3865,"isText":true},{"path":"references/02-indexes-and-query-plans.md","sizeBytes":3536,"isText":true},{"path":"references/03-vacuum-and-bloat.md","sizeBytes":3288,"isText":true},{"path":"references/04-backups-wal-pitr.md","sizeBytes":4022,"isText":true},{"path":"references/05-replication-and-failover.md","sizeBytes":3736,"isText":true},{"path":"references/06-extensions.md","sizeBytes":2917,"isText":true},{"path":"references/07-upgrades.md","sizeBytes":3357,"isText":true},{"path":"references/08-diagnostics.md","sizeBytes":3720,"isText":true},{"path":"scripts/pgdiag","sizeBytes":15213,"isText":false},{"path":"SKILL.md","sizeBytes":16078,"isText":true},{"path":"tests/test_pgdiag.py","sizeBytes":7517,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-08T21:27:34.002893Z","sha256":"4EAA174E50082FF77D239C6ECB461D5B53C7AC3C9A4DA8D28CD1556507AB9857","sizeBytes":35336},"review":null,"source":{"repositoryUrl":"https://github.com/magnus919/agent-skills","path":"postgres","license":"MIT","commit":"1a7d5757db23474b58b4a5588356e09bd0ac5886","subtreeSha":"7C0FF6B58110B805697625E06ADE5B6FB23634978A714F8DCAFB517B7AFC57DA","lastSyncedAt":"2026-09-25T06:49:43.852966Z"},"reviewedAt":"2026-09-08T21:31:42.930207Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/magnus919/agent-skills/tree/main/postgres"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/magnus919/agent-skills.git"}]}