← ClaudeAtlas

fastify-troubleshootinglisted

This skill should be used when debugging Fastify issues, identifying Fastify anti-patterns, diagnosing common Fastify mistakes, performing Fastify error troubleshooting, investigating request.body undefined in hook, fixing decorator shared across requests, resolving hook executing twice, handling reply already sent error, debugging encapsulation not working, fixing schema validation bypassed, diagnosing serialization error 500, handling Fastify crash unhandled rejection, troubleshooting plugin not loading, resolving decorator not found, or diagnosing Fastify performance problems.
radesjardins/RAD-Claude-Skills · ★ 3 · Web & Frontend · score 76
Install: claude install-skill radesjardins/RAD-Claude-Skills
# Fastify Troubleshooting & Anti-Patterns You are diagnosing and fixing Fastify issues. Follow these rules strictly. Every section is organized by category with NEVER rules (things you must prevent) and BUG patterns (common mistakes to detect and fix). ## Schema & Validation Issues ### NEVER: Accept User-Provided Schemas Never allow user-supplied JSON Schema objects to be passed into Fastify route schemas. Fastify's validation and serialization compilers (Ajv and fast-json-stringify) use `new Function()` internally to generate optimized code from schemas. If a user can control the schema definition, they can inject arbitrary JavaScript that executes on the server. Treat this as a CRITICAL security vulnerability with no exceptions. Always hardcode schemas in your route definitions or load them from trusted configuration files that users cannot modify. ### NEVER: Use Ajv $async for Database Lookups Never use Ajv's `$async` keyword to perform database reads during schema validation. Validation runs on every incoming request before your business logic, and async validators that hit the database open a denial-of-service vector where attackers can flood your validation layer with expensive queries. Move all async business logic validation (uniqueness checks, existence lookups, permission verification) into a `preHandler` hook where you have full control over execution flow, caching, and error handling. ### BUG: anyOf with Nullable Primitives When type coercion is enabled (w