
Hono
Stand up and test Hono routes, middleware, validation, and Workers bindings with inline API reference and CLI request tooling.
Install
npx skills add https://github.com/yusukebe/hono-skill --skill honoWhat is this skill?
- Inline Hono API reference for apps, routing methods, middleware, JSX, validation, and streaming
- Endpoint testing via npx hono request without starting a live HTTP server
- workers-fetch path when Cloudflare KV, D1, or R2 bindings are required
- Triggers on hono or hono/* imports and explicit Hono user questions
- Optional hono-docs MCP preferred for latest docs when configured
Adoption & trust: 7.3k installs on skills.sh; 146 GitHub stars; 2/3 security scanners passed (skills.sh audits).
Recommended Skills
Entra App Registrationmicrosoft/azure-skills
Azure Aigatewaymicrosoft/azure-skills
Lark Openapi Explorerlarksuite/cli
Supabasesupabase/agent-skills
Firebase Auth Basicsfirebase/agent-skills
Firebase Data Connectfirebase/agent-skills
Journey fit
Common Questions / FAQ
Is Hono safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Hono
# Hono Skill Build Hono web applications. This skill provides inline API knowledge for AI. Use `npx hono request` to test endpoints. If the `hono-docs` MCP server is configured, prefer its tools for the latest documentation over the inline reference. ## Hono CLI Usage ### Request Testing Test endpoints without starting an HTTP server. Uses `app.request()` internally. ```bash # GET request npx hono request [file] -P /path # POST request with JSON body npx hono request [file] -X POST -P /api/users -d '{"name": "test"}' ``` **Note:** Do not pass credentials directly in CLI arguments. Use environment variables for sensitive values. `hono request` does not support Cloudflare Workers bindings (KV, D1, R2, etc.). When bindings are required, use `workers-fetch` instead: ```bash npx workers-fetch /path npx workers-fetch -X POST -H "Content-Type:application/json" -d '{"name":"test"}' /api/users ``` --- ## Hono API Reference ### App Constructor ```ts import { Hono } from 'hono' const app = new Hono() // With TypeScript generics type Env = { Bindings: { DATABASE: D1Database; KV: KVNamespace } Variables: { user: User } } const app = new Hono<Env>() ``` ### Routing Methods ```ts app.get('/path', handler) app.post('/path', handler) app.put('/path', handler) app.delete('/path', handler) app.patch('/path', handler) app.options('/path', handler) app.all('/path', handler) // all HTTP methods app.on('PURGE', '/path', handler) // custom method app.on(['PUT', 'DELETE'], '/path', handler) // multiple methods ``` ### Routing Patterns ```ts // Path parameters app.get('/user/:name', (c) => { const name = c.req.param('name') return c.json({ name }) }) // Multiple params app.get('/posts/:id/comments/:commentId', (c) => { const { id, commentId } = c.req.param() }) // Optional parameters app.get('/api/animal/:type?', (c) => c.text('Animal!')) // Wildcards app.get('/wild/*/card', (c) => c.text('Wildcard')) // Regexp constraints app.get('/post/:date{[0-9]+}/:title{[a-z]+}', (c) => { const { date, title } = c.req.param() }) // Chained routes app .get('/endpoint', (c) => c.text('GET')) .post((c) => c.text('POST')) .delete((c) => c.text('DELETE')) ``` ### Route Grouping ```ts // Using route() const api = new Hono() api.get('/users', (c) => c.json([])) const app = new Hono() app.route('/api', api) // mounts at /api/users // Using basePath() const app = new Hono().basePath('/api') app.get('/users', (c) => c.json([])) // GET /api/users ``` ### Error Handling ```ts app.notFound((c) => c.json({ message: 'Not Found' }, 404)) app.onError((err, c) => { console.error(err) return c.json({ message: 'Internal Server Error' }, 500) }) ``` --- ## Context (c) ### Response Methods ```ts c.text('Hello') // text/plain c.json({ message: 'Hello' }) // application/json c.html('<h1>Hello</h1>') // text/html c.redirect('/new-path') // 302 redirect c.redirect('/new-path', 301) // 301 redirect c.body('raw body', 200, headers) // raw response c.notFound() // 404 response ``` ### Headers & Status ```ts c.status(201) c.header('X-Custom', 'value') c.header('Cache-Control', 'no-store') ``` ### Variables (request-scoped data) ```ts // In middleware c.set('user', { id: 1, name: 'Alice' }) // In handler const user = c.get('user') // or const user = c.var.user ``` ### Environment (Cloudflare Workers) ```ts const value = await c.env.KV.get('key') const db = c.env.DATABASE c.executionCtx.waitUntil(promise) ``` ### Renderer ```ts app.use(async (c, next) => { c.setRenderer((content) => c.html( <html><body>{content}</body></html> ) ) await next() }) app.get('/', (c) => c.render(<h1>Hello</h1>)) ``` --- ## HonoRequest (c.req) ```