/harness-claude:nuxt-server-routesfrom harness-claude
Creates fully-typed REST API endpoints in Nuxt using Nitro's event-handler model and H3 utilities. Covers file-based routing, request handling, and error responses.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:nuxt-server-routes still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Build fully-typed server API endpoints using Nitro's event-handler model and H3 utilities
server/api/ or server/routes/server/api/ to expose routes at /api/<name>. Files under server/routes/ map to the root path with no /api/ prefix.users.get.ts, users.post.ts. Omit the suffix to handle all methods.defineEventHandler function — this is the required Nitro entry point:// server/api/users.get.ts
export default defineEventHandler(async (event) => {
const users = await fetchUsersFromDb();
return users; // auto-serialized to JSON
});
getQuery, request body with readBody, route params with getRouterParam:// server/api/users/[id].get.ts
export default defineEventHandler(async (event) => {
const id = getRouterParam(event, 'id');
const query = getQuery(event); // ?include=posts
const user = await db.user.findUnique({ where: { id } });
if (!user) throw createError({ statusCode: 404, message: 'User not found' });
return user;
});
createError — Nuxt serializes these into structured JSON error responses:throw createError({ statusCode: 401, statusMessage: 'Unauthorized' });
readBody — always validate the shape:// server/api/posts.post.ts
export default defineEventHandler(async (event) => {
const body = await readBody(event);
if (!body.title) throw createError({ statusCode: 400, message: 'title required' });
return db.post.create({ data: body });
});
setResponseStatus(event, 201);
setHeader(event, 'X-Custom-Header', 'value');
setHeader(event, 'Content-Type', 'text/plain');
return 'Hello plain text';
server/utils/ for shared server-side helpers — these are auto-imported within the server/ tree.Nuxt's server layer is powered by Nitro, which itself uses H3 as its HTTP framework. H3 is a minimal, composable HTTP toolkit where every request is represented as an H3Event. All H3 utility functions accept this event as their first argument.
File-based routing:
server/
api/
users.get.ts → GET /api/users
users.post.ts → POST /api/users
users/[id].get.ts → GET /api/users/:id
auth/
login.post.ts → POST /api/auth/login
routes/
feed.xml.get.ts → GET /feed.xml
Dynamic catch-all routes:
Use [...slug].ts to match multiple path segments:
// server/api/[...slug].ts
export default defineEventHandler((event) => {
const slug = getRouterParams(event).slug;
return { path: slug };
});
Middleware within server routes:
You can apply server-side logic before any handler using server/middleware/. Files here run on every request automatically (no registration needed):
// server/middleware/auth.ts
export default defineEventHandler((event) => {
const token = getHeader(event, 'authorization');
if (!token) throw createError({ statusCode: 401 });
event.context.user = verifyToken(token);
});
Streaming responses:
Nitro supports streaming via Web Streams API for large payloads or SSE:
export default defineEventHandler((event) => {
setHeader(event, 'Content-Type', 'text/event-stream');
return sendStream(event, createReadableStream());
});
Type safety with $fetch:
On the client side, use $fetch or useFetch — Nuxt infers the return type from the server handler automatically in full-stack TypeScript mode.
When NOT to use:
adapter-cloudflare and adapter-vercel-edge have no Node.js fs modulehttps://nuxt.com/docs/guide/directory-structure/server
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job