askill
hono

honoSafety 95Repository

Hono ultrafast web framework for edge and server runtimes. Use when building APIs, middleware chains, or edge functions on Cloudflare Workers, Bun, Node.js, or Deno. Use for hono, api, routing, middleware, cloudflare-workers, edge, rpc, validator, context.

4 stars
1.2k downloads
Updated 3/2/2026

Package Files

Loading files...
SKILL.md

Hono

Overview

Hono is a small, ultrafast web framework built on Web Standards that runs on any JavaScript runtime including Cloudflare Workers, Bun, Deno, Node.js, Vercel, and AWS Lambda. Application code is portable across runtimes; only the entry point and adapter differ per platform.

When to use: Edge-first APIs, Cloudflare Workers services, multi-runtime applications, lightweight REST/RPC servers, middleware-heavy request pipelines, type-safe client-server communication.

When NOT to use: Full-stack SSR frameworks (use Next.js/Remix), heavy ORM-driven monoliths where Express ecosystem maturity matters, applications that need deep Node.js-only APIs without Web Standard equivalents.

Quick Reference

PatternAPIKey Points
Basic routingapp.get('/path', handler)Supports get, post, put, delete, patch, all
Path parametersapp.get('/user/:id', handler)Access via c.req.param('id')
Regex constraintsapp.get('/post/:id{[0-9]+}', handler)Inline regex in path parameter
Wildcardapp.get('/files/*', handler)Matches any sub-path
Route groupingapp.route('/api', subApp)Mount sub-applications
Middlewareapp.use(middleware())Executes in registration order
Path middlewareapp.use('/auth/*', jwt(...))Scope middleware to paths
JSON responsec.json({ key: 'value' })Sets Content-Type automatically
Text responsec.text('hello')Returns plain text
HTML responsec.html('<h1>Hi</h1>')Returns HTML content
Status + headerc.status(201), c.header('X-Key', 'val')Chain before response
Redirectc.redirect('/new-path', 301)Default status is 302
Request bodyc.req.json(), c.req.parseBody()JSON or form data parsing
Query paramsc.req.query('page')Single query parameter
Context variablesc.set('user', data) / c.get('user')Type-safe middleware data passing
Zod validationzValidator('json', schema)@hono/zod-validator package
RPC clienthc<AppType>(url)End-to-end type-safe API calls
Error handlerapp.onError((err, c) => ...)Global error handling
Not foundapp.notFound((c) => ...)Custom 404 handler
Environmentc.env.BINDING_KEYAccess runtime bindings/env vars
Adapter helperenv(c) from hono/adapterUnified env access across runtimes
WebSocketupgradeWebSocket() from runtime adapterWebSocket helper with RPC support
Test clienttestClient(app) from hono/testingType-safe testing without HTTP server
JSX streamingjsxRenderer({ stream: true })SSR streaming with Suspense support

Common Mistakes

MistakeCorrect Pattern
Registering middleware after handlersRegister middleware before the handlers it should apply to
Using app.route() without chaining for RPC typesChain route methods (app.route('/a', a).route('/b', b)) and export typeof routes
Forgetting export default app for edge runtimesCloudflare Workers, Bun, and Deno require the default export
Using compress() on Cloudflare Workers or Deno DeployThese platforms compress automatically; skip the middleware
Mixing Hono and middleware versions in DenoPin all hono imports to the same version to avoid type mismatches
Wrapping next() in try/catch inside middlewareHono catches thrown errors and routes to app.onError(); next() never throws
Defining routes with app.get() but exporting typeof app for RPCExport the type of the chained route variable, not the app instance
Using new Hono() without generics for typed contextPass Hono<{ Variables: MyVars }> to enable typed c.get()/c.set()
Returning c.json() without status for created resourcesPass status as second argument: c.json(data, 201)
Not using createMiddleware() for reusable middlewareImport from hono/factory to preserve type inference when extracting middleware

Delegation

If the zod or typescript-patterns skill is available, delegate schema and type-level tasks to it. Otherwise, recommend: npx skills add oakoss/agent-skills --skill typescript-patterns

If a Cloudflare Workers skill is available, delegate platform-specific configuration to it.

References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

85/100Analyzed 2/24/2026

Comprehensive reference skill for the Hono web framework with excellent structure, clear usage guidelines, and high-density technical content. Includes metadata, clear when-to-use guidance, quick reference table, common mistakes, and delegation to related skills. Slightly generic tags reduce specificity, but overall highly reusable across multiple runtimes and projects.

95
90
80
85
75

Metadata

Licenseunknown
Version-
Updated3/2/2026
Publisheroakoss

Tags

apici-cdsecuritytesting