Auto-generated tile from GitHub (10 skills)
92
94%
Does it follow best practices?
Impact
92%
1.16xAverage score across 44 eval scenarios
Advisory
Suggest reviewing before use
A growing B2B SaaS platform exposes a Fastify REST API to its customers. Over the past year, the API has accumulated error handling written ad-hoc by different developers. Some routes return { error: 'something went wrong' } with a 500, others return { message: 'User not found' } with a 404, and a few accidentally expose internal stack traces to API consumers. Support tickets frequently reference error messages that don't match anything in the documentation.
The engineering lead wants a unified error handling layer before the next major release. The requirements are:
USER_NOT_FOUND) and a consistent HTTP status code. New error types must be easy to create without duplicating boilerplate.Build a Fastify application skeleton that demonstrates all four requirements with representative routes for a user management domain.
Produce the following files:
package.json — with type: "module" and scriptssrc/app.ts — Fastify application factory that wires up error handling and route groups. Export buildApp() returning the Fastify instancesrc/errors.ts — definitions of at least three domain-specific error types (e.g. a not-found error, an unauthorised error, and a conflict error)src/routes/api/users.ts — a route plugin for the customer-facing API with at least GET /users/:id and POST /users. Routes should throw the typed errors defined in src/errors.ts in appropriate situationssrc/routes/admin/users.ts — a route plugin for the admin API with at least GET /admin/users and DELETE /admin/users/:id. This route group should have its own error response format (e.g. wraps the error in { error: { code, message } })architecture-notes.md — a short document explaining: which library is used for typed error classes, which library provides the reply helper methods, and how each error type maps to an HTTP status codeevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
scenario-27
scenario-28
scenario-29
scenario-30
scenario-31
scenario-32
scenario-33
scenario-34
scenario-35
scenario-36
scenario-37
scenario-38
scenario-39
scenario-40
scenario-41
scenario-42
scenario-43
scenario-44
skills
documentation
fastify
init
linting-neostandard-eslint9
node
nodejs-core
rules
oauth
octocat
snipgrapher