api-and-interface-design

Guides design of stable REST APIs, TypeScript contracts, and idempotent endpoints.

Updated May 5, 2026
One-click install
npx skills add https://github.com/nikegeorgian-stack/otgruzka-tovara --skill api-and-interface-design-nikegeorgian-stack
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/nikegeorgian-stack/otgruzka-tovara/tree/main/.cursor/skills/api-and-interface-design
Command: npx skills add https://github.com/nikegeorgian-stack/otgruzka-tovara --skill api-and-interface-design-nikegeorgian-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly designed interfaces create breaking changes, inconsistent error handling, and duplicate side effects that erode consumer trust. This Skill provides concrete principles and patterns for designing APIs and module boundaries that are hard to misuse and safe to evolve. ## Core Features & Use Cases - Contract-First Design: Define typed input/output schemas, discriminated unions, and branded ID types before implementation. - Consistent Error Semantics: Standardize error response shapes, HTTP status code mapping, and boundary-only validation. - Idempotency Implementation: Correctly honour Idempotency-Key headers with atomic claims, payload guards, and retention policies. - Use Case: When adding a new payments endpoint to a REST API, use this Skill to design the endpoint contract, pagination, error format, and idempotency handling so retries never double-charge customers. ## Quick Start Ask the AI to review or design a new REST endpoint for creating orders, including its TypeScript contract, error format, and idempotency key handling.

Frequently Asked Questions about api-and-interface-design

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

FAQPage Schema
How do I design a REST API that won't break existing consumers?▼

Define the contract first with typed input and output schemas, then extend interfaces only by adding optional fields. Never change existing field types or remove fields, and follow consistent naming conventions like plural nouns for endpoints and camelCase for fields.

How to implement idempotency keys for payment or order APIs?▼

Accept an Idempotency-Key header derived from an immutable identifier, then claim it atomically using a database unique constraint rather than a check-then-insert. Guard the payload hash so a reused key with a different body fails loudly, and set retention longer than the longest retry path.

Where should input validation happen in an API?▼

Validation belongs at system boundaries: API route handlers, form submissions, environment variable loading, and third-party API responses. Internal functions that share type contracts should trust already-validated data instead of re-validating.

Should I use PUT or PATCH for updating resources?▼

Use PATCH for partial updates where only provided fields change, which is what clients actually need. PUT requires sending the full object every time and increases the risk of accidentally overwriting fields.

What are common API design mistakes to avoid?▼

Common mistakes include inconsistent error formats across endpoints, verbs in REST URLs, list endpoints without pagination, and trusting third-party API responses without validation. Also avoid accepting idempotency keys without atomically storing and honouring them.