[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79AFVMGE2H37AENHDH6H465":3,"skill-same:01M79AFVMGE2H37AENHDH6H465":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":14,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M79AFVMGE2H37AENHDH6H465","nuxt-server",null,"Nuxt 5 server-side development with Nitro v3, h3 v2, API routes, middleware, and database integration. Use when creating server routes, integrating D1\u002FDrizzle, or migrating from Nitro v2.","Elogic360\u002Fsoftware-factory","Elogic360","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F156535519?v=4","01M74NH3F0RB13PWB7JZDE2V80","elogic360","01M74NH3FPC65082MDZVMFHDM3",0,"MIT","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fnuxt-v5\u002Fskills\u002Fnuxt-server\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: nuxt-server\ndescription: Nuxt 5 server-side development with Nitro v3, h3 v2, API routes, middleware, and database integration. Use when creating server routes, integrating D1\u002FDrizzle, or migrating from Nitro v2.\nlicense: MIT\nmetadata:\n  version: 5.0.0\n  author: Claude Skills Maintainers\n  category: Framework\n  framework: Nuxt\n  framework-version: 5.x\n  last-verified: 2026-03-30\n---\n\n# Nuxt 5 Server Development\n\nServer routes, API patterns, and backend development with Nitro v3.\n\n**Use when**: creating server API routes, implementing server middleware, integrating databases (D1, PostgreSQL, Drizzle), handling file uploads, migrating from Nitro v2\u002Fh3 v1 to Nitro v3\u002Fh3 v2, or building backend logic.\n\n## Quick Reference\n\n### Nuxt 5 Server API Changes (from Nuxt 4)\n\n| Area | Nuxt 4 (Nitro v2) | Nuxt 5 (Nitro v3) |\n|------|-------------------|-------------------|\n| Package | `nitropack` | `nitro` |\n| h3 imports | `import { ... } from 'h3'` | `import { ... } from 'nitro\u002Fh3'` |\n| Error creation | `createError({statusCode})` | `new HTTPError({status})` |\n| Event path | `event.path` | `event.url.pathname` |\n| Event method | `event.method` | `event.req.method` |\n| Status code | `event.node.res.statusCode` | `event.res.status` |\n| Response headers | `setResponseHeader(event, ...)` | `event.res.headers.set(...)` |\n| Runtime config | `useRuntimeConfig(event)` | `useRuntimeConfig()` |\n| Route rules redirect | `statusCode` | `status` |\n\n### File-Based Server Routes\n\n```\nserver\u002F\n├── api\u002F                      # API endpoints (\u002Fapi\u002F*)\n│   ├── users\u002F\n│   │   ├── index.get.ts      → GET  \u002Fapi\u002Fusers\n│   │   ├── index.post.ts     → POST \u002Fapi\u002Fusers\n│   │   ├── [id].get.ts       → GET  \u002Fapi\u002Fusers\u002F:id\n│   │   ├── [id].put.ts       → PUT  \u002Fapi\u002Fusers\u002F:id\n│   │   └── [id].delete.ts    → DELETE \u002Fapi\u002Fusers\u002F:id\n│   └── health.get.ts         → GET  \u002Fapi\u002Fhealth\n├── routes\u002F                   # Non-API routes\n│   └── sitemap.xml.get.ts    → GET  \u002Fsitemap.xml\n├── middleware\u002F               # Server middleware\n├── plugins\u002F                  # Nitro plugins\n└── utils\u002F                    # Server utilities\n```\n\n### HTTP Method Suffixes\n\n| Suffix | HTTP Method |\n|--------|-------------|\n| `.get.ts` | GET |\n| `.post.ts` | POST |\n| `.put.ts` | PUT |\n| `.patch.ts` | PATCH |\n| `.delete.ts` | DELETE |\n| `.ts` | All methods |\n\n## When to Load References\n\n**Load `references\u002Fserver.md` when:**\n- Implementing complex API routes\n- Handling authentication and sessions\n- Working with cookies and headers\n- Building file upload endpoints\n- Migrating from h3 v1 to h3 v2 API\n\n## Basic Event Handler\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.get.ts\nexport default defineEventHandler(async (event) => {\n  return {\n    users: [\n      { id: 1, name: 'John' },\n      { id: 2, name: 'Jane' }\n    ]\n  }\n})\n```\n\n## Web Standard Event API (v5)\n\n### Request Properties\n\n```typescript\n\u002F\u002F Nuxt 5 uses Web Standard APIs\nexport default defineEventHandler((event) => {\n  \u002F\u002F Path\n  const path = event.url.pathname    \u002F\u002F was: event.path\n  const search = event.url.search    \u002F\u002F URLSearchParams\n\n  \u002F\u002F Method\n  const method = event.req.method    \u002F\u002F was: event.method\n\n  \u002F\u002F Headers (Web Headers API)\n  const auth = event.req.headers.get('authorization')  \u002F\u002F was: getHeader(event, 'authorization')\n  const allHeaders = event.req.headers\n\n  return { path, search, method, auth }\n})\n```\n\n### Response Properties\n\n```typescript\nexport default defineEventHandler((event) => {\n  \u002F\u002F Set status\n  event.res.status = 201                    \u002F\u002F was: setResponseStatus(event, 201)\n\n  \u002F\u002F Set headers (Web Headers API)\n  event.res.headers.set('X-Custom', 'value')     \u002F\u002F was: setHeader(event, 'X-Custom', 'value')\n  event.res.headers.append('Set-Cookie', 'val')   \u002F\u002F was: appendResponseHeader(event, ...)\n\n  return { message: 'Created' }\n})\n```\n\n### Legacy Helpers Still Work\n\nThe h3 v1 helper functions (auto-imported) still work for request reading:\n\n```typescript\n\u002F\u002F These continue to work (auto-imported)\nconst id = getRouterParam(event, 'id')\nconst query = getQuery(event)\nconst body = await readBody(event)\nconst cookie = getCookie(event, 'name')\n```\n\nBut for setting responses, prefer the Web Standard API:\n\n```typescript\n\u002F\u002F Prefer v5 style\nevent.res.status = 201\nevent.res.headers.set('Cache-Control', 'max-age=3600')\n\n\u002F\u002F Still works but deprecated for setting\nsetResponseStatus(event, 201)\nsetHeader(event, 'Cache-Control', 'max-age=3600')\n```\n\n## Error Handling (v5 Change)\n\n### Server-Side: HTTPError\n\nIn server routes, use `HTTPError` instead of `createError`:\n\n```typescript\n\u002F\u002F Nuxt 5 server routes\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'User ID is required' })\n  }\n\n  const user = await findUser(id)\n\n  if (!user) {\n    throw new HTTPError({ status: 404, statusText: 'Not Found' })\n  }\n\n  return user\n})\n```\n\n### App-Side: createError (Unchanged)\n\nIn the Vue part of your app (`app\u002F` directory), `createError` continues to work:\n\n```typescript\n\u002F\u002F app\u002F code - createError still works\nthrow createError({\n  statusCode: 404,\n  statusMessage: 'Page Not Found',\n  fatal: true\n})\n```\n\n### Validation Errors\n\n```typescript\nimport { z } from 'zod'\nimport { HTTPError } from 'nitro\u002Fh3'\n\nconst createUserSchema = z.object({\n  name: z.string().min(2).max(100),\n  email: z.string().email()\n})\n\nexport default defineEventHandler(async (event) => {\n  const body = await readBody(event)\n  const result = createUserSchema.safeParse(body)\n\n  if (!result.success) {\n    throw new HTTPError({\n      status: 400,\n      statusText: 'Validation failed',\n    })\n  }\n\n  return { success: true, data: result.data }\n})\n```\n\n## Request Utilities\n\n### URL Parameters\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].get.ts\nexport default defineEventHandler(async (event) => {\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'User ID is required' })\n  }\n\n  return { id }\n})\n```\n\n### Query Parameters\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  const query = getQuery(event)\n\n  const page = Number(query.page) || 1\n  const limit = Number(query.limit) || 10\n  const search = query.search as string | undefined\n\n  return { page, limit, search }\n})\n```\n\n### Request Body\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  const body = await readBody(event)\n\n  if (!body.name || !body.email) {\n    throw new HTTPError({ status: 400, statusText: 'Name and email are required' })\n  }\n\n  return { success: true, user: { id: 1, ...body } }\n})\n```\n\n## Cookies\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  \u002F\u002F Read cookie (helper still works)\n  const sessionId = getCookie(event, 'session_id')\n\n  \u002F\u002F Set cookie\n  setCookie(event, 'session_id', 'abc123', {\n    httpOnly: true,\n    secure: true,\n    sameSite: 'lax',\n    maxAge: 60 * 60 * 24 * 7\n  })\n\n  \u002F\u002F Delete cookie\n  deleteCookie(event, 'old_cookie')\n\n  return { sessionId }\n})\n```\n\n## Server Middleware\n\n```typescript\n\u002F\u002F server\u002Fmiddleware\u002Fauth.ts\nexport default defineEventHandler(async (event) => {\n  const publicRoutes = ['\u002Fapi\u002Fauth\u002Flogin', '\u002Fapi\u002Fhealth']\n\n  \u002F\u002F v5: Use event.url.pathname instead of event.path\n  if (publicRoutes.includes(event.url.pathname)) {\n    return\n  }\n\n  const token = event.req.headers.get('authorization')?.replace('Bearer ', '')\n\n  if (!token) {\n    throw new HTTPError({ status: 401, statusText: 'Authentication required' })\n  }\n\n  const user = await verifyToken(token)\n  event.context.user = user\n})\n```\n\n## Runtime Config (v5 Change)\n\n```typescript\n\u002F\u002F Nuxt 5: useRuntimeConfig() no longer accepts event\nexport default defineEventHandler(() => {\n  const config = useRuntimeConfig()\n  return { apiBase: config.public.apiBase }\n})\n\n\u002F\u002F Nuxt 4 (deprecated in v5):\n\u002F\u002F const config = useRuntimeConfig(event)\n```\n\n## Database Integration\n\n### Cloudflare D1 with Drizzle\n\n```typescript\n\u002F\u002F server\u002Futils\u002Fdb.ts\nimport { drizzle } from 'drizzle-orm\u002Fd1'\nimport * as schema from '~\u002Fserver\u002Fdatabase\u002Fschema'\n\nexport function useDB(event: H3Event) {\n  const { DB } = event.context.cloudflare.env\n  return drizzle(DB, { schema })\n}\n\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.get.ts\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const users = await db.select().from(schema.users).limit(10)\n  return { users }\n})\n```\n\n### CRUD Operations\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.post.ts\nimport { users } from '~\u002Fserver\u002Fdatabase\u002Fschema'\n\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const body = await readBody(event)\n\n  const [user] = await db.insert(users)\n    .values({ name: body.name, email: body.email })\n    .returning()\n\n  return { user }\n})\n\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].delete.ts\nimport { eq } from 'drizzle-orm'\nimport { users } from '~\u002Fserver\u002Fdatabase\u002Fschema'\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'ID is required' })\n  }\n\n  await db.delete(users).where(eq(users.id, Number(id)))\n  return { success: true }\n})\n```\n\n## File Uploads\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fupload.post.ts\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const formData = await readMultipartFormData(event)\n\n  if (!formData) {\n    throw new HTTPError({ status: 400, statusText: 'No file uploaded' })\n  }\n\n  const file = formData.find(f => f.name === 'file')\n\n  if (!file) {\n    throw new HTTPError({ status: 400, statusText: 'File field is required' })\n  }\n\n  const { R2 } = event.context.cloudflare.env\n  const key = `uploads\u002F${Date.now()}-${file.filename}`\n  await R2.put(key, file.data)\n\n  return { key, filename: file.filename, type: file.type }\n})\n```\n\n## Server Utilities\n\n```typescript\n\u002F\u002F server\u002Futils\u002Fauth.ts\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport function requireAuth(event: H3Event) {\n  const user = event.context.user\n\n  if (!user) {\n    throw new HTTPError({ status: 401, statusText: 'Authentication required' })\n  }\n\n  return user\n}\n\nexport function requireRole(event: H3Event, role: string) {\n  const user = requireAuth(event)\n\n  if (user.role !== role) {\n    throw new HTTPError({ status: 403, statusText: 'Insufficient permissions' })\n  }\n\n  return user\n}\n```\n\n## Route Rules (v5 Change)\n\n```typescript\n\u002F\u002F nuxt.config.ts - redirect status property renamed\nexport default defineNuxtConfig({\n  routeRules: {\n    '\u002Fold-page': {\n      redirect: { to: '\u002Fnew-page', status: 302 }  \u002F\u002F was: statusCode\n    },\n    '\u002Fapi\u002F**': { cors: true },\n    '\u002Fblog\u002F**': { swr: 3600 }\n  }\n})\n```\n\n## Common Anti-Patterns\n\n### Using createError in Server Routes\n\n```typescript\n\u002F\u002F WRONG in v5 server routes - use HTTPError\nimport { createError } from 'h3'\nthrow createError({ statusCode: 404, statusMessage: 'Not found' })\n\n\u002F\u002F CORRECT in v5 server routes\nimport { HTTPError } from 'nitro\u002Fh3'\nthrow new HTTPError({ status: 404, statusText: 'Not found' })\n```\n\n### Using event.path\n\n```typescript\n\u002F\u002F WRONG - deprecated in v5\nconst path = event.path\n\n\u002F\u002F CORRECT\nconst path = event.url.pathname\n```\n\n### Using useRuntimeConfig(event)\n\n```typescript\n\u002F\u002F WRONG - no longer accepts event in v5\nconst config = useRuntimeConfig(event)\n\n\u002F\u002F CORRECT\nconst config = useRuntimeConfig()\n```\n\n### Not Throwing Errors\n\n```typescript\n\u002F\u002F WRONG - Returns error as data with 200 status\nif (!user) {\n  return { error: 'Not found' }\n}\n\n\u002F\u002F CORRECT - Throw error\nif (!user) {\n  throw new HTTPError({ status: 404, statusText: 'Not found' })\n}\n```\n\n## Troubleshooting\n\n**Import errors from 'h3':**\n- Change `import { ... } from 'h3'` to `import { ... } from 'nitro\u002Fh3'`\n- Auto-imports (`defineEventHandler`, `getQuery`, `readBody`) continue to work\n\n**404 on API Routes:**\n- Ensure file is in `server\u002Fapi\u002F`\n- Check method suffix matches request (`.get.ts` for GET)\n\n**Body is Empty:**\n- Ensure `await readBody(event)` not `readBody(event)`\n\n**D1 Binding Not Found:**\n- Check wrangler.toml has `[[d1_databases]]` configured\n- Access via `event.context.cloudflare.env.DB`\n\n## Related Skills\n\n- **nuxt-core**: Project setup, routing, configuration\n- **nuxt-data**: Composables, data fetching, state\n- **nuxt-production**: Performance, testing, deployment\n- **cloudflare-d1**: D1 database patterns\n\n---\n\n**Version**: 5.0.0 | **Last Updated**: 2026-03-30 | **License**: MIT\n","# Nuxt 5 Server Development\n\nServer routes, API patterns, and backend development with Nitro v3.\n\n**Use when**: creating server API routes, implementing server middleware, integrating databases (D1, PostgreSQL, Drizzle), handling file uploads, migrating from Nitro v2\u002Fh3 v1 to Nitro v3\u002Fh3 v2, or building backend logic.\n\n## Quick Reference\n\n### Nuxt 5 Server API Changes (from Nuxt 4)\n\n| Area | Nuxt 4 (Nitro v2) | Nuxt 5 (Nitro v3) |\n|------|-------------------|-------------------|\n| Package | `nitropack` | `nitro` |\n| h3 imports | `import { ... } from 'h3'` | `import { ... } from 'nitro\u002Fh3'` |\n| Error creation | `createError({statusCode})` | `new HTTPError({status})` |\n| Event path | `event.path` | `event.url.pathname` |\n| Event method | `event.method` | `event.req.method` |\n| Status code | `event.node.res.statusCode` | `event.res.status` |\n| Response headers | `setResponseHeader(event, ...)` | `event.res.headers.set(...)` |\n| Runtime config | `useRuntimeConfig(event)` | `useRuntimeConfig()` |\n| Route rules redirect | `statusCode` | `status` |\n\n### File-Based Server Routes\n\n```\nserver\u002F\n├── api\u002F                      # API endpoints (\u002Fapi\u002F*)\n│   ├── users\u002F\n│   │   ├── index.get.ts      → GET  \u002Fapi\u002Fusers\n│   │   ├── index.post.ts     → POST \u002Fapi\u002Fusers\n│   │   ├── [id].get.ts       → GET  \u002Fapi\u002Fusers\u002F:id\n│   │   ├── [id].put.ts       → PUT  \u002Fapi\u002Fusers\u002F:id\n│   │   └── [id].delete.ts    → DELETE \u002Fapi\u002Fusers\u002F:id\n│   └── health.get.ts         → GET  \u002Fapi\u002Fhealth\n├── routes\u002F                   # Non-API routes\n│   └── sitemap.xml.get.ts    → GET  \u002Fsitemap.xml\n├── middleware\u002F               # Server middleware\n├── plugins\u002F                  # Nitro plugins\n└── utils\u002F                    # Server utilities\n```\n\n### HTTP Method Suffixes\n\n| Suffix | HTTP Method |\n|--------|-------------|\n| `.get.ts` | GET |\n| `.post.ts` | POST |\n| `.put.ts` | PUT |\n| `.patch.ts` | PATCH |\n| `.delete.ts` | DELETE |\n| `.ts` | All methods |\n\n## When to Load References\n\n**Load `references\u002Fserver.md` when:**\n- Implementing complex API routes\n- Handling authentication and sessions\n- Working with cookies and headers\n- Building file upload endpoints\n- Migrating from h3 v1 to h3 v2 API\n\n## Basic Event Handler\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.get.ts\nexport default defineEventHandler(async (event) => {\n  return {\n    users: [\n      { id: 1, name: 'John' },\n      { id: 2, name: 'Jane' }\n    ]\n  }\n})\n```\n\n## Web Standard Event API (v5)\n\n### Request Properties\n\n```typescript\n\u002F\u002F Nuxt 5 uses Web Standard APIs\nexport default defineEventHandler((event) => {\n  \u002F\u002F Path\n  const path = event.url.pathname    \u002F\u002F was: event.path\n  const search = event.url.search    \u002F\u002F URLSearchParams\n\n  \u002F\u002F Method\n  const method = event.req.method    \u002F\u002F was: event.method\n\n  \u002F\u002F Headers (Web Headers API)\n  const auth = event.req.headers.get('authorization')  \u002F\u002F was: getHeader(event, 'authorization')\n  const allHeaders = event.req.headers\n\n  return { path, search, method, auth }\n})\n```\n\n### Response Properties\n\n```typescript\nexport default defineEventHandler((event) => {\n  \u002F\u002F Set status\n  event.res.status = 201                    \u002F\u002F was: setResponseStatus(event, 201)\n\n  \u002F\u002F Set headers (Web Headers API)\n  event.res.headers.set('X-Custom', 'value')     \u002F\u002F was: setHeader(event, 'X-Custom', 'value')\n  event.res.headers.append('Set-Cookie', 'val')   \u002F\u002F was: appendResponseHeader(event, ...)\n\n  return { message: 'Created' }\n})\n```\n\n### Legacy Helpers Still Work\n\nThe h3 v1 helper functions (auto-imported) still work for request reading:\n\n```typescript\n\u002F\u002F These continue to work (auto-imported)\nconst id = getRouterParam(event, 'id')\nconst query = getQuery(event)\nconst body = await readBody(event)\nconst cookie = getCookie(event, 'name')\n```\n\nBut for setting responses, prefer the Web Standard API:\n\n```typescript\n\u002F\u002F Prefer v5 style\nevent.res.status = 201\nevent.res.headers.set('Cache-Control', 'max-age=3600')\n\n\u002F\u002F Still works but deprecated for setting\nsetResponseStatus(event, 201)\nsetHeader(event, 'Cache-Control', 'max-age=3600')\n```\n\n## Error Handling (v5 Change)\n\n### Server-Side: HTTPError\n\nIn server routes, use `HTTPError` instead of `createError`:\n\n```typescript\n\u002F\u002F Nuxt 5 server routes\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'User ID is required' })\n  }\n\n  const user = await findUser(id)\n\n  if (!user) {\n    throw new HTTPError({ status: 404, statusText: 'Not Found' })\n  }\n\n  return user\n})\n```\n\n### App-Side: createError (Unchanged)\n\nIn the Vue part of your app (`app\u002F` directory), `createError` continues to work:\n\n```typescript\n\u002F\u002F app\u002F code - createError still works\nthrow createError({\n  statusCode: 404,\n  statusMessage: 'Page Not Found',\n  fatal: true\n})\n```\n\n### Validation Errors\n\n```typescript\nimport { z } from 'zod'\nimport { HTTPError } from 'nitro\u002Fh3'\n\nconst createUserSchema = z.object({\n  name: z.string().min(2).max(100),\n  email: z.string().email()\n})\n\nexport default defineEventHandler(async (event) => {\n  const body = await readBody(event)\n  const result = createUserSchema.safeParse(body)\n\n  if (!result.success) {\n    throw new HTTPError({\n      status: 400,\n      statusText: 'Validation failed',\n    })\n  }\n\n  return { success: true, data: result.data }\n})\n```\n\n## Request Utilities\n\n### URL Parameters\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].get.ts\nexport default defineEventHandler(async (event) => {\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'User ID is required' })\n  }\n\n  return { id }\n})\n```\n\n### Query Parameters\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  const query = getQuery(event)\n\n  const page = Number(query.page) || 1\n  const limit = Number(query.limit) || 10\n  const search = query.search as string | undefined\n\n  return { page, limit, search }\n})\n```\n\n### Request Body\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  const body = await readBody(event)\n\n  if (!body.name || !body.email) {\n    throw new HTTPError({ status: 400, statusText: 'Name and email are required' })\n  }\n\n  return { success: true, user: { id: 1, ...body } }\n})\n```\n\n## Cookies\n\n```typescript\nexport default defineEventHandler(async (event) => {\n  \u002F\u002F Read cookie (helper still works)\n  const sessionId = getCookie(event, 'session_id')\n\n  \u002F\u002F Set cookie\n  setCookie(event, 'session_id', 'abc123', {\n    httpOnly: true,\n    secure: true,\n    sameSite: 'lax',\n    maxAge: 60 * 60 * 24 * 7\n  })\n\n  \u002F\u002F Delete cookie\n  deleteCookie(event, 'old_cookie')\n\n  return { sessionId }\n})\n```\n\n## Server Middleware\n\n```typescript\n\u002F\u002F server\u002Fmiddleware\u002Fauth.ts\nexport default defineEventHandler(async (event) => {\n  const publicRoutes = ['\u002Fapi\u002Fauth\u002Flogin', '\u002Fapi\u002Fhealth']\n\n  \u002F\u002F v5: Use event.url.pathname instead of event.path\n  if (publicRoutes.includes(event.url.pathname)) {\n    return\n  }\n\n  const token = event.req.headers.get('authorization')?.replace('Bearer ', '')\n\n  if (!token) {\n    throw new HTTPError({ status: 401, statusText: 'Authentication required' })\n  }\n\n  const user = await verifyToken(token)\n  event.context.user = user\n})\n```\n\n## Runtime Config (v5 Change)\n\n```typescript\n\u002F\u002F Nuxt 5: useRuntimeConfig() no longer accepts event\nexport default defineEventHandler(() => {\n  const config = useRuntimeConfig()\n  return { apiBase: config.public.apiBase }\n})\n\n\u002F\u002F Nuxt 4 (deprecated in v5):\n\u002F\u002F const config = useRuntimeConfig(event)\n```\n\n## Database Integration\n\n### Cloudflare D1 with Drizzle\n\n```typescript\n\u002F\u002F server\u002Futils\u002Fdb.ts\nimport { drizzle } from 'drizzle-orm\u002Fd1'\nimport * as schema from '~\u002Fserver\u002Fdatabase\u002Fschema'\n\nexport function useDB(event: H3Event) {\n  const { DB } = event.context.cloudflare.env\n  return drizzle(DB, { schema })\n}\n\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.get.ts\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const users = await db.select().from(schema.users).limit(10)\n  return { users }\n})\n```\n\n### CRUD Operations\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fusers\u002Findex.post.ts\nimport { users } from '~\u002Fserver\u002Fdatabase\u002Fschema'\n\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const body = await readBody(event)\n\n  const [user] = await db.insert(users)\n    .values({ name: body.name, email: body.email })\n    .returning()\n\n  return { user }\n})\n\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].delete.ts\nimport { eq } from 'drizzle-orm'\nimport { users } from '~\u002Fserver\u002Fdatabase\u002Fschema'\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const db = useDB(event)\n  const id = getRouterParam(event, 'id')\n\n  if (!id) {\n    throw new HTTPError({ status: 400, statusText: 'ID is required' })\n  }\n\n  await db.delete(users).where(eq(users.id, Number(id)))\n  return { success: true }\n})\n```\n\n## File Uploads\n\n```typescript\n\u002F\u002F server\u002Fapi\u002Fupload.post.ts\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport default defineEventHandler(async (event) => {\n  const formData = await readMultipartFormData(event)\n\n  if (!formData) {\n    throw new HTTPError({ status: 400, statusText: 'No file uploaded' })\n  }\n\n  const file = formData.find(f => f.name === 'file')\n\n  if (!file) {\n    throw new HTTPError({ status: 400, statusText: 'File field is required' })\n  }\n\n  const { R2 } = event.context.cloudflare.env\n  const key = `uploads\u002F${Date.now()}-${file.filename}`\n  await R2.put(key, file.data)\n\n  return { key, filename: file.filename, type: file.type }\n})\n```\n\n## Server Utilities\n\n```typescript\n\u002F\u002F server\u002Futils\u002Fauth.ts\nimport { HTTPError } from 'nitro\u002Fh3'\n\nexport function requireAuth(event: H3Event) {\n  const user = event.context.user\n\n  if (!user) {\n    throw new HTTPError({ status: 401, statusText: 'Authentication required' })\n  }\n\n  return user\n}\n\nexport function requireRole(event: H3Event, role: string) {\n  const user = requireAuth(event)\n\n  if (user.role !== role) {\n    throw new HTTPError({ status: 403, statusText: 'Insufficient permissions' })\n  }\n\n  return user\n}\n```\n\n## Route Rules (v5 Change)\n\n```typescript\n\u002F\u002F nuxt.config.ts - redirect status property renamed\nexport default defineNuxtConfig({\n  routeRules: {\n    '\u002Fold-page': {\n      redirect: { to: '\u002Fnew-page', status: 302 }  \u002F\u002F was: statusCode\n    },\n    '\u002Fapi\u002F**': { cors: true },\n    '\u002Fblog\u002F**': { swr: 3600 }\n  }\n})\n```\n\n## Common Anti-Patterns\n\n### Using createError in Server Routes\n\n```typescript\n\u002F\u002F WRONG in v5 server routes - use HTTPError\nimport { createError } from 'h3'\nthrow createError({ statusCode: 404, statusMessage: 'Not found' })\n\n\u002F\u002F CORRECT in v5 server routes\nimport { HTTPError } from 'nitro\u002Fh3'\nthrow new HTTPError({ status: 404, statusText: 'Not found' })\n```\n\n### Using event.path\n\n```typescript\n\u002F\u002F WRONG - deprecated in v5\nconst path = event.path\n\n\u002F\u002F CORRECT\nconst path = event.url.pathname\n```\n\n### Using useRuntimeConfig(event)\n\n```typescript\n\u002F\u002F WRONG - no longer accepts event in v5\nconst config = useRuntimeConfig(event)\n\n\u002F\u002F CORRECT\nconst config = useRuntimeConfig()\n```\n\n### Not Throwing Errors\n\n```typescript\n\u002F\u002F WRONG - Returns error as data with 200 status\nif (!user) {\n  return { error: 'Not found' }\n}\n\n\u002F\u002F CORRECT - Throw error\nif (!user) {\n  throw new HTTPError({ status: 404, statusText: 'Not found' })\n}\n```\n\n## Troubleshooting\n\n**Import errors from 'h3':**\n- Change `import { ... } from 'h3'` to `import { ... } from 'nitro\u002Fh3'`\n- Auto-imports (`defineEventHandler`, `getQuery`, `readBody`) continue to work\n\n**404 on API Routes:**\n- Ensure file is in `server\u002Fapi\u002F`\n- Check method suffix matches request (`.get.ts` for GET)\n\n**Body is Empty:**\n- Ensure `await readBody(event)` not `readBody(event)`\n\n**D1 Binding Not Found:**\n- Check wrangler.toml has `[[d1_databases]]` configured\n- Access via `event.context.cloudflare.env.DB`\n\n## Related Skills\n\n- **nuxt-core**: Project setup, routing, configuration\n- **nuxt-data**: Composables, data fetching, state\n- **nuxt-production**: Performance, testing, deployment\n- **cloudflare-d1**: D1 database patterns\n\n---\n\n**Version**: 5.0.0 | **Last Updated**: 2026-03-30 | **License**: MIT\n",{"name":5,"license":15,"metadata":24,"description":7},{"author":25,"version":26,"category":27,"framework":28,"last-verified":29,"framework-version":30},"Claude Skills Maintainers","5.0.0","Framework","Nuxt",1774828800000,"5.x","main","c475fc64e94e803b50d14a791dfee8853fbb2c5c","integrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fnuxt-v5\u002Fskills\u002Fnuxt-server","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory","https:\u002F\u002Fgithub.com\u002FElogic360","2026-11-08 22:21:22",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Elogic360\u002Fsoftware-factory --skill nuxt-server",{"tool":43,"command":44},"bunx","bunx skills add Elogic360\u002Fsoftware-factory --skill nuxt-server",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Elogic360\u002Fsoftware-factory --skill nuxt-server","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fnuxt-v5\u002Fskills\u002Fnuxt-server\u002FSKILL.md",true,[51,57],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fserver.md","REFERENCE","参考文档",13753,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fnuxt-v5\u002Fskills\u002Fnuxt-server\u002Freferences\u002Fserver.md",{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"templates\u002Fserver\u002Fapi\u002Fblog\u002Findex.get.ts","SCRIPT","脚本",1583,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fnuxt-v5\u002Fskills\u002Fnuxt-server\u002Ftemplates\u002Fserver\u002Fapi\u002Fblog\u002Findex.get.ts",[64,72,79,86,93,100],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M79G206MT3J6S0GY3C45P2KV","vss-summarize-video","Use to summarize a recorded video via the LVS summarization microservice (HITL-gated) with a VLM fallback. Not for report generation or live RTSP captioning.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-summarize-video\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M79G1WN63PGRE8CKD47WEBQ5","vss-setup-video-analytics-api","Use to deploy the vss-video-analytics-api REST service standalone (config-source, data-log bind, Elasticsearch, optional Kafka). Not for full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-video-analytics-api\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M79G1S9F7VY3EF6H53PRP5AN","vss-setup-behavior-analytics","Use to deploy the vss-behavior-analytics service standalone (entrypoint, config-source, optional calibration). Not for the full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-behavior-analytics\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M79G1N1S1Y27PFZPYMNK1MTQ","vss-search-archive","Use this skill to run top-level VSS fusion search on archived video, or to ingest video files \u002F RTSP streams for search. Do NOT use for ad-hoc visual Q&A (use vss-ask-video), live captioning (use vss-deploy-dense-captioning), or video summarization and reports (use vss-summarize-video).","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-search-archive\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M79G1H6WN0Q6C0VCAXCZX6B7","vss-query-analytics","Use this skill when reading video-analytics metrics, incidents, alerts, and sensor data via the VA-MCP server (port 9901). Not for live VLM or incident-range narrative reports.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-query-analytics\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":68,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M79G1DYPNXQS7QHZ0AAF5FX5","vss-manage-video-io-storage","Use to call the VIOS REST API (sensor list, timelines, clip extraction, snapshots, add\u002Fdelete sensors and streams). Not for VLM inference or search.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-manage-video-io-storage\u002FSKILL.md",[],[]]