Fastify Best Practices
With Fastify Best Practices you build Node.js servers and REST APIs on Fastify, from routes and plugins through validation and authentication to running in production.
What is Fastify Best Practices?
Fastify Best Practices is a skill for Claude that guides you through building backend servers and REST APIs with the Node.js framework Fastify, in TypeScript or JavaScript. It applies when you set up, configure or debug a Fastify application and covers the full request lifecycle, meaning hooks, serialization and logging with Pino.
The skill consists of an overview and separate rule files with explanations and code examples, for instance on plugins, routes, JSON Schema, error handling, authentication, CORS, databases, WebSockets, configuration and deployment. For common goals it suggests a reading order, for example for getting started, adding authentication, improving performance, setting up tests or going to production.
Its guiding principles are encapsulation through the plugin system, a schema-first approach to validation and serialization, async/await in handlers and hooks, and few dependencies by relying on built-in features and official plugins. It pays off for teams that build or maintain Node.js APIs with Fastify. You need basic knowledge of Node.js and of TypeScript or JavaScript.
Who it is for
Backend developers and teams who build, run or rework Node.js servers and REST APIs with Fastify in TypeScript or JavaScript.
Use cases
- You set up a new REST API with Fastify and TypeScript and want plugins, routes and schemas structured cleanly from the start.
- You add JWT login, role checks, CORS rules and security headers to an existing Fastify application.
- You prepare a Fastify service for Docker or Kubernetes, with health checks, logging via Pino and orderly shutdown.
What Fastify Best Practices does
Recommended reading order
For getting started, authentication, performance, testing and production, the skill tells you which rule files to read in sequence, for a first project plugins, then routes, then schemas.
Schema-first with JSON Schema
The skill explains request validation and response serialization through JSON Schema, also as part of the recommended steps for performance optimization.
Authentication and permissions
Patterns for JWT with @fastify/jwt, refresh tokens, role and permission based authorization, API keys, OAuth 2.0, sessions, password hashing and rate limiting for login routes.
Testing with inject
The skill describes how you test Fastify applications with the built-in inject method, including tests against a connected database.
Databases via official adapters
Connecting PostgreSQL, MySQL, MongoDB and Redis through the official plugins of the @fastify organization, with a repository pattern and connection pool configuration.
Running in production
Graceful shutdown with close-with-grace, health checks, Docker and Kubernetes, request timeouts, compression, metrics and deployments without downtime.
Say this to activate the skill
"Set up a Fastify server with a health route in TypeScript.""Add JWT authentication to my Fastify API.""How do I test this Fastify route with inject?""Get my Fastify app ready for production." Install
npx skills add mcollina/skills --skill fastify-best-practices
The command installs the original version from the author's repository (Vercel skills CLI, needs Node.js), add -g for all projects. We do not host a copy: updates come straight from the author. Need help with setup? How to install skills →
Checked automatically
- Automated check on 2026-11-15 (revision c75d70d): 21 files in the skill folder read by pattern search. It found no hidden characters, no instructions to override rules, no download-and-run and no access to credentials.
Independent checks on skills.sh, as of 15 Nov 2026
| Gen Agent Trust Hub | Pass |
|---|---|
| Socket | Pass |
| Snyk | Pass |
Good to know
- The examples rely on additional packages such as @fastify/jwt, @fastify/cors, env-schema or close-with-grace, which you install in your project.
- The skill consistently recommends official plugins from the @fastify organization. If your project uses other libraries, you need to adapt the patterns yourself.
- You need basic knowledge of Node.js and of TypeScript or JavaScript, as the skill covers Fastify topics only.
- The check is an automated pattern search, not a security guarantee, and reads the skill folder only. The command always installs the author's current version; later versions have not been reviewed by us.
Frequently asked questions about Fastify Best Practices
What is Fastify Best Practices?
Fastify Best Practices is a skill for Claude that guides the development of backend servers and REST APIs with Fastify. It bundles rules and code examples on routes, plugins, validation, authentication, testing, databases and deployment.
How do I install Fastify Best Practices?
You install Fastify Best Practices with the command 'npx skills add mcollina/skills --skill fastify-best-practices'. After that the skill is available to Claude and applies to tasks around Fastify.
Is Fastify Best Practices free?
Yes, Fastify Best Practices is released under the MIT license, so you can use it free of charge, including in commercial projects.
Who is Fastify Best Practices for?
Fastify Best Practices is for anyone developing Node.js backends with Fastify. Newcomers follow the recommended reading order, experienced teams use the rules on performance, security and deployment.
What data does Fastify Best Practices send?
Fastify Best Practices consists of text and rule files with code examples. The source we read contains no calls of its own that send data to external services. The code you write with it connects to databases or other services depending on your project.
Does Fastify Best Practices support TypeScript?
Yes, Fastify Best Practices covers TypeScript explicitly, including integration via strip types and declaration merging for decorators. The patterns work just as well in JavaScript.
Share this skill
About this skill
Fastify Best Practices comes from mcollina and is an open-source project maintained by its author and community.
Author: mcollina / github.com. Source: github.com/mcollina/skills/tree/main/skills/fastify. Licence: MIT.
Curated by Collective Brain, an AI and automation digital agency from Hamburg, together with WhiteFox Automations. More vetted skills in the skills catalog.
Working in Germany, Austria or Switzerland? We help teams roll out Claude, in English or German.
Want this skill tailored to your team?
Fastify Best Practices is a strong starting point. A skill gets really powerful once it knows your workflows, templates and tone of voice. We build custom skills for teams, from analysis to rollout, and connect them to our work in AI consulting.
Request a custom skill →