api-and-interface-design

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

1|Updated Jul 5, 2026
One-click install
npx skills add https://github.com/yersonargotev/packy --skill api-and-interface-design-yersonargotev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/yersonargotev/packy/tree/main/bundle/skills/api-and-interface-design
Command: npx skills add https://github.com/yersonargotev/packy --skill api-and-interface-design-yersonargotev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly designed interfaces create breaking changes, inconsistent error handling, and hidden dependencies on undocumented behavior that break consumers. This Skill provides concrete 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 interfaces before implementation, with consistent error semantics, boundary validation, and predictable naming conventions for REST endpoints and TypeScript types. - Idempotency Implementation: Detailed guidance on honoring Idempotency-Key headers, including atomic key claiming via unique constraints, payload guarding, in-flight duplicate handling, and retention planning. - Compatibility Patterns: Discriminated unions, branded ID types, input/output separation, additive-only changes, and pagination patterns that prevent breaking existing consumers. - Use Case: When designing a new REST endpoint for task management, apply the resource design, pagination, filtering, and PATCH partial-update patterns to produce a consistent, versionable API. ## Quick Start Ask the assistant to design a REST API for a new resource following the api-and-interface-design guidelines, including typed contracts, error format, and idempotency 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 inputs and outputs, then evolve it by adding optional fields only. Never change existing field types or remove fields, and paginate list endpoints from the start so clients are not broken later.

How to implement idempotency keys for POST endpoints?▼

Accept a client-generated Idempotency-Key and claim it atomically with a database unique constraint before performing the side effect. Reject the same key with a different payload, and set key retention longer than the longest possible retry path.

Should I use PATCH or PUT for updating resources?▼

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

Where should input validation happen in an API?▼

Validate only at system boundaries: 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.

What is Hyrum's Law and why does it matter for API design?▼

Hyrum's Law states that all observable behaviors of an API will be depended on by someone, regardless of the documented contract. It means every public behavior is a commitment, so avoid leaking implementation details and plan deprecation at design time.