Skip to content
Skills Library
Programming · Building & coding

hono-guide

/hono-guide

Use when editing or scaffolding Hono 4.0+ API servers in TypeScript. Triggers on `.ts` files with `hono` or `@hono/*` imports, route handlers, middleware, and prompts about validation, error handling, WebSockets, CORS, or building an HTTP API in Hono, even when the user doesn't say 'Hono'.

Repository
platform ↗
Licence
MIT
Last repository change
08.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
15
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when editing or scaffolding Hono 4.0+ API servers in TypeScript. Triggers on `.ts` files with `hono` or `@hono/*` imports, route handlers, middleware, and prompts about validation, error handling, WebSockets, CORS, or building an HTTP API in Hono, even when the user doesn't say 'Hono'.

Triggers from the description

t say
Original author description

Use when editing or scaffolding Hono 4.0+ API servers in TypeScript. Triggers on `.ts` files with `hono` or `@hono/*` imports, route handlers, middleware, and prompts about validation, error handling, WebSockets, CORS, or building an HTTP API in Hono, even when the user doesn't say 'Hono'.

How it works

  1. Requirements
  2. Essentials
  3. Example
  4. Gotchas
  5. Progressive disclosure
Original SKILL.md headings · 54 lines, 367 words
SKILL.md preview
---
name: hono-guide
description: "Use when editing or scaffolding Hono 4.0+ API servers in TypeScript. Triggers on `.ts` files with `hono` or `@hono/*` imports, route handlers, middleware, and prompts about validation, error handling, WebSockets, CORS, or building an HTTP API in Hono, even when the user doesn't say 'Hono'."
---

# Hono Coding Guidelines

Build typed Hono APIs with explicit validation, middleware order, and error responses.

## Requirements

- Hono ≥ 4.0, @hono/node-server, @hono/zod-validator, TypeScript ≥ 5.8

## Essentials

- **Factory functions** - Use for testability and domain organization, see [references/application-structure.md](references/application-structure.md)
- **Type-safe validation** - Recover types at the `c.req.valid` boundary; schema design in **zod-guide**, see [references/validation-type-safety.md](references/validation-type-safety.md)
- **Middleware configuration** - Use factories for CORS, composition with `some()`/`every()`/`except()`, see [references/middleware-patterns.md](references/middleware-patterns.md), [references/middleware-combine.md](references/middleware-combine.md)
- **WebSocket helpers** - Keep object references to maintain `this` binding, see [references/websocket-support.md](references/websocket-support.md)
- **Error responses** - Use RFC 9457 Problem Details with `application/problem+json`, see [references/error-handling.md](references/error-handling.md)
- **Security middleware** - Apply `secureHeaders()` for security headers, see [references/security-middleware.md](references/security-middleware.md)
- **Cookie handling** - Set secure options explicitly, use signed cookies, see [references/cookie-handling.md](references/cookie-handling.md)
- **Platform portability** - Use `env(c)` for environment, `getRuntimeKey()` for detection, see [references/platform-runtime.md](references/platform-runtime.md)

## Example

```typescript
import {Hono} from "hono";
import {secureHeaders} from "hono/secure-headers";

export function createApp() {
  const app = new Hono();
  app.use("*", secureHeaders());
  app.route("/api/v1", v1Router);
  return app;
}
```

## Gotchas

- `c.req.valid('json')` is typed by inference only when `zValidator` is chained inline on the route; an imported base-`Context` controller sees `any`, so cast there, but that cast is unchecked and can hide schema drift
- Middleware runs in the order it's registered: auth before routes, error handlers last; ordering bugs cause silent 200s on protected routes
- `env(c)` is the portable way to read env vars across runtimes: `process.env` works on Node but not Workers/Deno
- WebSocket helpers capture `this` from the closing object: assigning the handler to a variable loses the binding

## Progressive disclosure

- Read [references/application-structure.md](references/application-structure.md) - Load when organizing a new Hono application
- Read [references/validation-type-safety.md](references/validation-type-safety.md) - Load when losing type safety after validation
- Read [references/middleware-patterns.md](references/middleware-patterns.md) - Load when creating reusable middleware or configuring CORS
- Read [references/websocket-support.md](references/websocket-support.md) - Load when implementing WebSocket endpoints
- Read [references/error-handling.md](references/error-handling.md) - Load when standardizing error responses across routes
- Read [references/security-middleware.md](references/security-middleware.md) - Load when configuring auth, CSRF, or security headers
- Read [references/cookie-handling.md](references/cookie-handling.md) - Load when managing sessions or sensitive cookies
- Read [references/context-storage.md](references/context-storage.md) - Load when accessing Context outside handlers
- Read [references/middleware-combine.md](references/middleware-combine.md) - Load when composing complex middleware logic
- Read [references/platform-runtime.md](references/platform-runtime.md) - Load when deploying across multiple runtimes
Files in this package (15)
  • SKILL.md 4 KB
  • SOURCES.md 2 KB
  • eval-queries.json 5 KB
  • evals.json 2 KB
  • moon.yml 1 KB
  • references/application-structure.md 1 KB
  • references/context-storage.md 1 KB
  • references/cookie-handling.md 1 KB
  • references/error-handling.md 1 KB
  • references/middleware-combine.md 1 KB
  • references/middleware-patterns.md 1 KB
  • references/platform-runtime.md 1 KB
  • references/security-middleware.md 1 KB
  • references/validation-type-safety.md 2 KB
  • references/websocket-support.md 1 KB

Versions

The database has no other skills named hono-guide.

Database snapshot: 13.11.2026 · package version 38e53c90ac2c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90hono
    Hono patterns for TypeScript API routes, middleware, request and response typing, streaming, WebSockets, and Cloudflare Workers deployment. Use when users mention Hono, honojs, Cloudflare Worker handlers, Hono middleware, or Hono route typing.
  • 95hono
    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.
  • 95hono
    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.
  • 95hono
    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 `npx hono request` to test endpoints.
  • 95hono-helper
    Hono web framework for edge-first, lightweight APIs - routing, middleware, validation, and multi-runtime support When user works with Hono, builds APIs, creates middleware, uses Zod validation with Hono, or mentions hono patterns
  • 100hono
    Use when building Hono APIs across edge, Bun, Deno, Node, or serverless runtimes, including middleware, routing, validation, and RPC clients.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.