← ClaudeAtlas

fastify-routelisted

Scaffold a new Fastify route (or set of routes) that matches the existing project's conventions — plugin structure, schema strategy (JSON Schema / TypeBox / Zod), auth, error shape, and tests. Use when user wants to add an endpoint, add a route, expose an API, or mentions "new route" / "add endpoint" in a Fastify project.
muzalee/claude-atelier · ★ 0 · API & Backend · score 62
Install: claude install-skill muzalee/claude-atelier
Add a new Fastify route to an existing project. Match what's already there — do not introduce a second schema library, a second auth pattern, or a new file layout. ## Example prompts - "Add a POST /users route" - "Scaffold a route for uploading images" - "New endpoint: GET /orders/:id" - "Add an admin-only route to delete a project" ## Process 1. **Scan the project first.** Do not write code until you know: - **Server entry**: `src/server.ts`, `src/app.ts`, or similar. Note the plugin registration order. - **Route file layout**: is it `src/routes/<domain>.ts`, `src/modules/<domain>/routes.ts`, autoload with `@fastify/autoload`, or flat? Match it. - **Schema strategy**: raw JSON Schema, `@sinclair/typebox`, or `fastify-type-provider-zod`. Pick from what's already imported in `package.json`. Never introduce a second one. - **Auth pattern**: is there a `preHandler` hook, a `fastify.authenticate` decorator, `@fastify/jwt`, or session cookies? Reuse it. - **Error shape**: is there a `setErrorHandler`? What does an error response look like? Match it. - **Test framework**: `tap`, `vitest`, `jest`, `node:test`. Match it and mirror the closest existing route's test file. - **DB access**: is there a `fastify.db` decorator, a Prisma client import, Drizzle, raw `pg`? Reuse the same pattern. 2. **Confirm the shape** with the user before writing. State back: - Method + path - Request schema (body / params / querystring) - Response schema (success + error