Generate API Endpoint
Method + Path: $1 $2
Description: $3
- Detect framework:
cat package.json | grep -E '"express"|"fastify"|"hono"|"koa"|"nestjs"'
ls src/routes/ src/api/ src/handlers/ 2>/dev/null | head -10
- Read 1-2 existing route files to match patterns exactly.
- Generate the route handler with:
- Request validation (Zod schema or project's validator)
- Auth middleware call (if project uses auth)
- Business logic (stub with TODO if complex)
- Proper error handling (use project's error classes)
- Typed request/response
- Register the route in the router file.
- Generate tests:
- Happy path (200/201)
- Validation error (400)
- Auth error (401/403)
- Not found (404) if applicable
- Update API docs if
docs/api.mdor OpenAPI spec exists.