API Route Generator skill for Claude and Codex
Produces a complete Express route file you can mount and run: imports, the middleware you chose in the right order, request validation against your schema…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a new Express.js endpoint needs a route file with middleware, validation, and a handler stub that matches a request and response schema. Do not use for debugging an existing route, generating routes for other frameworks, or writing the business logic inside the handler. Related topics: coding, api.
What it will ask you for
- HTTP method (choose one: GET, POST, PUT, PATCH, DELETE)
- Endpoint path (free text, e.g. "/resources/:id")
- Request body or query schema (JSON Schema) (longer free text)
- Response body schema (JSON Schema) (longer free text)
- Middleware to include (choose any: Auth, Validation, Logging, Rate limiting, CORS)
- Authentication required (choose one: Yes, No)
- Language (choose one: JavaScript (CommonJS), JavaScript (ESM), TypeScript)
How it works
- List the imports the chosen middleware and validator need and nothing more, so the file runs without unused dependencies.
- Order the middleware logging, rate limiting, auth, validation, and write a one-line comment on what each guards.
- Implement request validation against the schema and return 400 with field-level errors; return 401 before validation when auth is required.
- Write the async handler with error forwarding to next(err), a TODO for the business logic, and a response literal that matches the response schema field for field.
- Append a mount example for app.js and confirm the file exports a single router.
What you get
A single fenced code block with the complete route file (imports, middleware, validation, handler, export), followed by a two-line snippet that mounts it in app.js.
What it watches out for
- Running validation before auth, which lets anonymous callers probe the schema and wastes work on requests that will be rejected.
- Returning a response shape that drifts from the schema, such as a bare array where the schema says an object with a data key.
- Forgetting to forward async errors to next(err), so a thrown error leaves the request hanging instead of returning 500.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.