Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jezweb avatar

Hono Api Scaffolder

  • 1.4k installs
  • 946 repo stars
  • Updated July 2, 2026
  • jezweb/claude-skills

hono-api-scaffolder is an agent skill that scaffolds Hono API routes on Cloudflare Workers with Zod validation and endpoint documentation.

About

The hono-api-scaffolder skill adds structured API routes to an existing Cloudflare Workers project after cloudflare-worker-builder or vite-flare-starter setup. It gathers endpoints grouped by resource such as users, posts, and auth, then creates one route file per group using Hono with typed Env bindings and @hono/zod-validator schemas. Patterns cover GET list and detail routes, POST with Zod body validation, PUT updates, DELETE handlers, and consistent JSON error responses. Middleware includes CORS, logging, and auth stubs wired in src/index.ts with app.route mounts under /api. The skill generates API_ENDPOINTS.md documenting methods, paths, request bodies, and response shapes. Templates live in assets/route-template.ts for consistent CRUD scaffolding. Use when developers need Hono endpoints, validation, and documentation on Workers with D1 or other bindings.

  • Creates per-resource Hono route files with typed Cloudflare Env bindings.
  • Uses Zod validators via @hono/zod-validator for request body schemas.
  • Generates API_ENDPOINTS.md documenting routes, bodies, and responses.
  • Runs after cloudflare-worker-builder or vite-flare-starter project shell exists.
  • Includes middleware patterns for CORS, logging, and auth stubs.

Hono Api Scaffolder by the numbers

  • 1,381 all-time installs (skills.sh)
  • +25 installs in the week ending Jul 29, 2026 (Skillselion tracking)
  • Ranked #333 of 4,353 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 31, 2026 (Skillselion catalog sync)
At a glance

hono-api-scaffolder capabilities & compatibility

Capabilities
per resource hono route file generation · zod request validation middleware · typed cloudflare env bindings · api_endpoints.md documentation output · crud route templates with error handling
Works with
cloudflare
Use cases
api development · documentation
From the docs

What hono-api-scaffolder says it does

Scaffold Hono API routes for Cloudflare Workers.
SKILL.md
npx skills add https://github.com/jezweb/claude-skills --skill hono-api-scaffolder

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.4k
repo stars946
Security audit3 / 3 scanners passed
Last updatedJuly 2, 2026
Repositoryjezweb/claude-skills

How do I add structured Hono API routes with validation and docs to my Cloudflare Workers project?

Scaffold Hono API routes on Cloudflare Workers with Zod validation, typed bindings, middleware, and API_ENDPOINTS.md docs.

Who is it for?

Developers extending Cloudflare Workers projects with Hono CRUD routes and validated JSON APIs.

Skip if: Skip for greenfield Worker setup without an existing project shell from related builder skills.

When should I use this skill?

User adds API routes to a Hono Workers project, creates endpoints, or needs API documentation generation.

What you get

Route files per resource, middleware wiring, typed bindings, and API_ENDPOINTS.md for the new endpoints.

  • Hono route source files
  • Auth and error middleware
  • API_ENDPOINTS.md

By the numbers

  • Ships route-template.ts, middleware-template.ts, and error-handler.ts asset templates
  • Produces API_ENDPOINTS.md endpoint documentation file

Files

SKILL.mdMarkdownGitHub ↗

Hono API Scaffolder

Add structured API routes to an existing Cloudflare Workers project. This skill runs AFTER the project shell exists (via cloudflare-worker-builder or vite-flare-starter) and produces route files, middleware, and endpoint documentation.

Workflow

Step 1: Gather Endpoints

Determine what the API needs. Either ask the user or infer from the project description. Group endpoints by resource:

Users:    GET /api/users, GET /api/users/:id, POST /api/users, PUT /api/users/:id, DELETE /api/users/:id
Posts:    GET /api/posts, GET /api/posts/:id, POST /api/posts, PUT /api/posts/:id
Auth:     POST /api/auth/login, POST /api/auth/logout, GET /api/auth/me

Step 2: Create Route Files

One file per resource group. Use the template from assets/route-template.ts:

// src/routes/users.ts
import { Hono } from 'hono'
import { zValidator } from '@hono/zod-validator'
import { z } from 'zod'
import type { Env } from '../types'

const app = new Hono<{ Bindings: Env }>()

// GET /api/users
app.get('/', async (c) => {
  const db = c.env.DB
  const { results } = await db.prepare('SELECT * FROM users').all()
  return c.json({ users: results })
})

