Production Hono patterns — zValidator hooks, typed generics, error handling, middleware composition, testing, and multi-runtime deployment
87
80%
Does it follow best practices?
Impact
98%
2.57xAverage score across 5 eval scenarios
Passed
No known issues
{
"instruction": "Declare app-level Env generics with Variables and Bindings for type-safe context access",
"relevant_when": "Agent creates a Hono application that uses c.set()/c.get() or c.env",
"context": "Hono uses generics on new Hono<Env>() to type the context object. The Env type has two key fields: Variables (for c.set/c.get values shared across middleware and handlers) and Bindings (for c.env on Cloudflare Workers -- D1Database, KVNamespace, etc.). Without declaring Variables, c.set('key', val) and c.get('key') are untyped and typos cause silent runtime failures. Without declaring Bindings on Cloudflare, c.env is 'any'. The same Env generic must be passed to child Hono instances used with app.route() and to createMiddleware<Env>().",
"sources": [
{
"type": "file",
"filename": "skills/hono-best-practices/SKILL.md",
"tile": "tessl-labs/hono-best-practices@0.2.0"
}
],
"checklist": [
{
"name": "env-generic-declared",
"rule": "The Hono app is created with an Env generic type: new Hono<{ Variables: {...} }>() -- not bare new Hono()",
"relevant_when": "Agent creates a Hono app that uses c.set()/c.get() or custom middleware"
},
{
"name": "bindings-for-cloudflare",
"rule": "When targeting Cloudflare Workers, the Env generic includes Bindings with typed binding names matching wrangler.toml",
"relevant_when": "Agent builds a Hono app for Cloudflare Workers that accesses environment bindings"
},
{
"name": "consistent-generic-across-instances",
"rule": "Child Hono instances mounted via app.route() use the same Env generic as the parent app",
"relevant_when": "Agent uses app.route() to mount route groups"
}
]
}