connection-pool-tuner

connection-pool-tuner is a skill for Claude Code, Codex from SkillMedev/skills. It costs 134 tokens per session (1,246 once invoked), scanned A, original, MIT.

A troubleshooting process for database connection pools, which are groups of reusable connections shared by an application. It uses database activity and application pool settings to find why requests wait for or run out of connections.

In plain words
What is it for?
Use it to investigate connection checkout timeouts, database “too many clients” errors, pool sizes across application replicas, timeouts, and PgBouncer settings.
Why use it?
It distinguishes leaked connections, slow queries, long-running transactions, and oversized pools instead of simply increasing the database limit. This helps avoid making overload worse.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to investigate connection checkout timeouts, database “too many clients” errors, pool sizes across application replicas, timeouts, and PgBouncer settings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skillmedev/skills/connection-pool-tuner
Install

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.

Any agent
npx skills add SkillMedev/skills --skill connection-pool-tuner
Clone the repo
git clone --depth 1 https://github.com/SkillMedev/skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for connection-pool-tuner

README.md
[![agentmods](https://agentmods.dev/badge/skills/skillmedev/skills/connection-pool-tuner/github.svg)](https://agentmods.dev/skills/skillmedev/skills/connection-pool-tuner)
Your own site
<a href="https://agentmods.dev/skills/skillmedev/skills/connection-pool-tuner"><img src="https://agentmods.dev/badge/skills/skillmedev/skills/connection-pool-tuner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for connection-pool-tuner

Your own site · 80×15
<a href="https://agentmods.dev/skills/skillmedev/skills/connection-pool-tuner"><img src="https://agentmods.dev/badge/skills/skillmedev/skills/connection-pool-tuner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 134 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,246 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00134 $0.01246
Opus 5.5 $0.00054 $0.00498
Sonnet 5.5 $0.00027 $0.00249
Haiku 4.5 $0.00013 $0.00125

Measured 11d ago against content hash 083cd88447f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

connection-pool-tuner 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 11d 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.

skills/connection-pool-tuner/SKILL.md · 53 lines

How it starts

The opening of the file, as written. The whole thing — 53 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Connection Pool Tuner

Pool exhaustion shows up as checkout timeouts and "too many clients" errors; the fix is almost never "raise max_connections." Diagnose from evidence first, then size to the database.

Workflow

  1. Capture the evidence before touching any number. Query pg_stat_activity grouped by state under load. Record total connections, count per state, and the longest-running query/transaction age. Also record every pool that points at the DB: app replicas times per-replica pool size, plus migrations and any superuser sessions.

  2. Classify the failure from the evidence:

    • Many idle in transaction rows -> code opens a transaction and does slow work (an HTTP call, sleep, batch) before commit. Fix the transaction scope, not the pool.
    • Many active long-runners -> slow queries saturating connections. Tune the queries.
    • Checkout/acquire timeouts while DB connections sit mostly idle -> the app pool is too small or connections leak (not returned to the pool). Find the leak before enlarging.
    • Total connections at or above max_connections -> the sum of pools is too large; reduce per-replica pool or front with a proxy. Do not raise max_connections.
  3. Size the pool to the database, not the app. Postgres performs best at a small connection count; each backend is a process with real memory cost. Target tens of active connections, not thousands; a common ceiling is roughly (core_count * 2) + effective_spindle_count. The sum of all pools must stay under max_connections with headroom for migrations and superuser - keep at least 10-15% of max_connections free. Twenty replicas with a pool of 20 each is 400 connections - usually far too many.

  4. Set timeouts that fail fast. Set a pool checkout/acquire timeout (2-5s) so a request errors instead of piling up. Set idle_in_transaction_session_timeout (30-60s is a sane starting range for web workloads) to kill stuck transactions. Set statement_timeout to cap runaway queries - anchor it to your slowest legitimate query plus headroom, often 30s for OLTP paths. In HikariCP, set connectionTimeout and keep maxLifetime a minute or two below the DB/proxy idle cutoff so you never hand out a dead socket.

Read the full file on GitHub · 53 lines

Changes

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.

  1. 11d ago Changed · +2 lines · +1 tokens per session 083cd88447f6
  2. 1mo ago First seen · 51 lines · 133 tokens per session scan A 2e7edc6066af

Subscribe to this mod's changes

connection-pool-tuner is a skill published in the GitHub repository SkillMedev/skills (19 stars, last pushed 3d ago), licensed MIT. It adds 134 tokens to every session and 1,246 once invoked, about $0.0005 per session on Opus 5.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-09-03.

Related

Other skills, from other repositories

ecto-constraint-debug

Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.

oliver-kriska/claude-elixir-phoenix · 36 tokens

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.

Jeffallan/claude-skills · 54 tokens

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.

Jeffallan/claude-skills · 41 tokens

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…

timescale/pg-aiguide · 220 tokens

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

timescaledb-hyperfunctions

Use this skill when writing analytical SQL over time-series data with the TimescaleDB Toolkit (timescaledbtoolkit extension) hyperfunctions: approximate percentiles, statistical summaries, time-weighted averages, counter/gauge rates, uptime/heartbeat tracking, state durations, OHLC candlesticks, approximate distinct…

timescale/pg-aiguide · 298 tokens