api-and-interface-design

Guides design of stable REST APIs, TypeScript contracts, and module boundaries.

Updated May 13, 2026
One-click install
npx skills add https://github.com/sapatamuku-creator/mastersapatamuku --skill api-and-interface-design-sapatamuku-creator
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/sapatamuku-creator/mastersapatamuku/tree/main/releases/v2.7/.agents/skills/api-and-interface-design
Command: npx skills add https://github.com/sapatamuku-creator/mastersapatamuku --skill api-and-interface-design-sapatamuku-creator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly designed interfaces create breaking changes, inconsistent error handling, and hidden dependencies that break consumers. This Skill provides concrete principles and patterns for designing APIs and module contracts that are stable, predictable, and hard to misuse. ## Core Features & Use Cases - Contract-First Design: Define TypeScript interfaces and schemas before implementation, with input/output separation and branded ID types. - REST API Patterns: Standard conventions for resource naming, pagination, filtering, partial updates (PATCH), and consistent error response shapes. - Boundary Validation: Guidance on validating external input at system edges, including treating third-party API responses as untrusted data. - Use Case: When creating a new REST endpoint for a task management feature, apply the naming conventions, pagination structure, and error format from this Skill so consumers get a predictable, backward-compatible API. ## Quick Start Ask the AI to design a REST API for a new resource using the api-and-interface-design skill, including typed contracts, error semantics, and pagination.

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?▼

Prefer addition over modification: add new fields as optional and never change or remove existing field types. Use PATCH for partial updates, version only when unavoidable, and treat every observable behavior as a commitment under Hyrum's Law.

What is the best way to structure API error responses?▼

Pick one error strategy and use it everywhere. A common pattern maps HTTP status codes (400, 401, 403, 404, 409, 422, 500) to a structured body with a machine-readable code, human-readable message, and optional details field.

Where should input validation happen in an application?▼

Validate at system boundaries where external input enters: API route handlers, form submissions, environment variables, and third-party API responses. Internal functions that share type contracts should trust already-validated data instead of re-validating.

Should third-party API responses be validated before use?▼

Yes, third-party API responses are untrusted data and must be validated before use in logic, rendering, or decisions. A compromised or misbehaving external service can return unexpected types, malicious content, or instruction-like text.

When should I use discriminated unions in TypeScript interfaces?▼

Use discriminated unions when a value has distinct variants with different fields, such as task statuses. A shared discriminator field like 'type' enables compiler-checked narrowing in switch statements, making invalid states unrepresentable.