What problem does it solve? Building backend endpoints in an Astro project often leads to inconsistent response shapes, missing input validation, leaked secrets, and unclear auth rules. This Skill enforces a single set of server-side conventions so every endpoint in src/pages/api/ behaves predictably and securely. ## Core Features & Use Cases - Standardized endpoint structure: Endpoints export prerender = false and a typed APIRoute, return { ok } JSON via a local json() helper, and use consistent status codes (200, 400, 401, 404, 500, 502). - Auth and spam protection: Studio-triggered endpoints (AI generation, screenshots) are gated with isApiAuthorized, while public endpoints like the contact form rely on Zod validation plus honeypot and timing checks. - Env, caching, and side effects: Secrets come from src/lib/env.ts and never reach the client, cacheable GET endpoints declare TTL and tags via context.cache, and best-effort side effects like Resend email never fail the main request. - Use Case: When adding a new /api/newsletter-signup endpoint, apply this Skill to get correct file placement, body validation, env checks, and JSON error responses without reinventing the pattern. ## Quick Start Ask the AI to add a new API endpoint under src/pages/api/ following the server conventions, for example a POST endpoint that validates a request body and returns a JSON ok response.