Communitygithub.com

YepAPI/skills

Express.js and Fastify patterns: middleware, route organization, validation with Zod, error handling, plugin system, request lifecycle, TypeScript setup.

skills란 무엇인가요?

skills is a Claude Code agent skill that express.js and Fastify patterns: middleware, route organization, validation with Zod, error handling, plugin system, request lifecycle, TypeScript setup.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/express-fastify

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Express & Fastify

Rules

  • Organize routes by domain: routes/users.ts, routes/orders.ts — one router per resource
  • Validate all input with Zod: parse req.body, req.params, req.query before processing
  • Centralized error handler: catch-all middleware (Express) or setErrorHandler (Fastify)
  • Return consistent error format: { error: { code: string, message: string, details?: unknown } }
  • TypeScript: type request/response with generics — Request<Params, ResBody, ReqBody, Query>
  • Middleware order: CORS, body parser, auth, rate limiting, routes, error handler
  • Use async route handlers — wrap with error catching or use express-async-errors
  • Fastify: use the plugin system to encapsulate routes and decorators — fastify.register()
  • Fastify schemas: define JSON Schema or use @fastify/type-provider-zod for validation + serialization
  • Health check: GET /health — return 200 with DB/Redis connectivity status
  • Graceful shutdown: listen for SIGTERM, stop accepting connections, finish in-flight requests

Patterns

// Express + Zod validation
import { Router } from "express";
import { z } from "zod";

const router = Router();
const CreateUserSchema = z.object({ email: z.string().email(), name: z.string().min(1) });

router.post("/users", async (req, res, next) => {
  try {
    const body = CreateUserSchema.parse(req.body);
    const user = await createUser(body);
    res.status(201).json(user);
  } catch (err) { next(err); }
});
// Fastify + Zod type provider
import Fastify from "fastify";
import { serializerCompiler, validatorCompiler, ZodTypeProvider } from "fastify-type-provider-zod";

const app = Fastify().withTypeProvider<ZodTypeProvider>();
app.setValidatorCompiler(validatorCompiler);
app.setSerializerCompiler(serializerCompiler);

app.post("/users", { schema: { body: CreateUserSchema } }, async (req) => {
  return createUser(req.body); // fully typed
});

Avoid

  • Putting business logic in route handlers — extract to service/domain layer
  • Forgetting async error handling in Express — unhandled rejections crash the process
  • Importing all routes in one file — use router.use() or Fastify plugins for modularity
  • Skipping input validation because "the frontend validates" — always validate server-side

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Tool-use patterns, multi-step reasoning, agent orchestration, and structured outputs.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Web analytics integration — event tracking, custom dashboards, privacy-first.

YepAPI/skills

Framer Motion — transitions, scroll animations, layout animations.

YepAPI/skills

OpenAPI 3.1 from Zod schemas, interactive docs with Swagger/Scalar, versioning, and example requests for every endpoint.

YepAPI/skills

Authentication security — bcrypt/argon2 hashing, brute force protection, secure password resets.

YepAPI/skills

Session auth, social providers, CSRF protection, and secure cookie patterns.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Link building research and backlink audit using YepAPI.

YepAPI/skills

MDX blog setup, RSS feed generation, sitemap.xml, structured data/JSON-LD, and related posts.

YepAPI/skills

Redis caching, CDN cache headers, stale-while-revalidate, cache invalidation, React Query.

YepAPI/skills

Recharts/Chart.js data visualization — bar, line, area, pie charts.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

관련 스킬