backend-endpoint
Generate production-ready REST or GraphQL endpoints with request validation, error handling, and integration tests.
Triggers
Natural-language phrases that auto-invoke the skill:
- “add endpoint”
- “create API”
- “new route”
- “add route”
- “create API endpoint for [resource]“
What it does
- Queries the knowledge graph for existing API/auth/validation patterns before gathering requirements (Phase 0)
- Gathers endpoint details: path, HTTP method, resource, framework (Express, Fastify, NestJS, Next.js App Router, GraphQL), auth and validation needs
- Runs a ToM verification checkpoint to confirm interpretation before generating code (always for multi-param paths, custom authz, or sensitive data)
- Generates the route handler from framework templates, plus a request validation schema (Zod by default; Joi, Yup, express-validator supported)
- Writes error-handling middleware and an integration test inline, covering 200/201, 400, 401, 404, and 500 cases
- Adds JSDoc/OpenAPI annotations and emits an execution summary back into the knowledge graph
Example
"add a POST endpoint for /api/users with email validation"Produces a route handler, a Zod validation schema, error-handling middleware, and a supertest integration test, registered following the project’s existing conventions.
Related
- Theory of Mind — the verification checkpoint that confirms intent before code generation
- Knowledge Graph — where endpoint patterns and decisions are stored and surfaced
- backend-test — for adding tests to endpoints that already exist