CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/hono-best-practices

Production Hono patterns — zValidator hooks, typed generics, error handling, middleware composition, testing, and multi-runtime deployment

87

2.57x
Quality

80%

Does it follow best practices?

Impact

98%

2.57x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

middleware-composition.jsonverifiers/

{
  "instruction": "Use correct middleware composition: await next(), createMiddleware for typed middleware, and register before routes",
  "relevant_when": "Agent writes custom middleware or registers middleware in a Hono application",
  "context": "Hono middleware must always await next() -- forgetting the await causes downstream middleware and the response to execute out of order or not at all. Custom middleware should use createMiddleware<Env>() from 'hono/factory' to get type-safe c.set()/c.get() access. Plain async functions lose the Env generic. Built-in middleware (logger, secureHeaders, cors, timing) must be registered before the routes they should apply to. Use app.use('*', ...) for global and app.use('/prefix/*', ...) for scoped middleware.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/hono-best-practices/SKILL.md",
      "tile": "tessl-labs/hono-best-practices@0.2.0"
    }
  ],
  "checklist": [
    {
      "name": "await-next",
      "rule": "All custom middleware functions use 'await next()' -- not bare 'next()' without await",
      "relevant_when": "Agent writes custom Hono middleware"
    },
    {
      "name": "create-middleware-for-typed",
      "rule": "Custom middleware that uses c.set() or c.get() is created with createMiddleware<Env>() from 'hono/factory' rather than a plain async function",
      "relevant_when": "Agent writes custom middleware that sets or reads context variables"
    },
    {
      "name": "middleware-before-routes",
      "rule": "Middleware is registered with app.use() before the route handlers it should apply to",
      "relevant_when": "Agent registers middleware in a Hono application"
    },
    {
      "name": "built-in-middleware-included",
      "rule": "The app registers appropriate built-in middleware: at minimum logger() and secureHeaders() for any API, plus cors() if the API serves browser clients",
      "relevant_when": "Agent sets up a new Hono application"
    }
  ]
}

tile.json