fastify-best-practices

Standardize Fastify backend APIs with schema-first validation and secure defaults.

1|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/blesstosam/trpc-fastify-starter --skill fastify-best-practices-blesstosam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastify-best-practices
Source: https://github.com/blesstosam/trpc-fastify-starter/tree/main/.agents/skills/fastify-best-practices
Command: npx skills add https://github.com/blesstosam/trpc-fastify-starter --skill fastify-best-practices-blesstosam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardize Fastify development by providing a comprehensive set of best practices for building reliable, secure, and fast APIs with Fastify.

Core Features & Use Cases

  • Encapsulation and plugin architecture guidelines to maintain modular, scalable code
  • Schema-first validation patterns for input/output and error handling
  • Security and performance best practices including CORS, helmet, rate limiting, and compression
  • Testing, observability, and maintainability guidance across backend services
  • Guidance for integrating with OpenAPI/Swagger, logging, and websockets as needed
  • Real-world scenarios such as building API gateways, microservices, and edge deployments

Quick Start

Apply these rules across your Fastify project to establish consistent, secure, and high-performance APIs.

Frequently Asked Questions about fastify-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Fastify API for microservices and edge deployments?

Structure Fastify APIs using encapsulation and plugin architecture guidelines to maintain modular, scalable code for microservices and edge deployments. This enforces secure defaults and consistent observability patterns across backend services.

What is the best way to handle input validation and error handling in Fastify?

Handle input validation and error handling in Fastify using schema-first validation patterns. This enforces strict input and output schemas, automatically generating error responses and ensuring robust API contracts.

How do I configure CORS, rate limiting, and security defaults in Fastify?

Configure CORS, rate limiting, and security defaults in Fastify by applying standardized security best practices. This includes integrating helmet for HTTP header protection, enforcing rate limits, and enabling compression for performance.

Does this Fastify best practices guide cover testing and logging patterns?

Yes, this Fastify best practices guide covers testing, logging, and observability guidance. It enforces consistent testing patterns and structured logging to ensure maintainability across backend API projects.

Can I use Fastify best practices to build an API gateway with OpenAPI integration?

Yes, you can apply Fastify best practices to build API gateways with OpenAPI or Swagger integration. The guidelines support real-world scenarios including proxy configurations, content negotiation, and websockets for robust API design.