home / skills / ehtbanton / claudeskillsrepo / express-router-generator

express-router-generator skill

/express-router-generator

This skill generates complete Express.js CRUD routers with validation and middleware in TypeScript, accelerating API development.

npx playbooks add skill ehtbanton/claudeskillsrepo --skill express-router-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
792 B
---
name: express-router-generator
description: Generate Express.js router files with RESTful endpoints, middleware, and validation. Triggers on "create express router", "generate express routes", "express API endpoints", "REST router".
---

# Express Router Generator

Generate Express.js router files with RESTful endpoints, middleware, and request validation.

## Output Requirements

**File Output:** `*.router.ts` or `*.routes.ts`
**Format:** Valid Express.js TypeScript
**Standards:** Express 4.x with TypeScript

## When Invoked

Immediately generate a complete Express router with CRUD endpoints, middleware, and validation.

## Example Invocations

**Prompt:** "Create express router for user management"
**Output:** Complete `users.router.ts` with GET, POST, PUT, DELETE endpoints.

Overview

This skill generates ready-to-use Express.js router files in TypeScript with RESTful CRUD endpoints, middleware hooks, and request validation. It produces code compatible with Express 4.x and TypeScript, following a consistent file naming convention. Use it to quickly scaffold secure, typed route modules that integrate into an existing app.

How this skill works

Given an invocation like "create express router for user management," the skill emits a complete .router.ts or .routes.ts file containing GET/POST/PUT/DELETE endpoints, example controller calls, middleware spots, and validation middleware. The generated code uses TypeScript types, standard Express request/response signatures, and includes example validation (e.g., body/query checks) so the router is immediately usable or easy to adapt. Output conforms to common project layouts so you can drop the file into your routes folder and register it with app.use().

When to use it

  • Scaffold a new resource router (users, products, orders) quickly
  • Standardize route shape and middleware patterns across a team
  • Prototype API endpoints during feature discovery
  • Generate consistent typed routers for large TypeScript Express projects
  • Create example routes for onboarding or documentation

Best practices

  • Name files *.router.ts or *.routes.ts so they are easily discoverable
  • Keep controller logic in separate modules; let routers map routes to controllers
  • Add validation schemas for input and return clear 400 responses on failure
  • Register authentication/authorization middleware before route handlers
  • Keep middleware ordering explicit: auth -> validation -> business logic

Example use cases

  • User management router with list, get-by-id, create, update, delete endpoints
  • Product catalog API with query validation and pagination
  • Authentication-related routes (login, logout, refresh) with middleware hooks
  • Admin interfaces with role-based middleware and bulk actions
  • Webhook endpoints with signature validation and idempotency checks

FAQ

Does the generated router use TypeScript and Express 4.x?

Yes — the code is TypeScript-first and structured for Express 4.x usage and common project layouts.

Will the router include request validation and middleware examples?

Yes — each router includes validation middleware examples and designated middleware slots for auth, logging, or custom checks.