add-api-endpoint
Guides the addition of secure, validated API endpoints in a Next.js App Router project.
Install
mkdir -p .claude/skills/add-api-endpoint && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14639" && unzip -o skill.zip -d .claude/skills/add-api-endpoint && rm skill.zipInstalls to .claude/skills/add-api-endpoint
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Add a new Next.js App Router API route with validation, safe errors, Supabase auth checks, docs and tests.Key capabilities
- →Create a route file for a new API endpoint
- →Validate input using Zod and strict schemas
- →Verify Supabase authentication server-side
- →Use consistent JSON response formats
- →Update API documentation in `docs/api.md`
- →Add tests for the new endpoint
How it works
The skill creates a new route file, implements input validation with Zod, adds server-side Supabase authentication, and ensures consistent JSON responses. It also updates documentation and adds tests.
Inputs & outputs
When to use add-api-endpoint
- →Adding new backend API routes
- →Securing API endpoints
- →Updating API documentation
About this skill
Skill Instructions
When asked to add a new API endpoint:
- Create route file:
src/app/api/<name>/route.ts - Validate input (query/body) with Zod and strict schemas
- Verify Supabase auth server-side; never accept client user_id
- Use consistent JSON response:
{ ok: true, data }{ ok: false, error: { code, message } }
- Add docs: update
docs/api.md - Add tests (Vitest schema/unit; Playwright if user flow changes)
- Run:
npm run lintnpm run test
When not to use it
- →When not adding a Next.js App Router API route
- →When not needing input validation
- →When not requiring Supabase auth checks
Limitations
- →The skill is specific to Next.js App Router API routes
- →It requires Zod for input validation
- →It requires Supabase for authentication
How it compares
This skill enforces a standardized, secure, and well-documented API route creation process, unlike ad-hoc manual development.
Compared to similar skills
add-api-endpoint side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| add-api-endpoint (this skill) | 0 | 6mo | No flags | Intermediate |
| backend-dev-guidelines | 10 | 1mo | Review | Advanced |
| route-handlers | 1 | 7mo | Review | Intermediate |
| backend-dev-guidelines | 0 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
backend-dev-guidelines
langfuse
Comprehensive backend development guide for Langfuse's Next.js 14/tRPC/Express/TypeScript monorepo. Use when creating tRPC routers, public API endpoints, BullMQ queue processors, services, or working with tRPC procedures, Next.js API routes, Prisma database access, ClickHouse analytics queries, Redis queues, OpenTelemetry instrumentation, Zod v4 validation, env.mjs configuration, tenant isolation patterns, or async patterns. Covers layered architecture (tRPC procedures → services, queue processors → services), dual database system (PostgreSQL + ClickHouse), projectId filtering for multi-tenant isolation, traceException error handling, observability patterns, and testing strategies (Jest for web, vitest for worker).
route-handlers
davepoon
This skill should be used when the user asks to "create an API route", "add an endpoint", "build a REST API", "handle POST requests", "create route handlers", "stream responses", or needs guidance on Next.js API development in the App Router.
backend-dev-guidelines
yashvinthan
Comprehensive backend development guide for Langfuse's Next.js 14/tRPC/Express/TypeScript monorepo. Use when creating tRPC routers, public API endpoints, BullMQ queue processors, services, or working with tRPC procedures, Next.js API routes, Prisma database access, ClickHouse analytics queries, Redi
hr-portal-skill
hariventures2000-ship-it
Use this skill when developing, testing, debugging, or modifying code inside the HR Portal frontend (apps/hr-portal). It applies to handling HR administration tasks such as employee roster management, contract seeding, leave request approvals, attendance monitoring, payroll calculation, and recruitm
payload
payloadcms
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
add-setting-env
lobehub
Guide for adding environment variables to configure user settings. Use when implementing server-side environment variables that control default values for user settings. Triggers on env var configuration or setting default value tasks.