hono
БесплатноБез исполняемых скриптовНе проверенUse when building Hono web applications or when the user asks about Hono APIs, routing, middleware, JSX, validation, testing, or streaming. TRIGGER when code…
от honojs★ 21 звезда на GitHubОб этом скилле
Hono Skill
Build Hono web applications. This skill provides inline API knowledge for AI. Use Hono CLI to inspect and test the app.
Latest Documentation
For details beyond this inline reference, fetch the latest documentation from https://hono.dev. Get the index of doc pages from https://hono.dev/llms.txt, then fetch a page with the Accept: text/markdown header to receive it as Markdown:
curl -H "Accept: text/markdown" https://hono.dev/docs/helpers/cookie
Hono CLI
Verify with Hono CLI, not with throwaway scripts or a dev server. It is a dev dependency (projects from create-hono already have it), loads the app in-process with app.request(), and prints JSON. Install it if missing, then read its help:
npm install -D @hono/cli@next
npx hono --help
Follow the note at the top. It explains the JSON output contract and the workflow. npx hono <command> --help has examples and notes for each command (routes, request, batch, snapshot, benchmark, ssg, init).
Notes:
npx hono routeslists the routes;npx hono request /pathsends one request — no server needed. If the app is not at the default path (src/index.ts), pass the file to every command:npx hono request / src/app.ts. Do not pass credentials directly in CLI arguments; use environment variables for sensitive values.Cloudflare bindings (KV, D1, R2, vars) reach
c.envautomatically — no server, no flag. In a project withcloudflare.config.ts(thecfCLI) and a Vite config,request,batch, andsnapshotrun through the Vite dev server by default, andc.envhas the local bindings;requestandbatchdefault to Vite as well in a Vite project with nosrc/index.*(an app built by a Vite plugin;snapshotstill needs the file), and--runtime viteselects it explicitly. In a project with a wrangler config, the app runs on Node.js with the real local bindings loaded; for the full Workers runtime there, add--runtime workerd(pass no file argument; the entry ismainin the wrangler config).--trace,--watch, and a file argument run the app on Node.js, wherec.envis empty in acfproject.routesandsnapshotalso load apps that importcloudflare:workers(Durable Objects); the import is stubbed while the routes are read.To add a Hono app to an existing directory, run
npx hono init --template cloudflare-workers(ornodejs,bun,deno, ...; without--templateit is detected from the files in the directory), then install the dependencies. It copies thecreate-honotemplate and never overwrites an existing file. For an empty directory,npm create hono@nextdoes the same with prompts.For several requests, or a flow that keeps state (POST, then use the returned id), run them in one
hono batch -call. One JSON object per line;savea value and use it as{{id}}in later steps. The steps share one app instance. Declare the expected status/body per step withexpect(body is a deep partial match) and iterate until the summary shows"failed": 0:npx hono batch - <<'EOF' {"method":"POST","path":"/users","body":{"name":"Alice"},"save":{"id":".id"},"expect":{"status":201}} {"path":"/users/{{id}}","expect":{"status":200,"body":{"name":"Alice"}}} EOFBefore changing existing routes, capture the current behavior:
npx hono snapshotprints it as batch JSONL lines (real responses become theexpect). Keep the lines, make the change, then rerun them withnpx hono batch -until"failed": 0.On a large API, use
npx hono snapshot --status-onlyandnpx hono batch - --compact— same loop, much smaller output. A failed step carriesdiff: fix what it names.
Hono API Reference
App Constructor
import { Hono } from 'hono'
const app = new Hono()
// With TypeScript generics
type AppEnv = {
Bindings: Env // generated from the bindings config — see "Environment (Cloudflare Workers)"
Variables: { user: User }
}
const app = new Hono<AppEnv>()
Routing Methods
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
// 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('Wildc
Установить hono в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл hono?
Use when building Hono web applications or when the user asks about Hono APIs, routing, middleware, JSX, validation, testing, or streaming. TRIGGER when code imports from 'hono' or 'hono/*', or user mentions Hono. Use Hono CLI to inspect and test the app.
Как установить скилл hono?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hono запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic