skills/nodejs-skills/fastify/SKILL.md
Provides comprehensive guidance for Fastify framework including routing, plugins, JSON schema validation, hooks, serialization, and performance optimization. Use when the user asks about Fastify, needs to create high-performance Node.js applications, implement plugins, or optimize API performance.
npx skillsauth add partme-ai/full-stack-skills fastifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill whenever the user wants to:
fastify.inject() for testing, deploy with process managerconst fastify = require('fastify')({ logger: true });
// Register plugins
fastify.register(require('@fastify/cors'));
fastify.register(require('@fastify/helmet'));
// Route with JSON Schema validation
fastify.post('/api/items', {
schema: {
body: {
type: 'object',
required: ['name', 'price'],
properties: {
name: { type: 'string', minLength: 1 },
price: { type: 'number', minimum: 0 },
},
},
response: {
201: {
type: 'object',
properties: {
id: { type: 'integer' },
name: { type: 'string' },
price: { type: 'number' },
},
},
},
},
handler: async (request, reply) => {
const item = await createItem(request.body);
reply.code(201).send(item);
},
});
fastify.get('/api/items/:id', async (request, reply) => {
const item = await getItem(request.params.id);
if (!item) {
reply.code(404).send({ error: 'Not found' });
return;
}
return item;
});
fastify.listen({ port: 3000, host: '0.0.0.0' });
// plugins/db.js
async function dbPlugin(fastify, options) {
const pool = createPool(options.connectionString);
fastify.decorate('db', pool);
fastify.addHook('onClose', async () => pool.end());
}
module.exports = require('fastify-plugin')(dbPlugin);
// app.js
fastify.register(require('./plugins/db'), {
connectionString: process.env.DATABASE_URL,
});
fastify.setErrorHandler((error, request, reply) => {
request.log.error(error);
const statusCode = error.statusCode || 500;
reply.code(statusCode).send({
error: error.message,
statusCode,
});
});
fastify-plugin to break encapsulation when sharing decorators across scopesconsole.log in productiononRequest, preHandler) for cross-cutting concernsfastify.inject() without starting a serverfastify, Node.js, high performance, JSON schema, plugins, serialization, hooks, Pino logger
development
Provides per-component and per-API examples with cross-platform compatibility details for uni-app, covering built-in components, uni-ui components, and APIs (network, storage, device, UI, navigation, media). Use when the user needs official uni-app components or APIs, wants per-component examples with doc links, or needs platform compatibility checks.
tools
Creates new uni-app projects via the official CLI or HBuilderX with Vue 2/Vue 3 template selection, manifest.json and pages.json configuration, and directory structure setup. Use when the user wants to scaffold a new uni-app project, initialize project files with a single command, or set up the development environment.
tools
Browses, installs, configures, and manages plugins from the uni-app plugin market (ext.dcloud.net.cn) including component plugins, API plugins, and template plugins with dependency handling. Use when the user needs to find and install uni-app plugins, configure plugin settings, manage plugin dependencies, or integrate third-party components.
tools
Develops native Android and iOS plugins for uni-app including module creation, JavaScript-to-native communication, and plugin packaging for distribution. Use when the user needs to build custom native modules, extend uni-app with native capabilities (camera, Bluetooth, sensors), or create publishable native plugins.