بنقرة واحدة
hono
Lightweight edge/serverless APIs with Hono. Trigger: When building edge APIs or lightweight serverless apps.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Lightweight edge/serverless APIs with Hono. Trigger: When building edge APIs or lightweight serverless apps.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Paste-ready session summary for context transfer to a new chat. Trigger: User says 'context handoff', 'start fresh', or session needs to continue.
One-at-a-time questioning to fully profile a goal before acting. Trigger: User says 'grill me', goal is vague, or clarification is needed first.
Batch execution with checkpoints. Trigger: When executing plans with batched tasks.
Universal coding principles: DRY, security by default, null guards, and YAGNI. Trigger: When writing or reviewing code in any language or technology.
Accessibility guide (WCAG 2.1/2.2, Level A–AAA). Trigger: When building UI components, interactive elements, or auditing accessibility compliance.
Astro quality patterns: island philosophy, SEO by page type, and Core Web Vitals. Trigger: When reviewing Astro site quality or hydration decisions.
| name | hono |
| description | Lightweight edge/serverless APIs with Hono. Trigger: When building edge APIs or lightweight serverless apps. |
| license | Apache 2.0 |
| metadata | {"version":"1.1","type":"framework","dependencies":{"hono":">=3.0.0 <4.0.0"}} |
Lightweight, type-safe APIs for edge/serverless platforms.
Don't use for:
Method chaining for compact route groups.
// CORRECT: chained routes on a single app instance
const app = new Hono()
.get("/users", (c) => c.json(users))
.post("/users", (c) => c.json(created, 201))
.get("/users/:id", (c) => c.json(user));
// WRONG: separate app declarations or loose functions
app.use() for cross-cutting concerns; scope to paths.
// CORRECT: scoped middleware
app.use("*", logger());
app.use("*", cors());
app.use("/api/*", bearerAuth({ token: SECRET }));
// WRONG: auth middleware applied globally to public routes
@hono/zod-validator for body/param/query validation.
import { zValidator } from "@hono/zod-validator";
import { z } from "zod";
const CreateUser = z.object({ name: z.string(), email: z.string().email() });
app.post("/users", zValidator("json", CreateUser), (c) => {
const data = c.req.valid("json"); // fully typed
return c.json({ id: 1, ...data }, 201);
});
Use c.json(), c.text(), c.html() over manual Response.
// CORRECT: context helpers set headers automatically
app.get("/health", (c) => c.text("ok"));
app.get("/data", (c) => c.json({ status: "up" }));
app.get("/old", (c) => c.redirect("/new", 301));
// WRONG: new Response(JSON.stringify({ status: "up" }))
Access bindings via generic type parameter.
type Env = { Bindings: { DB: D1Database; KV: KVNamespace } };
const app = new Hono<Env>();
app.get("/items", async (c) => {
const result = await c.env.DB.prepare("SELECT * FROM items").all();
return c.json(result);
});
Cloudflare Workers?
→ Use Hono<{ Bindings: ... }> for typed env
Need validation?
→ Use @hono/zod-validator middleware
Sub-routes?
→ Use app.route("/prefix", subApp)
Auth required?
→ Scope bearerAuth or custom middleware to protected paths
Returning JSON?
→ Always use c.json() with explicit status codes
Streaming response?
→ Use c.stream() or c.streamText()
Multiple platforms?
→ Use adapter exports (hono/cloudflare-workers, hono/bun)
import { Hono } from "hono";
import { logger } from "hono/logger";
import { zValidator } from "@hono/zod-validator";
import { z } from "zod";
const app = new Hono();
app.use("*", logger());
const ItemSchema = z.object({ name: z.string(), price: z.number().positive() });
app.get("/items", (c) => c.json(items));
app.post("/items", zValidator("json", ItemSchema), (c) => {
const data = c.req.valid("json");
return c.json({ id: crypto.randomUUID(), ...data }, 201);
});
export default app;
c.stream() for chunked; not all platforms support full streaming.c.req.json(); multipart needs hono/multipart.c.req.param() are strings; parse to numbers before DB.cors() before handlers for OPTIONS.app.route() for sub-appszValidator and Zod schemasc.json, c.text) with explicit status codes