timothywarner/copilot-dev/api-endpoint-generator
Claude Code and agent skill by timothywarner/copilot-dev
- community
Checking that the SKILL.md file is still in the repository.
Scaffold complete REST API endpoints with input validation, error handling, typed request/response, JSDoc or docstrings, and a unit test stub. Use when asked to create a new API route, endpoint, controller, handler, or REST resource in Express.js (TypeScript) or FastAPI (Python). Produces production-ready code following immutable patterns, Zod/Pydantic validation, and RFC 7807 error responses.
Install
npx vskill@latest install timothywarner/copilot-dev/api-endpoint-generatorSKILL.md
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:
- Framework: TypeScript + Express, or Python + FastAPI?
- Resource: What entity is being managed? (e.g.,
User,Order,Product) - HTTP method and path:
GET /users/:id,POST /products, etc. - Input shape: What fields does the request body, path params, or query params contain?
- Output shape: What does a success response look like?
- 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:
Key rules for TypeScript endpoints
- Never use `any` for request/response types — use Zod inference
- Always use `safeParse()` not
parse()— lets you control the 400 response format - Immutable response objects — spread or construct new objects, never mutate DB entities
- Pass unknown errors to `next(error)` — let centralized error middleware handle 500s
- Use `async/await` — no callbacks, no Promise chains
Step 4: Python / FastAPI Pattern
Follow this exact template for Python endpoints:
Key rules for Python endpoints
- Use `EmailStr` from pydantic-email-validator for email fields
- `Field(ge=..., le=...)` for numeric constraints — not custom logic in the handler
- `@field_validator` for cross-field or complex validation
- `response_model=` on the decorator — FastAPI filters and validates output automatically
- Raise `HTTPException` for expected business errors, not generic
Exception - Never return raw dict — always return a Pydantic model instance
Step 5: Error Response Format (RFC 7807)
All error responses must use this envelope — consistent across both frameworks:
FastAPI returns 422 Unprocessable Entity with a similar format automatically from Pydantic.
Step 6: Unit Test Stub
Always generate a test file alongside the endpoint. Name it:
- TypeScript:
users.test.tsusing Vitest - Python:
test_users.pyusing pytest + httpx
The stub must include test cases for:
- Happy path — valid input returns correct status code and response shape
- Validation error — missing required field returns 400/422
- Validation error — invalid field type returns 400/422
- Business error — e.g., duplicate email returns 409
Step 7: Output Checklist
Before delivering any generated code:
- [ ] Input schema covers all required fields with appropriate constraints
- [ ] TypeScript:
safeParse()used; type inferred viaz.infer<> - [ ] Python:
response_model=set on route decorator - [ ] No
anytypes (TypeScript) or untypeddict(Python) - [ ] Error response uses RFC 7807 format
- [ ] Unknown errors delegated to middleware (
next(error)) or re-raised asHTTPException - [ ] JSDoc / docstring covers: what it does, params, returns, throws
- [ ] Test stub covers happy path + at least 2 error paths
Reference Files
endpoint-template.ts— Complete TypeScript/Express endpoint with Zod validationendpoint-template.py— Complete Python/FastAPI endpoint with Pydantic v2
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/api-endpoint-generator/SKILL.md
Popularity
- Repository stars
- 43
- Repository forks
- 44
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/timothywarner/copilot-dev/api-endpoint-generator)