Imported from Komy95/MatchPulse (
skills/backend-api/SKILL.md). Install upstream withnpx skills add Komy95/MatchPulse --skill backend-api. Copyright stays with the author.
Backend API implementation skill
Purpose
Build validated, authorized Next.js route handlers.
Use this skill when
- Adding or modifying files under
app/api/v1/ - Implementing group, prediction, leaderboard, insight, team, or simulation endpoints
Inputs
- API contract from
docs/API-SPECS.md - Domain logic in
lib/* - Firebase Auth session and Firestore Security Rules requirements
Process
- Validate route params and request body.
- Verify Firebase Auth identity where required.
- Enforce authorization before reading private data.
- Delegate business logic to
lib/*. - Return stable JSON response and error shape.
- Add tests or documented test steps.
Output
- Route handler
- Validation schema
- Domain service call
- Consistent JSON response
Acceptance checklist
- Input validation exists
- Auth required where needed
- Member/admin check exists
- Business logic is not buried in route handler
- Errors use standard shape
- UTC time used for lock checks