api-and-interface-design

Designs stable REST, GraphQL, and TypeScript interfaces with consistent contracts and error semantics.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly designed APIs and module boundaries create breaking changes, inconsistent error handling, and hidden dependencies on undocumented behavior that break consumers. This Skill provides a structured methodology for designing interfaces that are hard to misuse and safe to evolve. ## Core Features & Use Cases - Contract-First Design: Define typed interfaces, input/output schemas, and discriminated unions before implementation. - Consistent Error Semantics: Standardize error shapes, HTTP status code mapping, and boundary-only validation across all endpoints. - Idempotency Implementation: Correctly honor Idempotency-Key headers with atomic claims, payload guards, and retention policies. - Use Case: When building a new REST endpoint for task management, apply this Skill to define the TaskAPI contract, paginated list responses, PATCH semantics, and idempotent create operations before writing any handler code. ## Quick Start Use the api-and-interface-design skill to review my planned REST endpoints for the tasks service and define the TypeScript contracts before I implement them.

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 schemas, prefer adding optional fields over modifying existing ones, and follow the One-Version Rule by extending rather than forking. Paginate list endpoints from the start and use consistent naming conventions across all endpoints.

How to implement idempotency keys correctly in an API?▼

Derive the key from the client or an immutable identifier, never from a per-attempt UUID or timestamp. Claim it atomically with a unique constraint insert, reject the same key with a different payload, and set retention longer than the longest retry path including dead-letter replay.

Where should input validation happen in an API?▼

Validation belongs at system boundaries: route handlers, form submissions, external service responses, and environment configuration. Internal functions sharing type contracts should trust already-validated data rather than re-validating.

Should I use PATCH or PUT for API updates?▼

Use PATCH for partial updates where only provided fields change, which is what clients actually want. PUT requires sending the full object every time and is appropriate only for complete resource replacement.

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 somebody, regardless of the documented contract. This means every public behavior is a commitment, so avoid leaking implementation details and plan deprecation at design time.