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

error-handling.jsonverifiers/

{
  "instruction": "Register global onError and notFound handlers that return structured JSON error responses",
  "relevant_when": "Agent builds any Hono API or sets up a Hono application",
  "context": "Hono's app.onError catches all thrown errors including HTTPException. Without it, unhandled errors return raw error text. app.notFound handles requests matching no route -- without it, Hono returns plain-text '404 Not Found'. Both must return consistent JSON: { error: { code, message } }. The onError handler must never leak stack traces or raw library error messages to clients. Internal errors must return a generic message. Custom error classes should extend HTTPException.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/hono-best-practices/SKILL.md",
      "tile": "tessl-labs/hono-best-practices@0.2.0"
    }
  ],
  "checklist": [
    {
      "name": "global-on-error-handler",
      "rule": "app.onError is registered with a handler that returns c.json() with a structured error object for all error types",
      "relevant_when": "Agent sets up a Hono application"
    },
    {
      "name": "not-found-handler",
      "rule": "app.notFound is registered with a handler that returns a JSON 404 response -- not the default plain-text Hono 404",
      "relevant_when": "Agent sets up a Hono application"
    },
    {
      "name": "no-stack-trace-leaks",
      "rule": "The onError handler returns a generic safe message for unexpected/internal errors -- no stack traces, raw library errors, or internal paths in response bodies",
      "relevant_when": "Agent handles unknown or unexpected errors in Hono"
    },
    {
      "name": "consistent-error-shape",
      "rule": "All error responses (validation, not-found, internal) use the same object shape with at least a code field and a message field",
      "relevant_when": "Agent returns error responses from Hono routes or error handlers"
    }
  ]
}

tile.json