fastify-best-practices — скилл для Claude Code: обзор и установка
Скилл обучает ассистента архитектуре серверов на Fastify для Node.js. Он помогает настраивать маршруты, плагины, валидацию схем и логирование через Pino.
npx skills add mcollina/skills --skill fastify-best-practices -a claude-code
npx skills add mcollina/skills --skill fastify -a claude-codeЧто делает fastify-best-practices
Скилл содержит набор руководств по архитектуре бэкендов на Fastify для TypeScript и JavaScript. Ассистент опирается на файлы правил, разбирая жизненный цикл запроса: от хуков и парсинга типов контента до сериализации ответов и логирования через Pino. Для тестирования эндпоинтов без поднятия сетевого порта используется метод inject().
Внутри заложены правила изоляции контекста через инкапсуляцию плагинов и валидация через JSON Schema. Модели типизации в TypeScript опираются на strip types. Если вы привыкли писать роуты без схем валидации или собирать монолитные обработчики без плагинов, скилл будет настойчиво перестраивать код под schema-first подход.
База правил охватывает также настройку CORS, защитных заголовков, WebSocket-соединений и проксирование через reply.from(). Это избавляет от ручного поиска официальных соглашений по разрозненным документам фреймворка.
Какие задачи решает
- организовать модульные плагины с сохранением инкапсуляции Fastify
- настроить валидацию запросов и сериализацию через JSON Schema
- протестировать HTTP-роуты с помощью метода
inject() - сконфигурировать логирование через Pino и централизованную обработку ошибок
Примеры запросов агенту
- Напиши плагин аутентификации для Fastify с проверкой токена в хуке onRequest
- Добавь JSON Schema валидацию для POST-эндпоинта создания пользователя
- Покрой тестами роут `/health` с использованием метода inject() в Fastify
Как установить fastify-best-practices
1Через Skills CLI (Vercel)
npx skills add mcollina/skills --skill fastify-best-practices -a claude-codenpx skills add mcollina/skills --skill fastify -a claude-code2Вручную: положить файлы
~/.claude/skills/fastify/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/fastify/
1Через Skills CLI (Vercel)
npx skills add mcollina/skills --skill fastify -a codex2Вручную: положить файлы
.agents/skills/fastify/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add mcollina/skills --skill fastify -a cursor2Вручную: положить файлы
.cursor/skills/fastify/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install mcollina/skills fastify2Вручную: положить файлы
.github/skills/fastify/SKILL.md1Через Skills CLI (Vercel)
npx skills add mcollina/skills --skill fastify -a gemini-cli2Командой платформы
gemini skills install https://github.com/mcollina/skills --path skills/fastifyВручную: положить файлы
.devin/skills/fastify/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add mcollina/skills --skill fastify -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
Похожие
Вопросы о fastify-best-practices
Как установить fastify-best-practices в Claude Code?
Выполните команду npx skills add mcollina/skills --skill fastify-best-practices -a claude-code в терминале.
Что делает скилл fastify-best-practices?
Он передаёт ИИ-агенту правила работы с Fastify: от архитектуры плагинов и схемы валидации до логирования в Pino и интеграции с базами данных.
Как скилл предлагает тестировать роуты Fastify?
Инструкции предписывают использовать встроенный метод inject(). Он эмулирует HTTP-запросы напрямую к приложению без запуска сетевого слушателя на сокете.
Исходный текст
SKILL.md · MIT
---
name: fastify-best-practices
description: "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, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts."
metadata:
tags: fastify, nodejs, typescript, backend, api, server, http
---
## 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:
```ts
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](rules/plugins.md) - Plugin development and encapsulation
- [rules/routes.md](rules/routes.md) - Route organization and handlers
- [rules/schemas.md](rules/schemas.md) - JSON Schema validation
- [rules/error-handling.md](rules/error-handling.md) - Error handling patterns
- [rules/hooks.md](rules/hooks.md) - Hooks and request lifecycle
- [rules/authentication.md](rules/authentication.md) - Authentication and authorization
- [rules/testing.md](rules/testing.md) - Testing with inject()
- [rules/performance.md](rules/performance.md) - Performance optimization
- [rules/logging.md](rules/logging.md) - Logging with Pino
- [rules/typescript.md](rules/typescript.md) - TypeScript integration
- [rules/decorators.md](rules/decorators.md) - Decorators and extensions
- [rules/content-type.md](rules/content-type.md) - Content type parsing
- [rules/serialization.md](rules/serialization.md) - Response serialization
- [rules/cors-security.md](rules/cors-security.md) - CORS and security headers
- [rules/websockets.md](rules/websockets.md) - WebSocket support
- [rules/database.md](rules/database.md) - Database integration patterns
- [rules/configuration.md](rules/configuration.md) - Application configuration
- [rules/deployment.md](rules/deployment.md) - Production deployment
- [rules/http-proxy.md](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
© mcollina · MIT · mcollina/skills