Agent skill

Cloudflare Hyperdrive

by secondsky in secondsky/claude-skills

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching.

MITAuto-check passedDatabases

Install Cloudflare Hyperdrive

skills CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-hyperdrive -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills cloudflare-hyperdrive --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/cloudflare-hyperdrive/skills/cloudflare-hyperdrive .claude/skills/cloudflare-hyperdrive && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-hyperdrive
GitHub stars
227
Token cost
~1.8k tokens
SKILL.md length
372 words
Files
20 (incl. scripts, references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching.

  • Works in 4 steps: Create Hyperdrive Config → Configure Binding → Install Driver → …
  • PostgreSQL/MySQL
  • SKILL.md covers What Is Hyperdrive?, Quick Start (5 Minutes), Critical Rules and Database Drivers, plus 5 more sections
  • Runs TypeScript and Shell scripts from its folder; calls bunx and bun

What it does

Cloudflare Hyperdrive is an agent skill from secondsky/claude-skills. Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 22 other files, including scripts and reference files (for example `references/connection-pooling.md`, `references/drizzle-integration.md` and `references/prisma-integration.md`).

It sits in Databases, covering ORMs and data access and Caching. It works with Cloudflare, PostgreSQL, MySQL and Prisma. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • PostgreSQL/MySQL
  • Encountering pool errors
  • Connection refused

Example prompts

  • “/cloudflare-hyperdrive”

Requirements

  • Node.js
  • A Bash shell

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Create Hyperdrive Config
  2. Configure Binding
  3. Install Driver
  4. Query Database

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (TypeScript and Shell, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • bunx
    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Hyperdrive loads about 1.8k tokens when it runs, and up to ~27k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 372 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~27k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 372 words, ~1,845 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-hyperdrive/SKILL.md (or your agent's skills folder). This skill also uses 19 other files; get the full folder from GitHub.
name
cloudflare-hyperdrive
description
Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.
license
MIT
metadata.version
2.0.0
metadata.last_verified
2025-11-18
metadata.production_tested
true
metadata.token_savings
~58%
metadata.errors_prevented
6
metadata.templates_included
0
metadata.references_included
1
metadata.keywords
hyperdrive, cloudflare hyperdrive, workers hyperdrive, postgres workers, mysql workers, connection pooling, query caching, node-postgres, pg, postgres.js…

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
bash
bunx wrangler hyperdrive create my-db \
  --connection-string="postgres://user:pass@host:5432/database"

Save the id!

2. Configure Binding
jsonc
{
  "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
bash
bun add pg  # or postgres, or mysql2
4. Query Database
typescript
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

Database Drivers

PostgreSQL (node-postgres)
typescript
import { Client } from 'pg';

const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();
const result = await client.query('SELECT * FROM users');
await client.end();
PostgreSQL (postgres.js)
typescript
import postgres from 'postgres';

const sql = postgres(env.HYPERDRIVE.connectionString);
const users = await sql`SELECT * FROM users`;
MySQL
typescript
import mysql from 'mysql2/promise';

const connection = await mysql.createConnection(env.HYPERDRIVE.connectionString);
const [rows] = await connection.execute('SELECT * FROM users');
await connection.end();

With Drizzle ORM

typescript
import { drizzle } from 'drizzle-orm/node-postgres';
import { Client } from 'pg';

const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();

const db = drizzle(client);
const users = await db.select().from(usersTable);

await client.end();

Common Use Cases

Use Case 1: Read-Only Queries
typescript
export default {
  async fetch(request, env, ctx) {
    const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
    await client.connect();

    const users = await client.query('SELECT * FROM users WHERE active = true');
    await client.end();

    return Response.json(users.rows);
  }
};
Use Case 2: Parameterized Queries
typescript
const userId = new URL(request.url).searchParams.get('id');

const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();

const result = await client.query(
  'SELECT * FROM users WHERE id = $1',
  [userId]
);

await client.end();
Use Case 3: Transactions
typescript
const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();

try {
  await client.query('BEGIN');
  await client.query('UPDATE accounts SET balance = balance - 100 WHERE id = $1', [1]);
  await client.query('UPDATE accounts SET balance = balance + 100 WHERE id = $1', [2]);
  await client.query('COMMIT');
} catch (e) {
  await client.query('ROLLBACK');
  throw e;
} finally {
  await client.end();
}

Supported Databases

PostgreSQL:

  • Amazon RDS
  • Amazon Aurora
  • Neon
  • Supabase
  • Railway
  • Render
  • DigitalOcean
  • Any PostgreSQL 11+

MySQL:

  • Amazon RDS
  • Amazon Aurora
  • PlanetScale
  • Any MySQL 5.7+

Show full SKILL.md (140 more words)Show less

Official Documentation


Bundled Resources

References (references/):

  • setup-guide.md - Complete setup walkthrough (create config, bind, query)
  • connection-pooling.md - Connection pool configuration and best practices
  • query-caching.md - Query caching strategies and optimization
  • drizzle-integration.md - Drizzle ORM integration patterns
  • prisma-integration.md - Prisma ORM integration patterns
  • supported-databases.md - Complete list of supported PostgreSQL and MySQL providers
  • tls-ssl-setup.md - TLS/SSL configuration for secure connections
  • troubleshooting.md - Common issues and solutions
  • wrangler-commands.md - Complete wrangler CLI commands for Hyperdrive

Templates (templates/):

  • postgres-basic.ts - Basic PostgreSQL with node-postgres
  • postgres-js.ts - PostgreSQL with postgres.js driver
  • postgres-pool.ts - PostgreSQL with connection pooling
  • mysql2-basic.ts - MySQL with mysql2 driver
  • drizzle-postgres.ts - Drizzle ORM with PostgreSQL
  • drizzle-mysql.ts - Drizzle ORM with MySQL
  • prisma-postgres.ts - Prisma ORM with PostgreSQL
  • local-dev-setup.sh - Local development setup script
  • wrangler-hyperdrive-config.jsonc - Wrangler configuration example

Questions? Issues?

  1. Check references/setup-guide.md for complete setup
  2. Verify nodejs_compat flag enabled
  3. Ensure using env.HYPERDRIVE.connectionString
  4. Check connection properly closed

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 19 other files (scripts, references) in plugins/cloudflare-hyperdrive/skills/cloudflare-hyperdrive of secondsky/claude-skills.

  • SKILL.md
  • references/connection-pooling.md
  • references/drizzle-integration.md
  • references/prisma-integration.md
  • references/query-caching.md
  • references/setup-guide.md
  • references/supported-databases.md
  • references/tls-ssl-setup.md
  • references/troubleshooting.md
  • references/wrangler-commands.md
  • scripts/check-versions.sh
  • templates/drizzle-mysql.ts
  • templates/drizzle-postgres.ts
  • templates/local-dev-setup.sh
  • templates/mysql2-basic.ts
  • templates/postgres-basic.ts
  • templates/postgres-js.ts
  • templates/postgres-pool.ts
  • … and 2 more

Open the folder on GitHubat commit 8837836

Compare with similar skills

Cloudflare Hyperdrive next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Hyperdrive compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Hyperdrive this skillsecondsky/claude-skills227—~1.8kAutomated safety check: PassMIT
Better Drizzlealmeidazs/better-drizzle347—~1.7kAutomated safety check: PassApache-2.0
Prisma Database Setupcurvenote/curvenote1693 repos~1.4kAutomated safety check: PassMIT
Database Expertcin12211/orca-q223—~2.8kAutomated safety check: PassMIT
Database Migrationsaffaan-m/ECC274k3 repos~1.9kAutomated safety check: PassMIT
DB Review312362115/claude107—~1.8kAutomated safety check: PassMIT

Similar skills

  • Better Drizzle

    almeidazs/better-drizzle

    Write, review, and debug code that uses better-drizzle, the typed repository layer over Drizzle ORM 1.x (better(db), client.users.findMany, paginate, cursor, upsertMany, relation include/connect…

    347 GitHub stars~1.7k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Prisma Database Setup

    curvenote/curvenote

    Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.).

    169 GitHub starsUsed in 3 repos~1.4k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    223 GitHub stars~2.8k tokensUpdated 16 days ago
    DatabasesAuto-check passed
  • 数据库迁移最佳实践,涵盖模式变更、数据迁移、回滚以及零停机部署,适用于PostgreSQL、MySQL及常用ORM(Prisma、Drizzle、Django、TypeORM、golang-migrate)。

    274k GitHub starsUsed in 3 repos~1.9k tokens
    DatabasesAuto-check passed
  • DB Review

    312362115/claude

    数据库代码审查 + Migration 安全检查. An agent skill from 312362115/claude.

    107 GitHub stars~1.8k tokensUpdated 4 mo ago
    DatabasesAuto-check passed
  • Şema değişiklikleri, veri migration'ları, rollback'ler ve PostgreSQL, MySQL ve yaygın ORM'ler (Prisma, Drizzle, Django, TypeORM, golang-migrate) arasında sıfır kesinti deployment'ları için…

    274k GitHub starsUsed in 1 repo~2.4k tokens
    DatabasesAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Categories

Questions about Cloudflare Hyperdrive

What does Cloudflare Hyperdrive do?

Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Cloudflare Hyperdrive is an agent skill from secondsky/claude-skills. Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching.

When should I use Cloudflare Hyperdrive?

Cloudflare Hyperdrive fits situations like: postgreSQL/MySQL; encountering pool errors; connection refused.

How do I install Cloudflare Hyperdrive in Claude Code?

Run `npx skills add secondsky/claude-skills --skill cloudflare-hyperdrive -a claude-code`. Or copy the skill folder (plugins/cloudflare-hyperdrive/skills/cloudflare-hyperdrive in secondsky/claude-skills) into .claude/skills/cloudflare-hyperdrive in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Hyperdrive in Codex?

Run `npx skills add secondsky/claude-skills --skill cloudflare-hyperdrive -a codex`. Or copy the skill folder (plugins/cloudflare-hyperdrive/skills/cloudflare-hyperdrive in secondsky/claude-skills) into .agents/skills/cloudflare-hyperdrive in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Hyperdrive in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill cloudflare-hyperdrive -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-hyperdrive, .gemini/skills/cloudflare-hyperdrive, .github/skills/cloudflare-hyperdrive and .opencode/skills/cloudflare-hyperdrive in your project.

What does Cloudflare Hyperdrive need to run?

Going by SKILL.md and its folder, Cloudflare Hyperdrive needs TypeScript and a shell for the scripts in its folder and the command-line tools its instructions call (bunx and bun). Our summary lists: Node.js; A Bash shell.

Does Cloudflare Hyperdrive access the network?

SKILL.md names 1 domain. As links in the text: developers.cloudflare.com. This is read from the text; nothing was executed.

Is Cloudflare Hyperdrive safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Cloudflare Hyperdrive use?

Cloudflare Hyperdrive is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Hyperdrive use?

About 1.8k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 25k tokens, read only when the agent opens those files.

What are the alternatives to Cloudflare Hyperdrive?

Skills that share tags, products or a category with Cloudflare Hyperdrive: Better Drizzle (almeidazs/better-drizzle, 347 stars), Prisma Database Setup (curvenote/curvenote, 169 stars), Database Expert (cin12211/orca-q, 223 stars) and Database Migrations (affaan-m/ECC, 274k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Hyperdrive?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.