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
{
"context": "Tests Hono best practices specifically for Cloudflare Workers: Bindings typing for c.env, correct entry point (export default app), and KV access via typed c.env. The task mentions KV but does not mention Bindings generics, validation hooks, or error handling.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Bindings type for c.env",
"description": "The Hono app is created with Bindings in the Env generic that types c.env.NOTES_KV as KVNamespace -- not bare new Hono() with untyped c.env access",
"max_score": 15
},
{
"name": "Cloudflare entry point",
"description": "The entry point uses 'export default app' -- not @hono/node-server, not Deno.serve(), not Bun's export default { fetch }",
"max_score": 12
},
{
"name": "zValidator with hook callback",
"description": "zValidator includes a hook callback returning structured JSON errors",
"max_score": 12
},
{
"name": "c.req.valid() for validated data",
"description": "Handlers use c.req.valid('json') -- not c.req.json() after zValidator",
"max_score": 8
},
{
"name": "Global onError handler",
"description": "app.onError registered with structured JSON responses and no stack trace leaks",
"max_score": 10
},
{
"name": "notFound handler",
"description": "app.notFound returns JSON 404",
"max_score": 7
},
{
"name": "Typed KV access",
"description": "KV is accessed via c.env.NOTES_KV (using the typed binding) -- not via a global variable or import",
"max_score": 10
},
{
"name": "Consistent Env generic on child instances",
"description": "Child Hono instances mounted via app.route() use the same Env generic that includes Bindings",
"max_score": 8
},
{
"name": "Built-in middleware",
"description": "At least secureHeaders() is registered (logger less critical on Workers, but secureHeaders is important)",
"max_score": 6
},
{
"name": "Route grouping",
"description": "Notes routes organized with app.route()",
"max_score": 5
},
{
"name": "Consistent error shape",
"description": "All errors use { error: { code, message } } shape",
"max_score": 7
}
]
}