fastify-best-practices
Guides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managi
- 0
- Installs
- —
- Rating
- —
- Success rate
- 21
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 9bf0401e554ac185… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
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.md→routes.md→schemas.md - Adding authentication:
plugins.md→hooks.md→authentication.md - Improving performance:
schemas.md→serialization.md→performance.md - Setting up testing:
routes.md→testing.md - Going to production:
logging.md→configuration.md→deployment.md
How to use
Read individual rule files for detailed explanations and code examples:
- rules/plugins.md - Plugin development and encapsulation
- rules/routes.md - Route organization and handlers
- rules/schemas.md - JSON Schema validation
- rules/error-handling.md - Error handling patterns
- rules/hooks.md - Hooks and request lifecycle
- rules/authentication.md - Authentication and authorization
- rules/testing.md - Testing with inject()
- rules/performance.md - Performance optimization
- rules/logging.md - Logging with Pino
- rules/typescript.md - TypeScript integration
- rules/decorators.md - Decorators and extensions
- rules/content-type.md - Content type parsing
- rules/serialization.md - Response serialization
- rules/cors-security.md - CORS and security headers
- rules/websockets.md - WebSocket support
- rules/database.md - Database integration patterns
- rules/configuration.md - Application configuration
- rules/deployment.md - Production deployment
- rules/http-proxy.md - HTTP proxying and reply.from()
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
Files
21- SKILL.md
d1d90340de3.7 KB - rules/authentication.md
3820b452de13.3 KB - rules/configuration.md
f045835db75.3 KB - rules/content-type.md
46c40b5a408.8 KB - rules/cors-security.md
3599c3583f9.5 KB - rules/database.md
826b8fa6487.7 KB - rules/decorators.md
ffc34ee62a10.1 KB - rules/deployment.md
db9154c9929.4 KB - rules/error-handling.md
b54cd93c3610.4 KB - rules/hooks.md
79da189de210.5 KB - rules/http-proxy.md
2449409b0d5.7 KB - rules/logging.md
cf798478348.5 KB - rules/performance.md
c289c912f79.9 KB - rules/plugins.md
03c2c5b8578.2 KB - rules/routes.md
c8f3a17b4f10.4 KB - rules/schemas.md
950b5bed2512.6 KB - rules/serialization.md
61c34b898110.4 KB - rules/testing.md
84b1a8b78b11.6 KB - rules/typescript.md
4ce29b87869.6 KB - rules/websockets.md
45def95a6c9.4 KB - tile.json
f400e91da7869 B
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from mcollina/skills8
Creates, structures, and reviews technical documentation following the Diátaxis framework (tutorials, how-to guides, reference, and explanation pages). Use when a user needs to write or reorganize docs, structure a tutorial vs. a how-to guide, build reference docs or API documentation, create explan
Creates, updates, or optimizes an AGENTS.md file for a repository with minimal, high-signal instructions covering non-discoverable coding conventions, tooling quirks, workflow preferences, and project-specific rules that agents cannot infer from reading the codebase. Use when setting up agent instru
Configures ESLint v9 flat config and neostandard for JavaScript and TypeScript projects, including migrating from legacy `.eslintrc*` files or the `standard` package. Use when you need to set up or fix linting with `eslint.config.js` or `eslint.config.mjs`, troubleshoot lint errors, configure neosta
Provides domain-specific best practices for Node.js development with TypeScript, covering type stripping, async patterns, error handling, streams, modules, testing, performance, caching, logging, and more. Use when setting up Node.js projects with native TypeScript support, configuring type strippin
Contributes to and debugs Node.js core, including nodejs/node commit and PR tone, contribution workflows, native crashes, V8 performance, node-gyp builds, N-API bindings, and libuv issues. Use when drafting or reviewing a Node.js core commit or pull request, working in nodejs/node, or diagnosing C++
Implements OAuth 2.0/2.1 authorization flows in Fastify applications — configures authorization code with PKCE, client credentials, device flow, refresh token rotation, JWT validation, and token introspection/revocation endpoints. Use when setting up authentication, authorization, login flows, acces
Use this skill whenever the prompt contains any `github.com` URL, even if the user only pastes a link and gives no GitHub-specific keywords. Handles git and GitHub operations using the gh CLI. Triggers include any GitHub link to an issue, pull request, commit, compare page, Actions run, release, dis
Optimizes AI skills for activation, clarity, and cross-model reliability. Use when creating or editing skill packs, diagnosing weak skill uptake, reducing regressions, tuning instruction salience, improving examples, shrinking context cost, or setting benchmark/release gates for skills. Trigger term
Related backend skillsscan passed
Report browser/API/CLI/job/worker/webhook bugs. (gstack)
PostHog integration for server-side Node.js applications using posthog-node
Handle FormData, file uploads, Blob, Uint8Array, and ReadableStream inputs in tRPC mutations. Use octetInputParser from @trpc/server/http for binary data. Route non-JSON requests with splitLink and isNonJsonSerializable() from @trpc/client. FormData and binary inputs only work with mutations (POST).
Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes. Use when building or reviewing Node.js, Express, or Next.js API routes and their data access.
Guide for upgrading Stripe API versions, webhook endpoints, server-side SDKs, Stripe.js, and mobile SDKs