cloudflare-hyperdrive

SkillCloud & infra

Cloudflare Hyperdrive connection usage rules

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the cloudflare-hyperdrive skill

What this skill tells your AI

The instructions your AI receives, as published by theprimeagen/skills in skills/cloudflare-hyperdrive/SKILL.md and read by ahel’s review.

Cloudflare Hyperdrive

Rules

  1. Create a new database client/connection inside each Worker invocation (fetch, queue, scheduled, or Durable Object method); never create global clients or driver pools (new Pool(), createPool()). Hyperdrive manages the shared origin pool.
  2. Use the Hyperdrive binding directly: Postgres uses env.HYPERDRIVE.connectionString
  3. Let Hyperdrive manage connection lifecycle: keep transactions short, avoid long-lived pinned connections, and do not call client.end() / connection.end() for routine per-request cleanup.

Example 1: PostgreSQL (Hyperdrive handles pooling)

import { Client } from "pg";

export default {
  async fetch(_request, env): Promise<Response> {
    const client = new Client({
      connectionString: env.HYPERDRIVE.connectionString,
    });

    await client.connect();
    const result = await client.query("SELECT NOW() AS now");
    return Response.json(result.rows[0]);
  },
} satisfies ExportedHandler<{ HYPERDRIVE: Hyperdrive }>;

Signals

GitHub stars
233
Forks
5
Last commit
Feb 2026

ahel review

  • S4info
    community integration — published by theprimeagen, not cloudflare

Automated review, not a security audit. Ruleset v1.

Advanced
Catalog kind
skill
Gateway key
cloudflare-hyperdrive-theprimeagen
Source
github.com/theprimeagen/skills