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/pumarogie/claude-postgres-skills/managing-postgres-connectionsnpx skills add pumarogie/claude-postgres-skills --skill managing-postgres-connectionsgit clone --depth 1 https://github.com/pumarogie/claude-postgres-skillsWrote 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/pumarogie/claude-postgres-skills/managing-postgres-connections)<a href="https://agentmods.dev/skills/pumarogie/claude-postgres-skills/managing-postgres-connections"><img src="https://agentmods.dev/badge/skills/pumarogie/claude-postgres-skills/managing-postgres-connections.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.00048 | $0.00955 |
| Opus 5 | $0.00024 | $0.00477 |
| Sonnet 5 | $0.00010 | $0.00191 |
| Haiku 4.5 | $0.00005 | $0.00096 |
Grade A, and why
managing-postgres-connections 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 4d 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 — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Managing Postgres Connections
Overview
A Postgres connection is a server process with memory and scheduling cost. Bound concurrency across all application instances and preserve an operational reserve. Raising max_connections does not create capacity.
Choose the pooling layer
Prefer PgBouncer when many processes share a database: it enforces one server budget. Use an in-process pool such as Go's pgxpool when necessary, but multiply its maximum by every replica and process.
Use this mode decision for PgBouncer:
| Mode | Use | Required warning |
|---|---|---|
| Transaction (default) | Stateless web/request workloads | A later transaction may use another backend; session state is not preserved |
| Session | Compatible fallback for session-dependent code | Idle clients retain server connections, so multiplexing is less efficient |
| Statement | Rare, independent autocommit statements only | Cannot run multi-statement transactions; unsuitable for most apps |
Transaction pooling breaks assumptions about session-level prepared statements, session-level advisory locks, LISTEN/NOTIFY, session variables, cursors held across transactions, and temporary tables. Use transaction-level locks, SET LOCAL, and transaction-scoped cursors where possible; otherwise use a dedicated session-pooled or direct connection.
For pgx, never assume its implicit prepared-statement cache is compatible with transaction pooling. Either configure and test PgBouncer protocol-level prepared-statement tracking, or disable implicit preparation with a compatible mode such as default_query_exec_mode=exec. Read reference/pgbouncer-pooling-modes.md for the detailed compatibility choices.
Size from the database inward
Always bound the total pool; never maximize it to eliminate waiting. Budget server connections from CPU, memory, storage, and measured concurrency, reserve administration capacity, then divide the remainder among workloads. For ordinary OLTP, start testing near twice the database vCPU count and increase only when measurements show useful I/O wait. Load testing decides the final number.
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 4d ago First seen · 74 lines · 48 tokens per session scan A 2e3e0d4fe138
managing-postgres-connections is a skill published in the GitHub repository pumarogie/claude-postgres-skills (2 stars, last pushed 1mo ago), licensed MIT. It adds 48 tokens to every session and 955 once invoked, about $0.0002 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-31.
Other skills, from other repositories
database-optimizer
Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
postgres-pro
Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features. Invoke for EXPLAIN analysis, JSONB operations, extension usage, VACUUM tuning, performance monitoring.
postgres-database-migration
Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…
design-postgis-tables
Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications.
migrate-postgres-tables-to-hypertables
Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. Trigger when user asks to: Migrate or convert PostgreSQL tables to hypertables Execute hypertable migration with minimal downtime Plan blue-green migration for large tables Validate…
pgvector-semantic-search
Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. Trigger when user asks to: Store or search vector embeddings in PostgreSQL Set up semantic search, similarity search, or nearest neighbor search Create HNSW or IVFFlat indexes for vectors…