Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Scaffolds Hono routes for Cloudflare Workers with middleware, typed bindings, Zod validation, error handling, and endpoint documentation.
Use this skill ↓64% 86%+23 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 14 of 22 without it.
I need a standard health check endpoint in my main Hono index file that returns an operational status JSON response. What route path and response body should be defined?
Defines GET route path /api/health
3 of 3 safety checks passed
/**
* Route Template — [Resource Name]
*
* Copy this file to src/routes/[resource].ts and customise.
* Includes: list, get, create, update, delete with Zod validation.
*/
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 }>()
const createSchema = z.object({
name: z.string().min(1).max(100),
// Add fields here
})
const updateSchema = createSchema.partial()
// GET /api/[resource]
app.get('/', async (c) => {
const db = c.env.DB
const { results } = await db.prepare('SELECT * FROM [table] ORDER BY created_at DESC').all()
return c.json({ items: results })
})
// GET /api/[resource]/:id
app.get('/:id', async (c) => {
const id = c.req.param('id')
const item = await c.env.DB.prepare('SELECT * FROM [table] WHERE id = ?').bind(id).first()
if (!item) return c.json({ error: 'Not found' }, 404)
return c.json({ item })
})
// POST /api/[resource]
app.post('/', zValidator('json', createSchema), async (c) => {
const body = c.req.valid('json')
const id = crypto.randomUUID()
await c.env.DB.prepare('INSERT INTO [table] (id, name) VALUES (?, ?)').bind(id, body.name).run()Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.