add-api-route
Adds a Fastify route to the Saltmarsh Booking API with its schema, auth level, repository call, and registration. Use when asked to "add an endpoint", "add a route", or "expose this over the API".
SKILL.mdskills/agents-md/evals/fixtures/instruction-creep/base/.claude/skills/add-api-route/SKILL.md
GitHubAdd an API Route
- Add the request and response schemas to
packages/shared/src/schemas/<resource>.ts. - Create or extend
packages/api/src/routes/<resource>.ts. Export a Fastify plugin. - Set
config.authto"guest","owner", or"public", andconfig.rateLimitif 60 a minute is wrong for this route. - Call a repository in
packages/api/src/repos. Add the query there if it does not exist. - Register the plugin in
packages/api/src/app.ts. - Add a typed call for it to
packages/web/src/lib/api.tsif the web app will use it.
Gotchas
- An owner route checks that the campsite in the path belongs to
request.owner.id. The auth level alone does not do that. - Return errors with
problem(). A thrown error becomes a 500 with no detail.