api-and-interface-design

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

2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/MoofonLi/dev-ready --skill api-and-interface-design-moofonli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/MoofonLi/dev-ready/tree/main/src/dev_ready/templates/claude/skills/api-and-interface-design
Command: npx skills add https://github.com/MoofonLi/dev-ready --skill api-and-interface-design-moofonli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly designed APIs and interfaces create breaking changes, inconsistent error handling, and hidden dependencies that frustrate consumers and multiply maintenance cost. This Skill provides concrete principles and patterns for designing interfaces that are hard to misuse and safe to evolve. ## Core Features & Use Cases - Contract-First Design: Define typed input/output schemas before implementation, with consistent error semantics and boundary validation. - REST API Patterns: Covers resource naming, pagination, filtering, and partial updates (PATCH) with predictable conventions. - Idempotency Implementation: Detailed guidance on honouring idempotency keys, atomic claiming via unique constraints, payload guards, and retention windows. - Use Case: When adding a new payments endpoint to a FastAPI or Express backend, use this Skill to design the endpoint contract, error format, and idempotency behavior before writing any handler code. ## Quick Start Ask the agent to design a REST API contract for a new resource, including typed inputs, error responses, pagination, 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 follow the One-Version Rule by extending rather than forking the API.

How to implement idempotency keys for POST endpoints?

Accept a client-generated Idempotency-Key and claim it atomically with a unique database 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 including dead-letter replays.

Where should input validation happen in a web API?

Validate only at system boundaries: API route handlers, form submissions, external service responses, and environment configuration. Internal functions that share type contracts should trust already-validated data rather than re-validating.

Should I use PUT or PATCH 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.

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.