ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
Fastify routes, JSON Schema validation, plugin system, TypeScript type providers
$ npx -y skills add agents-inc/skills --skill api-framework-fastify --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/api-framework-fastifyContext preview
The summary Claude sees to decide when to auto-load this skill.
Fastify routes, JSON Schema validation, plugin system, TypeScript type providers
name: api-framework-fastify description: Fastify routes, JSON Schema validation, plugin system, TypeScript type providers
> **Quick Guide:** Use Fastify for high-performance Node.js REST APIs with built-in JSON Schema validation and powerful plugin encapsulation. Use `@fastify/type-provider-typebox` for end-to-end type safety (both `Type` and `TypeBoxTypeProvider` re-exported from it). Wrap shared plugins with `fastify-plugin` to expose decorators. Always define response schemas for serialization performance and data leak prevention.
---
<critical_requirements>
> **All code must follow project conventions in CLAUDE.md** (kebab-case, named exports, import ordering, `import type`, named constants)
**(You MUST use `withTypeProvider<>()` for type-safe request/response handling)**
**(You MUST wrap shared plugins with `fastify-plugin` to expose decorators to parent scope)**
**(You MUST define response schemas to enable fast-json-stringify optimization)**
**(You MUST use named constants for HTTP status codes - never raw numbers)**
</critical_requirements>
---
**Auto-detection:** Fastify, fastify.register, fastify.decorate, fastify-plugin, TypeBox, @fastify/type-provider-typebox, @fastify/type-provider-json-schema-to-ts, fastify-type-provider-zod, preHandler, onRequest, preSerialization, JSON Schema validation, fast-json-stringify, FastifyPluginAsyncTypebox
**When to use:**
**When NOT to use:**
**Key patterns covered:**
---
**Detailed Resources:**
---
<philosophy>
**Schema-first, compiled validation.** Fastify compiles JSON schemas at startup into highly optimized validator functions. This provides both runtime safety and documentation from a single source of truth.
**Plugin encapsulation creates microservices in a monolith.** Each plugin has its own scope for decorators and hooks. Child plugins inherit from parents, but parents cannot access child resources - enabling clean separation of concerns.
**Performance without sacrifice.** Fastify achieves 2-3x throughput over Express while maintaining developer ergonomics through TypeScript integration and comprehensive hook system.
</philosophy>
---
<patterns>
Configure Fastify with TypeBox for compile-time AND runtime type safety. `Type` is re-exported from `@fastify/type-provider-typebox`.
import Fastify from "fastify";
import { Type, TypeBoxTypeProvider } from "@fastify/type-provider-typebox";
const SERVER_PORT = 3000;
const SERVER_HOST = "0.0.0.0";
const buildServer = () => {
const server = Fastify({
logger: { level: process.env.LOG_LEVEL ?? "info" },
}).withTypeProvider<TypeBoxTypeProvider>();
server.setErrorHandler(errorHandler);
server.register(userRoutes, { prefix: "/api/users" });
return server;
};
export { buildServer };**Why good:** TypeBox provider enables type inference from schemas, factory function enables testing, `Type` imported from same package
> Full example with startup, error handling, and testing: [examples/core.md](examples/core.md)
---
Define schemas that provide both TypeScript types AND runtime validation from a single source.
import { Type, Static } from "@fastify/type-provider-typebox";
const MIN_USERNAME_LENGTH = 3;
const MAX_USERNAME_LENGTH = 50;
export const UserSchema = Type.Object({
id: Type.String({ format: "uuid" }),
username: Type.String({
minLength: MIN_USERNAME_LENGTH,
maxLength: MAX_USERNAME_LENGTH,
}),
email: Type.String({ format: "email" }),
});
// Derive TypeScript types from schemas
export type User = Static<typeof UserSchema>;**Why good:** Single source of truth for types and validation, `Static<>` derives TS types automatically
> Full schema patterns (composition, partial updates, reusable components): [examples/schemas.md](examples/schemas.md)
---
Define routes with request AND response schemas for complete type safety and serialization optimization.
import type { FastifyPluginAsync } from "fastify";
import { Type } from "@fastify/type-provider-typebox";
const HTTP_OK = 200;
const HTTP_NOT_FOUND = 404;
export const userRoutes: FastifyPluginAsync = async (fastify) => {
fastify.get(
"/:id",
{
schema: {
params: UserParamsSchema,
response: {
[HTTP_OK]: UserSchema,
[HTTP_NOT_FOUND]: ErrorSchema,
},
},
},
async (request, reply)The official skills marketplace for Agents Inc. 150+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Repo: agents-inc/skills
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking, virtual keys, and production…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client patterns
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling, embeddings, image generation,…