Skip to content

Reusable Hono middleware patterns covering onion execution order, typed context variables, and built-in auth, CORS, and security handlers.

CCM score
57 of 100
skills.sh installs
462
GitHub stars
79
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers middleware creation with createMiddleware, onion-style execution order, and passing typed values between middleware through context variables
  • Includes examples for CORS, bearer, basic, and JWT auth, logging, compression, ETag, caching, secure headers, CSRF, timeout, and request IDs
  • Shows that middleware registered earlier wraps later handlers, so code after await next() runs in reverse order
  • Designed for Hono web applications that need authentication, CORS, logging, or custom request processing

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill hono-middleware -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Hono Middleware Patterns

Overview

Hono provides a powerful middleware system with an "onion" execution model. Middleware processes requests before handlers and responses after handlers, enabling cross-cutting concerns like authentication, logging, and CORS.

Key Features:

  • Onion-style execution order
  • Type-safe middleware creation with createMiddleware
  • 25+ built-in middleware
  • Context variable passing between middleware
  • Async/await support throughout

When to Use This Skill

Use Hono middleware when:

  • Adding authentication/authorization
  • Implementing CORS for cross-origin requests
  • Adding request logging or timing
  • Compressing responses
  • Rate limiting API endpoints
  • Validating requests before handlers

Middleware Basics

Inline Middleware

import { Hono } from 'hono'

const app = new Hono()

// Simple logging middleware
app.use('*', async (c, next) => {
  console.log(`[${c.req.method}] ${c.req.url}`)
  await next()
})

// Path-specific middleware
app.use('/api/*', async (c, next) => {
  const start = Date.now()
  await next()
  const ms = Date.now() - start
  c.header('X-Response-Time', `${ms}ms`)
})

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Categories
Backend & APIs, Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the hono-middleware skill do?

The hono-middleware skill covers Hono middleware patterns, including creating middleware, composing it, using built-in middleware, and understanding execution order in web applications. It explains the onion execution model, where middleware runs before handlers and again on the way out. It also shows how to pass data between middleware with context variables.

How do I install the hono-middleware skill?

Run npx -y skills add bobmatnyc/claude-mpm-skills --skill hono-middleware -y in your project. Once installed, the agent can apply Hono middleware such as CORS, bearer and JWT auth, logging, compression and secure headers to your routes.

Which category is hono-middleware in, and what else is there?

The hono-middleware skill sits in the Backend & APIs category on Claude Marketplaces. Other skills in that category that lead it include entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. This skill is focused specifically on middleware for Hono applications.

More from bobmatnyc/claude-mpm-skills

All 154

Similar to Hono Middleware

More Backend & APIs