api-endpoint-generator

A generator for REST API endpoints, which are web routes that let software read or change data, in Express.js with TypeScript or FastAPI with Python.

In plain words
What is it for?
Use it to scaffold routes such as creating users or fetching orders, after specifying the framework, resource, method, path, data fields, response, and business rules.
Why use it?
It helps turn an endpoint request into a consistent starting structure with validation, typed inputs and outputs, error handling, documentation, and a test stub.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/timothywarner/copilot-dev/api-endpoint-generator
Any agent
npx skills add timothywarner/copilot-dev --skill api-endpoint-generator
Clone the repo
git clone --depth 1 https://github.com/timothywarner/copilot-dev

Made for: Claude Code, Codex.

Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,277 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00092 $0.02277
Opus 5 $0.00046 $0.01138
Sonnet 5 $0.00018 $0.00455
Haiku 4.5 $0.00009 $0.00228

Measured 2d ago against content hash c3d3f0d47c82, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-endpoint-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (endpoint-template.py, endpoint-template.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/api-endpoint-generator/SKILL.md · 268 lines

How it starts

The opening of the file, as written. The whole thing — 268 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Endpoint Generator Skill

You are an expert API designer. When this skill activates, you generate complete, production-ready REST API endpoints for either TypeScript/Express or Python/FastAPI. Follow every step below exactly.

Step 1: Gather Requirements

Before generating any code, determine:

  1. Framework: TypeScript + Express, or Python + FastAPI?
  2. Resource: What entity is being managed? (e.g., User, Order, Product)
  3. HTTP method and path: GET /users/:id, POST /products, etc.
  4. Input shape: What fields does the request body, path params, or query params contain?
  5. Output shape: What does a success response look like?
  6. Business rules: Any constraints on the input? (e.g., email must be unique, age >= 18)

If any of these are missing from the user's prompt, ask for them before generating.

Step 2: Apply the Standard Output Structure

Every generated endpoint must include all five layers:

Layer Purpose
Schema / Validator Zod (TS) or Pydantic (Python) defines input shape and validates at the boundary
Route Handler The async function that orchestrates validation, logic, and response
Typed Request/Response TypeScript generics or Python type hints — no any, no dict without hints
Error Handling RFC 7807 Problem Details format for all 4xx/5xx responses
Unit Test Stub Vitest (TS) or pytest (Python) — all happy path + key error paths

Step 3: TypeScript / Express Pattern

Follow this exact template for TypeScript endpoints:

import { Router, Request, Response, NextFunction } from 'express';
import { z } from 'zod';

// --- 1. Input schema (validates and infers the TS type simultaneously) ---
const CreateUserSchema = z.object({
  email: z.string().email({ message: 'Must be a valid email address' }),
  name: z.string().min(2).max(100),
  age: z.number().int().min(0).max(150),
});

// Infer the TypeScript type from the schema — single source of truth
type CreateUserInput = z.infer<typeof CreateUserSchema>;

// --- 2. Response type ---
interface UserResponse {
  id: string;
  email: string;
  name: string;
  createdAt: string;
}

// --- 3. Route handler ---
/**
 * POST /users
 *
 * Creates a new user account.
 *
 * @param req.body - {@link CreateUserInput}
 * @returns 201 with the created {@link UserResponse}
 * @throws 400 if the request body fails validation
 * @throws 409 if the email address is already registered
 */
async function createUser(
  req: Request,
  res: Response<UserResponse>,
  next: NextFunction,
): Promise<void> {
  // Validate input — parse() throws ZodError on failure
  const parseResult = CreateUserSchema.safeParse(req.body);

  if (!parseResult.success) {
    // RFC 7807 Problem Details — consistent error envelope
    res.status(400).json({
      type: 'https://errors.myapp.com/validation-error',
      title: 'Validation Error',
      status: 400,
      detail: 'One or more fields failed validation.',
      errors: parseResult.error.flatten().fieldErrors,
    } as any);
    return;
  }

  // parseResult.data is now fully typed as CreateUserInput
  const input: CreateUserInput = parseResult.data;

  try {
    // Replace with your actual service/repository call
    const user = await userService.create(input);

    // Return immutable response — never mutate the entity object directly
    res.status(201).json({
      id: user.id,
      email: user.email,
      name: user.name,
      createdAt: user.createdAt.toISOString(),
    });
  } catch (error) {
    // Delegate unexpected errors to Express error middleware
    next(error);
  }
}

// --- 4. Router registration ---
export const userRouter = Router();
userRouter.post('/', createUser);

Read the full file on GitHub · 268 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 268 lines · 92 tokens per session scan A c3d3f0d47c82

Subscribe to this mod's changes

api-endpoint-generator is a skill published in the GitHub repository timothywarner/copilot-dev (46 stars, last pushed 29d ago), licensed MIT. It adds 92 tokens to every session and 2,277 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

improving-frontend-coverage

Runs frontend unit tests with coverage, analyzes coverage reports, and implements meaningful tests to increase coverage by 0.2%. Use when you want to systematically improve frontend test coverage with high-value test cases.

streamlit/streamlit · 48 tokens

run-helix-tests

Submit and monitor .NET MAUI unit tests on Helix infrastructure. Supports running XAML, Resizetizer, Core, Essentials, and other unit test projects on distributed Helix queues.

dotnet/maui · 45 tokens

prowler-test-api

Testing patterns for Prowler API: JSON:API, Celery tasks, RLS isolation, RBAC. Trigger: When writing tests for api/ (JSON:API requests/assertions, cross-tenant isolation, RBAC, Celery tasks, viewsets/serializers).

prowler-cloud/prowler · 62 tokens

qt-qml-test-run

Builds and runs Qt Quick Test (qmltestrunner / CTest) for a QML project, then writes a Markdown report. Use for "run qml tests", "run qmltestrunner".

mavlink/qgroundcontrol · 50 tokens

ordering-and-flakes

Control spec ordering and manage flaky specs — Serial, Ordered containers with BeforeAll/AfterAll/ContinueOnFailure, OncePerOrdered, SpecPriority, plus FlakeAttempts/--flake-attempts, MustPassRepeatedly, --repeat, and --until-it-fails. Use when specs must run in a fixed order, you need once-per-group setup, you're…

onsi/ginkgo · 111 tokens

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens