Skip to content
Back to skills

Using Hono Opinionated

ASecurity

Use when writing Hono APIs with inline OpenAPI route schemas, an explicit router choice, sync handlers, and request body limits. Triggers on `.ts` files with `OpenAPIHono`, `LinearRouter`, `RegExpRouter`, `bodyLimit`, router speed, payload limits, or sync versus async handlers, even when the user doesn't say 'opinionated'.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentstypescriptgonodetestingapisecuritydocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add xonovex/platform --skill using-hono-opinionated --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Using Hono Opinionated?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Using Hono Opinionated
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xonovex-using-hono-opinionated/badge)](https://www.skillsdirectory.com/skills/xonovex-using-hono-opinionated)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: using-hono-opinionated
description: "Use when writing Hono APIs with inline OpenAPI route schemas, an explicit router choice, sync handlers, and request body limits. Triggers on `.ts` files with `OpenAPIHono`, `LinearRouter`, `RegExpRouter`, `bodyLimit`, router speed, payload limits, or sync versus async handlers, even when the user doesn't say 'opinionated'."
---

# Hono Opinionated Guidelines

An overlay on **using-hono**. Apply **using-hono** for all generic Hono work: application structure, validation/type safety, middleware patterns and combination, error handling, cookies, security, WebSockets, context storage, platform runtimes. This skill adds only the opinionated decisions on top.

## Requirements

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

## Opinionated patterns

- **Foundation** - Everything generic lives in **using-hono**; this skill layers OpenAPI-first conventions on top

- **Async controllers** - Remove unnecessary `async` from synchronous handlers, see [references/controllers.md](references/controllers.md)
- **OpenAPIHono hierarchy** - Every router in the chain must be `OpenAPIHono`, see [references/openapi-router-hierarchy.md](references/openapi-router-hierarchy.md)
- **OpenAPI documentation** - Use `app.doc()` for automatic spec generation, see [references/openapi-spec-generation.md](references/openapi-spec-generation.md)
- **Router selection** - RegExpRouter for high-throughput persistent servers, see [references/router-selection.md](references/router-selection.md)
- **Request limits** - Use `bodyLimit` middleware to prevent DoS, see [references/body-limit.md](references/body-limit.md)

## Example

```typescript
import {OpenAPIHono} from "@hono/zod-openapi";
import {bodyLimit} from "hono/body-limit";
import {secureHeaders} from "hono/secure-headers";

export function createApp() {
  const app = new OpenAPIHono();
  app.use("*", secureHeaders());
  app.use("*", bodyLimit({maxSize: 100 * 1024}));
  app.route("/api/v1", v1Router);
  app.doc("/openapi.json", {
    openapi: "3.1.0",
    info: {title: "API", version: "1.0.0"},
  });
  return app;
}
```

## Gotchas

- Router hierarchy: parent routes inherit middleware; mounting a sub-router with `.route()` runs the parent middleware first
- Picking the router (RegExpRouter / SmartRouter / TrieRouter / PatternRouter) is a startup decision: switching requires testing all routes

## Progressive disclosure

- Read [references/controllers.md](references/controllers.md) - Load when seeing unnecessary async functions
- Read [references/openapi-router-hierarchy.md](references/openapi-router-hierarchy.md) - Load when composing multiple routers
- Read [references/openapi-spec-generation.md](references/openapi-spec-generation.md) - Load when generating OpenAPI documentation
- Read [references/router-selection.md](references/router-selection.md) - Load when optimizing for high-throughput persistent servers
- Read [references/body-limit.md](references/body-limit.md) - Load when preventing oversized request payloads

Files in this skill

  • SKILL.md3 KB
  • eval-output.json2.8 KB
  • eval-trigger.json5.7 KB
  • moon.yml118 B
  • references/body-limit.md414 B
  • references/controllers.md648 B
  • references/openapi-router-hierarchy.md633 B
  • references/openapi-spec-generation.md540 B
  • references/router-selection.md493 B
  • sources.json2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.