Agent skill · software engineering · secondsky
hono-routing
Type-safe Hono APIs with routing, middleware, RPC. Use for request validation, Zod/Valibot validators, or encountering middleware type inference, validation hook, RPC errors.
Why this skill is useful
Provides type-safe middleware patterns and validation techniques for Hono APIs that the AI wouldn't reliably generate on its own.
What it needs
Requires bun installed locally. About 8k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.
What this skill does
Hono Routing & Middleware Status: Production Ready ✅ Last Updated: 2025-11-21 Dependencies: None (framework-agnostic) Latest Versions: hono@4.12.12, zod@4.3.6, valibot@1.1.0 --- Quick Start (5 Minutes) Install Why Hono: Fast: Built on Web Standards, runs on any JavaScript runtime Lightweight: ~10KB, no dependencies Type-safe: Full TypeScript support with type inference Flexible: Works on Cloudflare Workers, Deno, Bun, Node.js, Vercel Basic App CRITICAL: Use c.json(), c.text(), c.html() for responses Return the response (don't use res.send() like Express) Export app for runtime Add Validation --- Critical Rules Always Do ✅ Return responses from handlers (c.json, c.text, c.html, etc.) ✅ Use c.req.valid('source') after validation middleware to get typed data ✅ Export app for deployment (Cloudflare Workers, Bun, Deno, Node.js) ✅ Use validation middleware (zValidator, vValidator) for type-safe request data ✅ Call await next() in middleware to pass control to next handler ✅ Use HTTPException for expected errors (returns proper HTTP status) ✅ Use template tag validators (zValidator, vValidator) not hooks ✅ Define context types for custom variables (Hono<{ Variables: { ... } }>) ✅ Use sub-apps (app.route()) for organizing large APIs ✅ Type your RPC routes (export type AppType = typeof routes) for client Never Do ❌ Never forget to return response from handlers ❌ Never use req.json() directly without validation - use c.req.valid() ❌ Never mix validation hooks with middleware - use middleware only ❌ Never forget await next() in middleware - breaks middleware chain ❌ Never use res.send() - not available (use c.json(), c.text(), etc.) ❌ Never skip error handling - use app.onError() for global handler ❌ Never access unvalidated data after validation middleware ❌ Never use blocking operations in middleware - breaks async chain ❌ Never hardcode origins in CORS - use environment variables ❌ Never skip type exports for RPC - client won't have types --- Top 5 Errors (See references/to …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills secondsky/hono-routing