xiaohongshu
xiaohongshu
hono-app-scaffold
Use this skill whenever the user wants to create, restructure, or standardize a Hono + TypeScript backend/API project, including project layout, runtime targeting (Node/Cloudflare/Vercel Edge), routing structure, middleware, env handling, and basic error handling.
Full skill instructions
You are a specialized assistant for bootstrapping and reshaping Hono-based backends/APIs in TypeScript.
Use this skill to:
routes/)Do not use this skill for:
hono-authentication (once defined)typeorm-*)If CLAUDE.md exists, follow its conventions (runtime choice, folder structure, linting tools, etc.).
Trigger this skill when the user asks for something like:
Avoid when:
Unless the project or CLAUDE.md says otherwise, assume:
Language: TypeScript
Package manager preference:
pnpm if pnpm-lock.yaml existsyarn if yarn.lock existsnpmRuntime: depends on context; default to Node when not specified, but be ready to target:
serve/listen)Testing: may be added later (Vitest/Jest + supertest/undici)
This skill should tailor the scaffold to the declared runtime when it’s clear.
This skill aims to create or converge towards something like:
project-root/
src/
app.ts # main Hono app builder (routes + middleware)
index.ts # runtime-specific entry (Node, Cloudflare, etc.)
routes/
index.ts # main router aggregator
health.routes.ts
v1/
users.routes.ts
auth.routes.ts
middlewares/
logger.ts
error-handler.ts
cors.ts
config/
env.ts # env loading per runtime
runtime.ts # runtime-specific helpers if needed
types/
env.d.ts # bindings/env typing for Workers/Cloudflare
test/
app.spec.ts # basic smoke/e2e tests (optional stub)
.env.example # for Node/Bun/Vercel environments
tsconfig.json
package.json
README.md
For Cloudflare Workers, also expect:
wrangler.toml
This layout can be adjusted to fit monorepos (e.g. apps/hono-api/), but the internal structure
under src/ should remain consistent.
When this skill is active, follow this process:
hono and runtime-specific packages (e.g. @hono/node-server, @cloudflare/workers-types if needed).src/ with app.ts, routes/, middlewares/, config/.index.ts):
src/app.ts + src/routes/* + src/middlewares/*.Depending on context:
Use @hono/node-server:
// src/index.ts
import { serve } from "@hono/node-server";
import { app } from "./app";
const port = Number(process.env.PORT ?? 3000);
console.log(`Listening on http://localhost:${port}`);
serve({
fetch: app.fetch,
port,
});
Export app.fetch as the Worker handler:
// src/index.ts
import { app } from "./app";
export default {
fetch: app.fetch,
};
Configure wrangler.toml outside this skill or with minimal defaults if necessary.
This skill should pick the right pattern based on what’s already present or user preference.
app.ts)Create a central Hono app with basic middleware + routes:
// src/app.ts
import { Hono } from "hono";
import { loggerMiddleware } from "./middlewares/logger";
import { errorHandler } from "./middlewares/error-handler";
import { corsMiddleware } from "./middlewares/cors";
import { bindRoutes } from "./routes";
export const app = new Hono();
app.use("*", loggerMiddleware);
app.use("*", corsMiddleware);
app.use("*", errorHandler);
bindRoutes(app);
Or, if project prefers, mount middleware per route group instead of globally.
Use routes/index.ts as a router aggregator:
// src/routes/index.ts
import type { Hono } from "hono";
import { healthRoutes } from "./health.routes";
import { createV1Routes } from "./v1";
export function bindRoutes(app: Hono) {
app.route("/health", healthRoutes());
app.route("/v1", createV1Routes());
}
Example health.routes.ts:
// src/routes/health.routes.ts
import { Hono } from "hono";
export function healthRoutes() {
const app = new Hono();
app.get("/", (c) => c.json({ status: "ok" }));
return app;
}
Example /v1 router:
// src/routes/v1/index.ts
import { Hono } from "hono";
import { usersRoutes } from "./users.routes";
export function createV1Routes() {
const app = new Hono();
app.route("/users", usersRoutes());
return app;
}
Example users routes skeleton:
// src/routes/v1/users.routes.ts
import { Hono } from "hono";
export function usersRoutes() {
const app = new Hono();
app.get("/", async (c) => {
// list users
return c.json([]);
});
app.post("/", async (c) => {
// create user
const body = await c.req.json();
return c.json({ id: "1", ...body }, 201);
});
app.get("/:id", async (c) => {
const id = c.req.param("id");
return c.json({ id });
});
return app;
}
This skill should keep routes small and composable.
// src/middlewares/logger.ts
import type { MiddlewareHandler } from "hono";
export const loggerMiddleware: MiddlewareHandler = async (c, next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
console.log(`${c.req.method} ${c.req.path} - ${ms}ms`);
};
// src/middlewares/error-handler.ts
import type { MiddlewareHandler } from "hono";
export const errorHandler: MiddlewareHandler = async (c, next) => {
try {
await next();
} catch (err: any) {
console.error("Unhandled error:", err);
return c.json(
{
message: "Internal Server Error",
},
500,
);
}
};
Either a custom or hono/cors helper:
// src/middlewares/cors.ts
import type { MiddlewareHandler } from "hono";
import { cors } from "hono/cors";
// If project is fine with the helper:
export const corsMiddleware: MiddlewareHandler = cors({
origin: "*", // adjust for security
allowMethods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
});
This skill should:
For Node/Vercel/Bun env:
// src/config/env.ts
export type AppEnv = {
NODE_ENV: "development" | "test" | "production";
PORT?: string;
DATABASE_URL?: string;
};
export function getEnv(): AppEnv {
return {
NODE_ENV: (process.env.NODE_ENV as AppEnv["NODE_ENV"]) ?? "development",
PORT: process.env.PORT,
DATABASE_URL: process.env.DATABASE_URL,
};
}
For Cloudflare Workers:
env via c.env and Env interface:// src/types/env.d.ts
export interface Env {
DATABASE_URL: string;
// other bindings like R2, KV, etc.
}
// usage in route
app.get("/config", (c) => {
const env = c.env as Env;
return c.json({ db: env.DATABASE_URL });
});
This skill should:
process.env in Workers-only code.Add or update README.md with:
Add package.json scripts (example for Node):
{
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc -p tsconfig.json",
"start": "node dist/index.js",
"lint": "eslint ."
}
}
For Workers, may add wrangler dev and wrangler publish scripts.
This skill prepares the ground for:
hono-authentication:
/v1/auth.hono-typeorm-backend:
hono-edge-and-workers:
For these prompts, rely on this skill to generate or refactor a clean, extensible Hono app skeleton that other backend skills can build on.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience