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 with nested routes (products/:id/adjust, products/:id/history), business logic validation (stock cannot go below zero), and Bun runtime. The task does not mention validation hooks, error handling patterns, or middleware.",
"type": "weighted_checklist",
"checklist": [
{
"name": "zValidator with hook callback",
"description": "zValidator includes a hook callback returning structured JSON errors on validation failure",
"max_score": 15
},
{
"name": "c.req.valid() for validated data",
"description": "Handlers use c.req.valid('json') and c.req.valid('param') -- not c.req.json() or c.req.param() after zValidator",
"max_score": 10
},
{
"name": "Global onError handler",
"description": "app.onError registered with structured JSON responses and no stack trace leaks",
"max_score": 12
},
{
"name": "notFound handler",
"description": "app.notFound returns JSON 404",
"max_score": 7
},
{
"name": "Bun entry point",
"description": "Entry point uses export default { fetch: app.fetch, port } -- not @hono/node-server",
"max_score": 10
},
{
"name": "Built-in middleware",
"description": "logger() and secureHeaders() registered",
"max_score": 8
},
{
"name": "createMiddleware for custom middleware",
"description": "If custom middleware is written, it uses createMiddleware<Env>() from 'hono/factory' for type safety",
"max_score": 8
},
{
"name": "Route grouping",
"description": "Product and adjustment routes organized with app.route()",
"max_score": 7
},
{
"name": "Env generic declared",
"description": "Hono app uses typed Env generic",
"max_score": 8
},
{
"name": "Business logic error as HTTPException",
"description": "Business rule violations (stock below zero, duplicate SKU) are thrown as HTTPException subclasses or handled with appropriate status codes (409, 422) -- not returned as 200 or 500",
"max_score": 8
},
{
"name": "Consistent error shape",
"description": "All errors use { error: { code, message } } shape",
"max_score": 7
}
]
}