/scaffold-api Skill
Scaffold a complete set of REST endpoints for a resource.
Usage
/scaffold-api users— scaffold CRUD endpoints for users/scaffold-api posts— scaffold CRUD endpoints for posts
Steps
- Detect framework: Identify if using Express, Fastify, Hono, Next.js API routes, etc.
- Detect patterns: Read existing routes to match conventions (file structure, naming, middleware usage)
- Generate endpoints:
GET /[resource]— list with paginationGET /[resource]/:id— get by IDPOST /[resource]— createPUT /[resource]/:id— updateDELETE /[resource]/:id— delete
- Add validation: Input validation using the project's validation library (Zod, Joi, etc.)
- Add types: TypeScript interfaces for request/response
- Add tests: Basic test suite for each endpoint
Guidelines
- Match existing project patterns exactly
- Include proper error handling (404, 400, 500)
- Add input validation for POST/PUT
- Use proper HTTP status codes
- Include pagination for list endpoints
Converted and distributed by TomeVault — claim your Tome and manage your conversions.