Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/sawrus/agent-guides/postgres-operationsnpx skills add sawrus/agent-guides --skill postgres-operationsgit clone --depth 1 https://github.com/sawrus/agent-guidesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sawrus/agent-guides/postgres-operations)<a href="https://agentmods.dev/skills/sawrus/agent-guides/postgres-operations"><img src="https://agentmods.dev/badge/skills/sawrus/agent-guides/postgres-operations.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00028 | $0.01121 |
| Opus 5 | $0.00014 | $0.00561 |
| Sonnet 5 | $0.00006 | $0.00224 |
| Haiku 4.5 | $0.00003 | $0.00112 |
Grade A, and why
postgres-operations scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 157 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Skill: PostgreSQL Operations
Expertise: PostgreSQL health, vacuuming, lock analysis, PITR, WAL archiving, PgBouncer, K8s-hosted PostgreSQL.
When to load
When investigating a slow database, diagnosing lock waits, running PITR recovery, or managing a PostgreSQL instance.
Health Check Commands
-- Database size overview
SELECT
datname,
pg_size_pretty(pg_database_size(datname)) AS size,
numbackends AS active_connections
FROM pg_stat_database
ORDER BY pg_database_size(datname) DESC;
-- Table sizes (top 20)
SELECT
schemaname || '.' || tablename AS table,
pg_size_pretty(pg_total_relation_size(schemaname || '.' || tablename)) AS total_size,
pg_size_pretty(pg_relation_size(schemaname || '.' || tablename)) AS table_size,
pg_size_pretty(pg_indexes_size(schemaname || '.' || tablename)) AS index_size
FROM pg_tables
ORDER BY pg_total_relation_size(schemaname || '.' || tablename) DESC
LIMIT 20;
-- Replication lag (primary)
SELECT
client_addr,
state,
pg_size_pretty(pg_wal_lsn_diff(sent_lsn, replay_lsn)) AS replication_lag
FROM pg_stat_replication;
Lock Investigation
-- Active locks and blocking queries
SELECT
blocking.pid AS blocking_pid,
blocking.query AS blocking_query,
blocked.pid AS blocked_pid,
blocked.query AS blocked_query,
blocked.wait_event_type,
blocked.wait_event
FROM pg_stat_activity blocking
JOIN pg_stat_activity blocked
ON blocked.wait_event_type = 'Lock'
AND blocking.pid != blocked.pid
WHERE blocking.state = 'active';
-- Kill blocking query (confirm before running!)
SELECT pg_terminate_backend(<blocking_pid>);
-- Long-running queries (> 5 min)
SELECT pid, now() - pg_stat_activity.query_start AS duration, query, state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'
AND state = 'active';
VACUUM and Bloat
-- Check autovacuum health
SELECT
schemaname || '.' || relname AS table,
last_autovacuum,
last_autoanalyze,
n_dead_tup,
n_live_tup,
round(n_dead_tup::numeric / NULLIF(n_live_tup + n_dead_tup, 0) * 100, 2) AS dead_pct
FROM pg_stat_user_tables
ORDER BY n_dead_tup DESC
LIMIT 20;
-- Manual VACUUM ANALYZE (non-blocking)
VACUUM ANALYZE VERBOSE orders;
-- VACUUM FULL (rewrites table — locks! use with maintenance window)
VACUUM FULL orders;
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 157 lines · 28 tokens per session scan A f9067c3b7258
postgres-operations is a skill published in the GitHub repository sawrus/agent-guides (17 stars, last pushed 3d ago), licensed MIT. It adds 28 tokens to every session and 1,121 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
deprecation-and-migration
Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset…
db
Connect to any database — Cloud SQL, PostgreSQL, Snowflake, Databricks, Athena, Presto, or Oracle.
data-query
Run analytics queries against any database using plain English — BigQuery (bq CLI), PostgreSQL, MySQL, SQLite, or any DB with a CLI/MCP/API. Use when you need to pull metrics, analyze data, or answer business questions without writing SQL.
database-migration-guardian
Activate when writing, reviewing, or applying database migrations in PostgreSQL, MySQL, Prisma, or Drizzle to prevent table locks, zero-downtime failures, and data loss — trigger phrasings include "review this database migration", "how do I add a NOT NULL column without downtime", "write a safe PostgreSQL migration"…
db-architect
Activate when a developer needs to model relational schemas, parse SQL DDL statements, generate Mermaid Entity-Relationship Diagrams (ERD), analyze primary/foreign key relationships, or normalize database tables — trigger phrasings include "generate an ERD for my database", "convert this SQL schema to Mermaid"…
devops-vercel-render-deploy
Activate when deploying web applications, Next.js frontends, Node/Python backends, or PostgreSQL databases to cloud hosting platforms (Vercel, Render, Supabase, Railway) — trigger phrasings include "deploy my project to Vercel", "how do I host this Next.js app", "deploy backend to Render", "setup Supabase database"…