// GET /api/users/:id
app.get('/:id', async (c) => {
  const id = c.req.param('id')
  const user = await db.prepare('SELECT * FROM users WHERE id = ?').bind(id).first()
  if (!user) return c.json({ error: 'Not found' }, 404)
  return c.json({ user })
})

// POST /api/users
const createUserSchema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
})

app.post('/', zValidator('json', createUserSchema), async (c) => {
  const body = c.req.valid('json')
  // ... insert logic
  return c.json({ user }, 201)
})

export default app

Step 3: Add Middleware

Based on project needs, add from assets/middleware-template.ts:

Auth middleware — protect routes requiring authentication:

import { createMiddleware } from 'hono/factory'
import type { Env } from '../types'

export const requireAuth = createMiddleware<{ Bindings: Env }>(async (c, next) => {
  const token = c.req.header('Authorization')?.replace('Bearer ', '')
  if (!token) return c.json({ error: 'Unauthorized' }, 401)
  // Validate token...
  await next()
})

CORS — use Hono's built-in:

import { cors } from 'hono/cors'
app.use('/api/*', cors({ origin: ['https://example.com'] }))

Step 4: Wire Routes

Mount all route groups in the main entry point:

// src/index.ts
import { Hono } from 'hono'
import type { Env } from './types'
import users from './routes/users'
import posts from './routes/posts'
import auth from './routes/auth'
import { errorHandler } from './middleware/error-handler'

const app = new Hono<{ Bindings: Env }>()

// Global error handler
app.onError(errorHandler)

// Mount routes
app.route('/api/users', users)
app.route('/api/posts', posts)
app.route('/api/auth', auth)

// Health check
app.get('/api/health', (c) => c.json({ status: 'ok' }))

export default app

Step 5: Create Types

// src/types.ts
export interface Env {
  DB: D1Database
  KV: KVNamespace      // if needed
  R2: R2Bucket         // if needed
  API_SECRET: string   // secrets
}

Step 6: Generate API_ENDPOINTS.md

Document all endpoints. See references/endpoint-docs-template.md for the format:

## POST /api/users
Create a new user.
- **Auth**: Required (Bearer token)
- **Body**: `{ name: string, email: string }`
- **Response 201**: `{ user: User }`
- **Response 400**: `{ error: string, details: ZodError }`

Key Patterns

Zod Validation

Always validate request bodies with @hono/zod-validator:

import { zValidator } from '@hono/zod-validator'
app.post('/', zValidator('json', schema), async (c) => {
  const body = c.req.valid('json')  // fully typed
})

Install: pnpm add @hono/zod-validator zod

Error Handling

Use the standard error handler from assets/error-handler.ts:

export const errorHandler = (err: Error, c: Context) => {
  console.error(err)
  return c.json({ error: err.message }, 500)
}

API routes must return JSON errors, not redirects. fetch() follows redirects silently, then the client tries to parse HTML as JSON.

RPC Type Safety

For end-to-end type safety between Worker and client:

// Worker: export the app type
export type AppType = typeof app

// Client: use hc (Hono Client)
import { hc } from 'hono/client'
import type { AppType } from '../worker/src/index'

const client = hc<AppType>('https://api.example.com')
const res = await client.api.users.$get()  // fully typed

Route Groups vs Single File

Project sizeStructure
< 10 endpointsSingle index.ts with all routes
10-30 endpointsRoute files per resource (routes/users.ts)
30+ endpointsRoute files + shared middleware + typed context

Reference Files

WhenRead
Hono patterns, middleware, RPCreferences/hono-patterns.md
API_ENDPOINTS.md formatreferences/endpoint-docs-template.md

Assets

FilePurpose
assets/route-template.tsStarter route file with CRUD + Zod
assets/middleware-template.tsAuth middleware template
assets/error-handler.tsStandard JSON error handler

Related skills

How it compares

Pick hono-api-scaffolder for Hono routes on existing Cloudflare Workers; pick cloudflare-worker-builder first when the Worker project shell does not exist yet.

FAQ

What does hono-api-scaffolder produce?

Hono route files with Zod validation, middleware wiring, typed bindings, and API_ENDPOINTS.md documentation.

When should I use hono-api-scaffolder?

After a Cloudflare Workers project exists and you need to add structured Hono API routes and docs.

Is hono-api-scaffolder safe to install?

Review the Security Audits panel on this page before installing in production.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.