一键导入
tpl-backend-hono-bun
Template do pack (backend/08-hono-bun.md). Orienta o agente em APIs, servicos e arquitetura backend alinhado a esse contexto.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Template do pack (backend/08-hono-bun.md). Orienta o agente em APIs, servicos e arquitetura backend alinhado a esse contexto.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate custom favicons from logos, text, or brand colours. Produces favicon.svg, favicon.ico, apple-touch-icon.png, icon-192/512.png, and web manifest. Use whenever the user wants a favicon, mentions replacing a CMS default favicon, converting a logo into a favicon, creating branded initials icons, or troubleshooting favicon not displaying / iOS black square / missing manifest.
"Get a second opinion from leading AI models on code, architecture, strategy, prompting, or anything. Queries models via OpenRouter, Gemini, or OpenAI APIs. Supports single opinion, multi-model consensus, and devil's advocate patterns. Use whenever the user says 'brains trust', 'second opinion', 'ask gemini', 'ask gpt', 'peer review', 'consult another model', 'challenge this', or 'devil's advocate'."
Run an independent code review using the OpenAI Codex CLI in headless mode. Gets a second opinion from a different model family (GPT-5/o3) on recent changes, a PR, a commit, or the whole app — covering bugs, regressions, security, data consistency, UX/state bugs, performance risks, and testing gaps. Saves a severity-prioritised report to .jez/reviews/. Triggers: 'codex review', 'review with codex', 'second opinion on this code', 'independent code review', 'what does codex think', 'get codex to review'.
Deep research and discovery before building something new. Explores local projects for reusable code, researches competitors, reads forums and reviews, analyses plugin ecosystems, investigates technical options, and produces a comprehensive research brief. Three depths: focused (30 min), wide (1-2 hours), deep (3-6 hours). Triggers: 'research this', 'deep research', 'discovery', 'explore the space', 'what should I build', 'competitive analysis', 'before I start building', 'research before coding'.
Plan and execute entire application builds. Generates phased delivery roadmaps, then executes them autonomously — phase by phase, committing at milestones, deploying, testing, and continuing until done or stuck. Modes: plan (generate roadmap), start (begin executing), resume (continue from where you left off), status (show progress). Triggers: 'roadmap', 'plan the build', 'start building', 'resume the build', 'keep going', 'build the whole thing', 'execute the roadmap', 'what phase are we on'.
Walk through a live web app AS a real user to find usability + behavioural bugs that static reviews miss. REQUIRES proof of interaction (typing, clicking, sending, observing) before any verdict — a sweep that didn't interact terminates with verdict 'Incomplete'. Walks threads, exercises every element, runs the multi-pane stress matrix, visual polish sweep, component perfection checklist, automated a11y (axe-core), pragmatic performance budget (LCP/CLS/INP), scenario battery (11 scenarios), and stress recipes including the real-flavour data battery. Hard gates: console errors/warnings = 0, network 5xx = 0, layout collapse = 0, axe Critical/Serious = 0, perf budget green. Audit-the-audit meta-check rejects rushed reports. Each finding has reproduction steps, evidence path, and suspected code location. Trigger with 'ux audit', 'walkthrough', 'qa sweep', 'audit the app', 'dogfood this', 'check all pages', 'find what's broken', 'stress the UI'.
| name | tpl-backend-hono-bun |
| description | Template do pack (backend/08-hono-bun.md). Orienta o agente em APIs, servicos e arquitetura backend alinhado a esse contexto. |
| metadata | {"version":"1.0.0","source_template":"backend/08-hono-bun.md","generated_by":"install_pack_templates_as_claude_skills"} |
Skill gerado a partir do pack templates-claude-code. Arquivo de origem: backend/08-hono-bun.md. Use como baseline e adapte ao projeto antes de mudancas grandes.
src/
├── index.ts # App entry, route mounting
├── env.ts # Zod-validated env vars
├── db/
│ ├── index.ts # Drizzle client + connection
│ ├── schema.ts # All table definitions
│ └── migrations/ # Drizzle generated migrations
├── routes/
│ ├── users.ts
│ ├── posts.ts
│ └── auth.ts
├── middleware/
│ ├── auth.ts # JWT verification
│ ├── logger.ts
│ └── rate-limit.ts
├── lib/
│ ├── errors.ts # Custom error classes
│ └── response.ts # Typed response helpers
└── types.ts # Env + Variables types
tests/
├── routes/
│ └── users.test.ts
└── helpers/
└── app.ts # Test app factory
Hono instance — never export raw handlers.c.var for typed middleware state — define in Variables type; never use c.set with untyped keys.zValidator, query via zValidator('query', ...).AppType from index.ts for type-safe client usage.any types — use unknown + zod parse at the boundary.// src/types.ts
import type { Context } from 'hono'
import type { User } from './db/schema'
export type Variables = {
user: User
requestId: string
}
export type Env = {
Variables: Variables
Bindings: {
DATABASE_URL: string
JWT_SECRET: string
}
}
// src/middleware/auth.ts
import { createMiddleware } from 'hono/factory'
import { HTTPException } from 'hono/http-exception'
import { verify } from 'hono/jwt'
import { db } from '../db'
import { users } from '../db/schema'
import { eq } from 'drizzle-orm'
import type { Env } from '../types'
export const authMiddleware = createMiddleware<Env>(async (c, next) => {
const token = c.req.header('Authorization')?.replace('Bearer ', '')
if (!token) throw new HTTPException(401, { message: 'No token provided' })
const payload = await verify(token, c.env.JWT_SECRET).catch(() => {
throw new HTTPException(401, { message: 'Invalid token' })
})
const user = await db.select().from(users).where(eq(users.id, payload.sub as string)).get()
if (!user) throw new HTTPException(401, { message: 'User not found' })
c.set('user', user)
await next()
})
// src/db/schema.ts
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core'
import { createId } from '@paralleldrive/cuid2'
export const users = sqliteTable('users', {
id: text('id').primaryKey().$defaultFn(() => createId()),
email: text('email').notNull().unique(),
name: text('name').notNull(),
createdAt: integer('created_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),
})
export const posts = sqliteTable('posts', {
id: text('id').primaryKey().$defaultFn(() => createId()),
title: text('title').notNull(),
body: text('body').notNull(),
authorId: text('author_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
createdAt: integer('created_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),
})
// src/db/index.ts
import { drizzle } from 'drizzle-orm/bun-sqlite'
import { Database } from 'bun:sqlite'
import * as schema from './schema'
const sqlite = new Database(process.env.DATABASE_URL ?? 'dev.db')
export const db = drizzle(sqlite, { schema })
// src/routes/users.ts
import { Hono } from 'hono'
import { zValidator } from '@hono/zod-validator'
import { z } from 'zod'
import { db } from '../db'
import { users } from '../db/schema'
import { eq } from 'drizzle-orm'
import { authMiddleware } from '../middleware/auth'
import type { Env } from '../types'
const createUserSchema = z.object({
email: z.string().email(),
name: z.string().min(2).max(100),
})
export const usersRouter = new Hono<Env>()
.get('/', authMiddleware, async (c) => {
const all = await db.select().from(users).all()
return c.json({ data: all })
})
.post('/', zValidator('json', createUserSchema), async (c) => {
const body = c.req.valid('json')
const user = await db.insert(users).values(body).returning().get()
return c.json({ data: user }, 201)
})
.get('/:id', authMiddleware, async (c) => {
const user = await db.select().from(users).where(eq(users.id, c.req.param('id'))).get()
if (!user) return c.json({ error: 'Not found' }, 404)
return c.json({ data: user })
})
// src/index.ts
import { Hono } from 'hono'
import { logger } from 'hono/logger'
import { cors } from 'hono/cors'
import { usersRouter } from './routes/users'
const app = new Hono()
.use('*', logger())
.use('*', cors())
.route('/api/users', usersRouter)
// RPC-safe export
export type AppType = typeof app
export default app
// client.ts (frontend/other service)
import { hc } from 'hono/client'
import type { AppType } from './src/index'
const client = hc<AppType>('http://localhost:3000')
// Fully typed — no manual types needed
const res = await client.api.users.$get()
const { data } = await res.json()
// ^? User[]
| Method | Path | Middleware | Action |
|---|---|---|---|
| GET | /api/users | auth | List all users |
| POST | /api/users | zod body | Create user |
| GET | /api/users/:id | auth | Get user by ID |
| PUT | /api/users/:id | auth + zod | Update user |
| DELETE | /api/users/:id | auth | Delete user |
| POST | /api/auth/login | zod body | Issue JWT |
| POST | /api/auth/refresh | — | Refresh token |
| GET | /api/posts | — | Public post list |
| POST | /api/posts | auth + zod | Create post |
| GET | /health | — | Liveness probe |
bun tsc --noEmit passes with zero errorszValidator)AppType exported — client is fully type-safeany casts in route handlersauthMiddlewareenv.ts at startupbun test passes with ≥80% coverage on routes{ error: string } shape consistentlyfetch inside route handlers — create a service layerc.set('user', data as any) — always type Variablesprocess.env.X without the env.ts guardconsole.log in production code — use structured logger