Fastify best practices skill
93
97%
Does it follow best practices?
Impact
85%
1.37xAverage score across 4 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent prefers TypeBox over raw JSON Schema, wires up the TypeBox type provider for end-to-end type safety, defines response schemas on all routes, and uses global shared schemas with $id/$ref.",
"type": "weighted_checklist",
"checklist": [
{
"name": "TypeBox for schemas",
"description": "Schema definitions use `Type.Object`, `Type.String`, `Type.Number`, `Type.Boolean`, etc. from `@sinclair/typebox` rather than plain JSON Schema object literals",
"max_score": 15
},
{
"name": "TypeBox type provider",
"description": "The Fastify instance is created with `.withTypeProvider<TypeBoxTypeProvider>()` from `@fastify/type-provider-typebox`",
"max_score": 15
},
{
"name": "Response schemas on all routes",
"description": "Every route definition (`POST /products`, `GET /products`, `GET /products/:id`) includes a `response` schema in its schema option",
"max_score": 15
},
{
"name": "Type.Optional for optional fields",
"description": "Optional fields (e.g., `description`) are declared with `Type.Optional(...)` rather than omitting `required` in a plain JSON Schema or using a workaround",
"max_score": 10
},
{
"name": "additionalProperties: false",
"description": "At least one request body schema (e.g., for POST /products) is defined with `additionalProperties: false` (either explicitly or via TypeBox's default strict mode equivalent)",
"max_score": 10
},
{
"name": "Shared schema registration",
"description": "At least one schema is registered globally via `app.addSchema(...)` with a `$id` field",
"max_score": 15
},
{
"name": "$ref usage",
"description": "At least one route references a globally registered schema using `{ $ref: 'schemaId#' }` syntax",
"max_score": 10
},
{
"name": "Structured log calls",
"description": "Any logging statements use structured object form — e.g., `request.log.info({ productId: id }, 'message')` — and do NOT use template literals or string concatenation in log calls",
"max_score": 10
}
]
}