Agent Skill
2/7/2026vkc-api-route-pattern
Standardize Next.js App Router API route implementations under src/app/api/** (auth/session, input validation, Drizzle queries, rate limiting, response shape). Use when creating or refactoring API routes in this repo.
L
lee
0GitHub Stars
1Views
npx skills add LEE-SANG-BOK/VKC-2-
SKILL.md
| Name | vkc-api-route-pattern |
| Description | Standardize Next.js App Router API route implementations under src/app/api/** (auth/session, input validation, Drizzle queries, rate limiting, response shape). Use when creating or refactoring API routes in this repo. |
name: vkc-api-route-pattern description: Standardize Next.js App Router API route implementations under src/app/api/** (auth/session, input validation, Drizzle queries, rate limiting, response shape). Use when creating or refactoring API routes in this repo. (키워드= API 라우트, route.ts, 세션/권한, 입력 검증, Zod, validateBody, Drizzle, 레이트리밋) metadata: short-description: API Route skeleton + rules
VKC API Route Pattern
When to use
- Creating new endpoints under
src/app/api/** - Refactoring existing endpoints to match house style
House style (this repo)
- Auth:
getSession(user) orgetAdminSession(admin) - DB:
dbfrom@/lib/db, tables from@/lib/db/schema - Rate limit (if needed):
checkRateLimit+rateLimitResponse - Responses:
- Public APIs: prefer
@/lib/api/responsehelpers - Admin APIs: typically
NextResponse.json(...)directly (keep consistent within/api/admin/**)
- Public APIs: prefer
- Validation: this repo uses Zod. For new/refactor APIs, prefer
@/lib/api/validation(src/lib/api/validation.ts) helpers likevalidateBody+createJsonBodyReader.
Canonical references
- Public route w/ validation + rate-limit:
src/app/api/reports/route.ts - Public route w/ typed allowlists:
src/app/api/events/route.ts - Admin CRUD + schedule fields:
src/app/api/admin/news/route.ts - Validation helpers:
src/lib/api/validation.ts
Template
- Full skeleton (copy + customize):
.codex/skills/vkc-api-route-pattern/references/api-route-template.ts
Skills Info
Original Name:vkc-api-route-patternAuthor:lee
Download