cloudflare-hono

Align Cloudflare Worker Env typings with Hono bindings for type-safe runtime access.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/morgs32/skills --skill cloudflare-hono
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare-hono
Source: https://github.com/morgs32/skills/tree/main/skills/cloudflare-hono
Command: npx skills add https://github.com/morgs32/skills --skill cloudflare-hono

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Wire Cloudflare Worker Env typings into Hono apps, enabling type-safe access to the worker runtime environment via typed Bindings.

Core Features & Use Cases

  • Type Env as Bindings in Hono routers to ensure correct access to env bindings.
  • Import Env from the generated worker-configuration.d.ts and use c.env in routes for compile-time type checks.
  • Improve autocomplete and safety in Cloudflare Workers + Hono projects.

Quick Start

  • Run wrangler types in apps/api to generate apps/api/worker-configuration.d.ts.
  • Import type { Env } from "../worker-configuration" and create a router with new Hono<{ Bindings: Env }>().
  • Access environment values via c.env.ZEROSPIN_DATABASE or other Env properties in route handlers.

Frequently Asked Questions about cloudflare-hono

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I type Cloudflare Worker Env bindings in a Hono app?

To type Cloudflare Worker Env bindings in a Hono app, import the Env type from your generated worker-configuration.d.ts file and pass it to the Hono constructor using new Hono<{ Bindings: Env }>(). This enables type-safe access to runtime environment variables via c.env.

Why are my Hono bindings untyped when using Cloudflare Workers?

Hono bindings are untyped when the Hono instance is not configured with the Cloudflare Worker Env type. You must wrap the Env type imported from worker-configuration using new Hono<{ Bindings: Env }>() to ensure compile-time type checks and proper autocomplete.

How do I generate types for Cloudflare Worker environment variables?

You generate types for Cloudflare Worker environment variables by running the wrangler types command in your project directory. This creates a worker-configuration.d.ts file containing the Env interface, which you then import into your Hono application.

Can I use wrangler types with Hono for compile-time checks?

Yes, you can use wrangler types with Hono for compile-time checks. By importing the Env type from the generated worker-configuration.d.ts file and passing it to new Hono<{ Bindings: Env }>(), you enforce type-safe runtime access to environment bindings.

What is the best way to access environment variables in Hono routes on Cloudflare Workers?

The best way to access environment variables in Hono routes is by typing the Hono instance with Cloudflare Worker Env bindings. After configuring new Hono<{ Bindings: Env }>(), you directly access properties like c.env.ZEROSPIN_DATABASE within your route handlers with full autocomplete.