api-design

Design and review HTTP API contracts with OpenAPI and generated-client synchronization.

Updated Jun 15, 2026
One-click install
npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill api-design-ravenslight2010
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design
Source: https://github.com/ravenslight2010/Production-run-calculator/tree/main/.agents/skills/api-design
Command: npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill api-design-ravenslight2010

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding or changing an API endpoint risks breaking existing callers, drifting from the OpenAPI contract, or leaking sensitive error details. This Skill enforces consistent resource naming, status codes, validation, authorization, and keeps the OpenAPI spec, generated clients, and runtime implementation in lockstep. ## Core Features & Use Cases - Contract-first design: Guides resource naming, HTTP method semantics, status code selection, pagination, rate limits, and error envelope conventions aligned with the repository's existing Express API. - OpenAPI lockstep workflow: Ensures every contract change updates lib/api-spec/openapi.yaml, regenerates clients and validators, and passes pnpm run check:api-generated. - Review checklist: Verifies backward compatibility, authentication and capability scope, input validation, bounded payloads, and idempotency before shipping. - Use Case: When adding a new endpoint to the Express 5 API server, use this Skill to design the route, update the OpenAPI spec, regenerate the Zod schemas and React hooks, and confirm runtime behavior matches the documented contract. ## Quick Start Ask the AI to design a new API endpoint for the project following the api-design skill, including the OpenAPI update and generated client regeneration.

Frequently Asked Questions about api-design

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

FAQPage Schema
How do I add a new API endpoint without breaking existing clients?

Inspect nearby routes and the OpenAPI spec first, identify existing callers, and preserve compatibility unless a breaking change is explicitly approved. Update openapi.yaml, regenerate clients and validators, then run the contract checks before merging.

What HTTP status codes should a REST API return?

Use 200 for successful reads or updates, 201 for creation, 204 only with no body, 400 for invalid requests, 401/403 for auth failures, 404 for missing resources, 409 for conflicts, 429 for rate limits, and 500 or 503 for server-side failures.

How do I keep OpenAPI specs and generated code in sync?

Edit the OpenAPI source file, regenerate clients and validators with the repository's codegen commands, and never hand-edit generated files. Verify runtime validation matches the documented request and response, then run the generated-code check script.

What error response format should an Express API use?

Use the repository's top-level JSON envelope with a single safe error message field. Never expose stack traces, SQL messages, credentials, or raw provider responses, and update OpenAPI plus all generated consumers if the error shape changes.

When should an API use action endpoints instead of resources?

Use action endpoints only when the operation does not map cleanly to resource creation or mutation. Model resources with clear, consistent paths first, and match HTTP methods to actual safety and idempotency behavior.