create-middleware

Create reusable Hono middlewares with a factory pattern and dependency injection.

1|Updated May 21, 2025
One-click install
npx skills add https://github.com/madooei/backend-template --skill create-middleware
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-middleware
Source: https://github.com/madooei/backend-template/tree/main/.claude/skills/create-middleware
Command: npx skills add https://github.com/madooei/backend-template --skill create-middleware

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers scaffold reusable Hono middlewares quickly, enabling consistent patterns for authentication, validation, and error handling across API services.

Core Features & Use Cases

  • Factory-based middleware creation with dependency injection for configurable components.
  • Default, shareable middleware instances that can be plugged into multiple routes with minimal boilerplate.
  • Clear patterns for setting context data (e.g., c.set) and integrating with a global error handler.

Quick Start

Create a new middleware by implementing a factory with dependencies and export a default ready-to-use instance.

Frequently Asked Questions about create-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create reusable Hono middleware for authentication and validation?

You can scaffold reusable Hono middleware by implementing a factory pattern with dependency injection and exporting a default instance, enabling consistent authentication and validation across API routes.

What is the best way to configure middleware with dependency injection in a TypeScript REST API?

Using a factory pattern for Hono middleware allows you to inject configurable components into your TypeScript REST API, enabling flexible authentication and validation logic.

How does Hono middleware store context data for downstream route handlers?

Hono middleware stores context data using the c.set method, allowing authentication and validation logic to pass variables securely to downstream route handlers in your TypeScript API.

Can I use a single middleware instance across multiple Hono routes?

Yes, you can plug a single default middleware instance into multiple Hono routes with minimal boilerplate by exporting a ready-to-use instance from your factory pattern.

How do I handle errors globally when using custom Hono middleware?

To handle errors globally when using custom Hono middleware, integrate your error-handling logic with a global error handler, ensuring consistent validation and authentication failures across your API services.