cloudflare-hyperdrive

cloudflare-hyperdrive is a skill for Claude Code, Codex from secondsky/claude-skills. It costs 45 tokens per session (1,853 once invoked), scanned A, original, MIT.

A Cloudflare service that helps Workers connect to existing PostgreSQL or MySQL databases. It provides shared database connections and query caching for applications running on Cloudflare’s network.

In plain words
What is it for?
Use it to connect a Worker to PostgreSQL or MySQL with drivers such as node-postgres, postgres.js, or mysql2, including projects using Drizzle or Prisma.
Why use it?
It reduces connection-management problems when short-lived Workers access a traditional database. It also helps address pooling, TLS, and connection-refused issues.

Skill for Claude CodeCodex

Part of the cloudflare-hyperdrive plugin — 1 skill shipped together

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.

agentmods
npx agentmods add skills/secondsky/claude-skills/cloudflare-hyperdrive
Any agent
npx skills add secondsky/claude-skills --skill cloudflare-hyperdrive
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code, Codex.

Or install cloudflare-hyperdrive, the plugin that ships this one along with the rest of its 1 skill.

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 cloudflare-hyperdrive

README.md
[![agentmods](https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-hyperdrive.svg)](https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-hyperdrive)
Your own site
<a href="https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-hyperdrive"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-hyperdrive.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,853 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00045 $0.01853
Opus 5 $0.00023 $0.00927
Sonnet 5 $0.00009 $0.00371
Haiku 4.5 $0.00005 $0.00185

Measured yesterday against content hash 76215f2b20a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cloudflare-hyperdrive scanned grade A with 1 finding 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 yesterday.

The scan reads SKILL.md. This mod also ships 9 executable files (scripts/check-versions.sh, templates/drizzle-mysql.ts, templates/drizzle-postgres.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request, env, ctx) {
plugins/cloudflare-hyperdrive/skills/cloudflare-hyperdrive/SKILL.md · 306 lines

How it starts

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

Cloudflare Hyperdrive

Status: Production Ready ✅ | Last Verified: 2025-11-18


What Is Hyperdrive?

Connect Workers to existing PostgreSQL/MySQL databases:

  • Global connection pooling
  • Query caching
  • Reduced latency
  • Works with node-postgres, postgres.js, mysql2

Quick Start (5 Minutes)

1. Create Hyperdrive Config

bunx wrangler hyperdrive create my-db \
  --connection-string="postgres://user:pass@host:5432/database"

Save the id!

2. Configure Binding

{
  "name": "my-worker",
  "main": "src/index.ts",
  "compatibility_date": "2024-09-23",
  "compatibility_flags": ["nodejs_compat"],  // REQUIRED!
  "hyperdrive": [
    {
      "binding": "HYPERDRIVE",
      "id": "<ID_FROM_STEP_1>"
    }
  ]
}

3. Install Driver

bun add pg  # or postgres, or mysql2

4. Query Database

import { Client } from 'pg';

export default {
  async fetch(request, env, ctx) {
    const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
    await client.connect();

    const result = await client.query('SELECT * FROM users LIMIT 10');
    await client.end();

    return Response.json(result.rows);
  }
};

Load references/setup-guide.md for complete walkthrough.


Critical Rules

Always Do ✅

  1. Enable nodejs_compat flag (required!)
  2. Use env.HYPERDRIVE.connectionString (not original DB string)
  3. Close connections after queries
  4. Handle errors explicitly
  5. Use connection pooling (built-in)
  6. Test locally with wrangler dev
  7. Monitor query performance
  8. Use prepared statements
  9. Enable query caching (automatic)
  10. Secure connection strings (use secrets)

Never Do ❌

  1. Never skip nodejs_compat (drivers won't work)
  2. Never use original DB connection string in Workers
  3. Never leave connections open (pool exhaustion)
  4. Never skip error handling (DB can fail)
  5. Never hardcode credentials in code
  6. Never exceed connection limits
  7. Never use eval/Function (blocked in Workers)
  8. Never skip TLS for production DBs
  9. Never use blocking queries (Worker timeout)
  10. Never expose DB errors to users

Read the full file on GitHub · 306 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. yesterday First seen · 306 lines · 45 tokens per session scan A 76215f2b20a8

Subscribe to this mod's changes

cloudflare-hyperdrive is a skill published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 2d ago), licensed MIT. It adds 45 tokens to every session and 1,853 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.