api-development

Build and maintain Express REST API endpoints for authentication, moderation, and academic events.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/werlang/event-hub --skill api-development-werlang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-development
Source: https://github.com/werlang/event-hub/tree/main/.agents/skills/api-development
Command: npx skills add https://github.com/werlang/event-hub --skill api-development-werlang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Maintaining a consistent Express 5 JSON API requires enforcing a stable response envelope, correct HTTP status codes, bearer-token auth, and MySQL-backed model patterns across every route change, which is error-prone without codified guidance. ## Core Features & Use Cases - Route Implementation Guidance: Codified patterns for auth, users, and events route groups, including validation rules, status codes (201, 400, 401, 404, 409), and try/catch plus next(error) orchestration. - Response Contract Enforcement: Standard success and error envelopes via sendSuccess/sendCreated helpers and CustomError with centralized error middleware. - Domain Model Rules: User and Event model conventions such as bcrypt hashing, email normalization, UUID generation, category fallback, and moderation state handling. - Use Case: When adding a new endpoint like event moderation, follow the documented auth middleware, validation, and side-effect patterns (e-mail, Google Calendar) so the route stays resilient and covered by Jest unit tests. ## Quick Start Ask the agent to add a new authenticated endpoint to the events router following the api-development skill conventions.

Frequently Asked Questions about api-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new authenticated route to an Express API?▼

Add the handler in the appropriate file under api/routes, apply the authMiddleware to read the bearer token into req.user, wrap logic in try/catch with next(error), and respond with sendSuccess or sendCreated. Keep data operations in models rather than writing SQL in the route.

How should Express API error responses be structured?▼

Throw a CustomError with an HTTP status and message, then forward it via next(error) to the centralized error middleware. The middleware emits the standard envelope with error true, status, type derived from the status name, and message.

What HTTP status codes should a REST API use for validation and conflicts?▼

This API uses 201 for created resources, 400 for validation errors, 401 for authentication failures, 404 for missing events, and 409 for duplicate registration emails. Reusing these codes keeps client handling predictable.

Can I use PATCH for partial updates in this Express API?▼

No, the HTTP surface is limited to GET, POST, PUT, and DELETE. Model partial-update flows with PUT rather than introducing PATCH, keeping the route contract consistent across auth, users, and events.

Why should route handlers not depend on e-mail or calendar delivery success?▼

Side effects like e-mail notifications and Google Calendar publishing can fail independently of the core operation. Keep the HTTP outcome resilient and test side-effect orchestration with mocks so external delivery failures do not break route success.