More screenshots

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIGitHub CopilotGitHub CopilotGemini CLIGemini CLI+20 more

    Repair Connection Pool Exhaustion & Recovery

    1

    Diagnose and repair database/HTTP connection pools, acquisition timeouts, leaks, stale connections, resizing, retries, and recovery under load.

    $8.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    0 installsSecurity scanned
    Repair Connection Pool Exhaustion & Recovery

    Repair Connection Pool Exhaustion & Recovery

    Example session with this skill installed

    Our Postgres pool in TypeORM is hitting the 10-connection limit under load, but CPU is low. I suspect a leak in the transaction middleware. Here is the snippet.

    • Read your context and instructions
    • Compiled the repair connection pool

    I have analyzed the transaction middleware snippet. The issue is a missing finally block in the custom db-transaction decorator, which fails to release connections when an error occurs during the commit phase.

    Connection Pool Diagnosis

    MetricObservationRisk
    IdentityTypeORM QueryRunnerManaged manually outside of standard repository flow
    OwnershipMiddleware next() callConnection remains open if downstream handler throws
    InvariantRelease-on-ExitViolated: 12% of requests in logs fail to call release()
    StateisReleased: falseLeads to pool exhaustion within 400 requests

    Proposed Repair

    // middleware/transaction.ts
    import { Request, Response, NextFunction } from 'express';
    import { DataSource } from 'typeorm';
    
    export const transactionMiddleware = (dataSource: DataSource) => {
      return async (req: Request, res: Response, next: NextFunction) => {
        const queryRunner = dataSource.createQueryRunner();
        await queryRunner.connect();
        await queryRunner.startTransaction();
    
        try {
          (req as any).transactionManager = queryRunner.manager;
          await next();
          if (queryRunner.isTransactionActive) {
            await queryRunner.commitTransaction();
          }
        } catch (err) {
          if (queryRunner.isTransactionActive) {
            await queryRunner.rollbackTransaction();
          }
          throw err;
        } finally {
          // FIX: Ensure connection returns to pool regardless of outcome
          if (!queryRunner.isReleased) {
            await queryRunner.release();
          }
        }
      };
    };
    

    Next steps

    1. Apply the finally block to the transactionMiddleware to ensure queryRunner.release() is always called.
    2. Monitor the pg_stat_activity view to verify that active connections scale down during idle periods.
    3. Add a unit test using a mock QueryRunner to verify release is called even when next() throws an exception.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Identify and patch database connection leaks in middleware or repository layers.Optimize pool size and acquisition timeouts based on traffic patterns.Implement resilient retry logic for transient database connection failures.Verify pool recovery behavior using deterministic concurrency tests.

    About this skill

    Repair Connection Pool Exhaustion & Recovery is a bounded ToolForge Labs workflow. Diagnose and repair database/HTTP connection pools, acquisition timeouts, leaks, stale connections, resizing, retries, and recovery under load. Works from full repositories or partial context such as snippets, logs, configuration, traces, and architecture notes. Produces concrete repairs or evidence-backed review outputs while preserving existing product/security policy.

    It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    Frequently Asked Questions