prisma-connection-pool-exhaustion

prisma-connection-pool-exhaustion is a skill for Claude Code from ckorhonen/claude-skills. It costs 100 tokens per session (1,160 once invoked), scanned A, a copy of prisma-connection-pool-exhaustion, MIT.

A troubleshooting guide for Prisma database connection pools in serverless apps, where each short-lived function may open its own database connections.

In plain words
What is it for?
Use it to investigate Prisma timeout and “too many connections” errors with PostgreSQL, MySQL, and managed databases on platforms such as Vercel, AWS Lambda, and Netlify.
Why use it?
It helps explain why an app works locally but runs out of database connections in production, especially during traffic spikes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code.

Part of the claude-skills plugin — 62 skills, 4 commands, 7 agents shipped together

Good fit Use it to investigate Prisma timeout and “too many connections” errors with PostgreSQL, MySQL, and managed databases on platforms such as Vercel, AWS Lambda, and Netlify.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion
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 ckorhonen/claude-skills --skill prisma-connection-pool-exhaustion
Clone the repo
git clone --depth 1 https://github.com/ckorhonen/claude-skills

Made for: Claude Code.

Or install claude-skills, the plugin that ships this one along with the rest of its 62 skills, 4 commands, 7 agents.

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 prisma-connection-pool-exhaustion

README.md
[![agentmods](https://agentmods.dev/badge/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion/github.svg)](https://agentmods.dev/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion)
Your own site
<a href="https://agentmods.dev/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion"><img src="https://agentmods.dev/badge/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion/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 prisma-connection-pool-exhaustion

Your own site · 80×15
<a href="https://agentmods.dev/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion"><img src="https://agentmods.dev/badge/skills/ckorhonen/claude-skills/prisma-connection-pool-exhaustion.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,160 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 100% copy Near-identical to another mod 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.00100 $0.01160
Opus 5 $0.00050 $0.00580
Sonnet 5 $0.00020 $0.00232
Haiku 4.5 $0.00010 $0.00116

Measured 12d ago against content hash 5d9610dfbbf1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

prisma-connection-pool-exhaustion 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 12d 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.

Origin

This is a copy

100% identical to prisma-connection-pool-exhaustion — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/continuous-learning/examples/prisma-connection-pool-exhaustion/SKILL.md · 162 lines

How it starts

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

Prisma Connection Pool Exhaustion in Serverless

Problem

Serverless functions create a new Prisma client instance on each cold start. Each instance opens multiple database connections (default: 5 per instance). With many concurrent requests, this quickly exhausts the database's connection limit (often 20-100 for managed databases).

Context / Trigger Conditions

This skill applies when you see:

  • P2024: Timed out fetching a new connection from the connection pool
  • PostgreSQL: FATAL: too many connections for role "username"
  • MySQL: Too many connections
  • Works fine locally with npm run dev but fails in production
  • Errors appear during traffic spikes, then resolve
  • Database dashboard shows connections at or near limit

Environment indicators:

  • Deploying to Vercel, AWS Lambda, Netlify Functions, or similar
  • Using Prisma with PostgreSQL, MySQL, or another connection-based database
  • Database is managed (PlanetScale, Supabase, Neon, RDS, etc.)

Solution

Step 1: Use Connection Pooling Service

The recommended solution is to use a connection pooler like PgBouncer or Prisma Accelerate, which sits between your serverless functions and the database.

For Supabase:

# .env
# Use the pooled connection string (port 6543, not 5432)
DATABASE_URL="postgresql://user:[email protected]:6543/postgres?pgbouncer=true"

For Neon:

# .env  
DATABASE_URL="postgresql://user:[email protected]/dbname?sslmode=require"
# Neon has built-in pooling

For Prisma Accelerate:

npx prisma generate --accelerate

Step 2: Configure Prisma Connection Limits

In your schema.prisma:

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
  // Limit connections per Prisma instance
  relationMode = "prisma"
}

In your connection URL or Prisma client:

// lib/prisma.ts
import { PrismaClient } from '@prisma/client'

const globalForPrisma = global as unknown as { prisma: PrismaClient }

export const prisma = globalForPrisma.prisma || new PrismaClient({
  datasources: {
    db: {
      url: process.env.DATABASE_URL + '?connection_limit=1'
    }
  }
})

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma

Read the full file on GitHub · 162 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. 12d ago First seen · 162 lines · 100 tokens per session scan A 5d9610dfbbf1

Subscribe to this mod's changes

prisma-connection-pool-exhaustion is a skill published in the GitHub repository ckorhonen/claude-skills (14 stars, last pushed 2mo ago), licensed MIT. It adds 100 tokens to every session and 1,160 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to prisma-connection-pool-exhaustion, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

airtable-webhooks

Receive and verify Airtable webhooks. Use when setting up Airtable webhook handlers, debugging X-Airtable-Content-MAC signature verification, handling the thin-ping notification, or fetching base changes (tableData, tableFields, tableMetadata add/remove/update) from the webhook payloads API.

hookdeck/webhook-skills · 65 tokens

make-it-real

Turn the demo into a product -- replace hardcoded arrays with a real database, stubbed sign-in with real auth, and the fake form with one that actually delivers. Use when an app looks finished but nothing it shows is true.

OneWave-AI/open-agent-stack · 51 tokens

supabase-webhooks

Receive and verify Supabase webhooks. Use when setting up Supabase Database Webhooks (INSERT, UPDATE, DELETE table events sent via pgnet triggers) or Supabase Auth Hooks (sendemail, sendsms, customaccesstoken, beforeusercreated, mfaverificationattempt, passwordverificationattempt), debugging Standard Webhooks…

hookdeck/webhook-skills · 101 tokens

crudcraft

Use when building or editing a small database-backed web app in ANY stack — plain PHP, Laravel, or Supabase, on MySQL/MariaDB, PostgreSQL, SQLite, SQL Server, or a hosted DB — scaffolding a project, creating or evolving a database, designing tables or writing SQL, adding login/registration or user roles, building a…

GitRavz/CRUDcraft · 174 tokens

java-cache

Use when the user asks to add caching, configure Redis or Caffeine cache, use @Cacheable/@CacheEvict/@CachePut, optimize repeated database or API calls, or review existing Spring Boot cache configuration.

ducpm2303/claude-java-plugins · 46 tokens

api-mirror

Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror). Use when a server wraps a large or slow API and should query a synced local index (embedded SQLite + FTS5) instead of paginating the live API per request.

cyanheads/calculator-mcp-server · 68 tokens