Skip to content

Express API Builder

Verified

Build production-ready Express.js REST APIs with middleware stacks, JWT auth, input validation, error handling, and OpenAPI documentation.

By community 5,800 v2.1.0 Updated 2026-03-08

Install

Claude Code

Copy the SKILL.md file to .claude/skills/express-api.md

About This Skill

Express API Builder generates well-structured Express.js applications following the router-controller-service pattern. It produces maintainable, testable code with a complete middleware stack ready for production.

Architecture Pattern

The skill enforces a clean separation: Routes define endpoints and apply middleware, Controllers handle HTTP request/response, Services contain business logic, and Repositories abstract data access. This makes testing each layer in isolation straightforward.

Middleware Stack

Generated apps include: helmet for security headers, cors with configurable origins, express-rate-limit for API throttling, morgan for request logging, and a global error handler that normalizes errors into consistent JSON responses.

Authentication

JWT auth middleware with access + refresh token pattern. Refresh tokens are stored with expiry and rotation on use. Supports both Bearer token and cookie-based token delivery.

Validation

Request validation using Zod schemas co-located with routes. Schema inference generates TypeScript types automatically. Validation errors return RFC 7807 Problem Details responses.

Documentation

JSDoc annotations on routes feed swagger-jsdoc to auto-generate OpenAPI 3.1 specs. Swagger UI is mounted at /api-docs in development mode.

Use Cases

  • Generating Express router files with full CRUD operations
  • Adding JWT authentication middleware with refresh token rotation
  • Creating Zod or Joi validation schemas for request bodies
  • Auto-generating OpenAPI 3.1 specs from route definitions

Pros & Cons

Pros

  • + Clean router-controller-service separation makes testing easy
  • + Includes complete security middleware stack out of the box
  • + Auto-generates OpenAPI documentation from route annotations
  • + Supports TypeScript with full type inference from Zod schemas

Cons

  • - Opinionated structure may not suit existing Express projects
  • - Refresh token rotation requires a persistent store (Redis or DB)

Related AI Tools

Related Skills

Stay Updated on Agent Skills

Get weekly curated skills + safety alerts

每周精选 Skills + 安全预警