New to Claude Skills? Learn how to install them →

mcollina on GitHub

Fastify Best Practices

Free

Streamline your Fastify backend development process.

by mcollina1.9k stars on mcollina/skills
3 views
Updated Aug 3, 2026
Get this skill

Free · Opens the source repo

What Fastify Best Practices does

Fastify Best Practices is a skill designed for developers working with Fastify, a fast and low-overhead web framework for Node.js. This skill provides comprehensive guidelines and best practices for building, configuring, and debugging Fastify applications, whether you are using TypeScript or JavaScript. It covers essential topics such as defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimizing performance, and managing authentication. With this skill, developers can ensure that their applications adhere to industry standards and leverage the full capabilities of Fastify.

The skill includes a structured approach to Fastify development, guiding users through the Fastify request lifecycle, which encompasses hooks, serialization, and logging with Pino. Each section is organized into specific rule files that provide detailed explanations and code examples, making it easy to find the information you need. Whether you are a newcomer to Fastify or looking to refine your existing knowledge, the recommended reading order helps you navigate through common scenarios effectively.

This skill is particularly useful for teams and individual developers who want to maintain high-quality code and efficient workflows while developing backend applications. By following the best practices outlined in this skill, users can avoid common pitfalls and streamline their development process, ultimately leading to more robust and maintainable applications. Fastify Best Practices is an essential resource for anyone looking to enhance their Fastify development skills and ensure their applications are built on a solid foundation.

When to use it

Use this skill when developing backend applications with Fastify, especially when you need to implement plugins, define routes, or configure validation and error handling.

When not to use it

This skill may not be suitable for developers looking for a general-purpose Node.js framework or those who are not specifically working with Fastify.

What you can build with it

Starting a New Fastify Project

Use this skill to set up your Fastify project by following the recommended reading order for plugins and routes.

Implementing Authentication

Leverage the guidelines in this skill to add authentication to your Fastify application efficiently.

Optimizing Application Performance

Utilize the performance optimization strategies outlined in this skill to enhance your Fastify application's speed.

How to install Fastify Best Practices

View source

1. Install with the skills CLI

npx skills add mcollina/skills/fastify --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mcollina

When to use

Use this skill when you need to:

  • Develop backend applications using Fastify
  • Implement Fastify plugins and route handlers
  • Get guidance on Fastify architecture and patterns
  • Use TypeScript with Fastify (strip types)
  • Implement testing with Fastify's inject method
  • Configure validation, serialization, and error handling

Quick Start

A minimal, runnable Fastify server to get started immediately:

import Fastify from 'fastify'

const app = Fastify({ logger: true })

app.get('/health', async (request, reply) => {
  return { status: 'ok' }
})

const start = async () => {
  await app.listen({ port: 3000, host: '0.0.0.0' })
}
start()

Recommended Reading Order for Common Scenarios

  • New to Fastify? Start with plugins.mdroutes.mdschemas.md
  • Adding authentication: plugins.mdhooks.mdauthentication.md
  • Improving performance: schemas.mdserialization.mdperformance.md
  • Setting up testing: routes.mdtesting.md
  • Going to production: logging.mdconfiguration.mddeployment.md

How to use

Read individual rule files for detailed explanations and code examples:

Core Principles

  • Encapsulation: Fastify's plugin system provides automatic encapsulation
  • Schema-first: Define schemas for validation and serialization
  • Performance: Fastify is optimized for speed; use its features correctly
  • Async/await: All handlers and hooks support async functions
  • Minimal dependencies: Prefer Fastify's built-in features and official plugins

Frequently asked questions about Fastify Best Practices

Similar skills