api-and-interface-design

Design stable REST/GraphQL API contracts with version-safe TypeScript and Python types.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/jankneumann/agentic-assistant --skill api-and-interface-design-jankneumann
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/jankneumann/agentic-assistant/tree/main/.agents/skills/api-and-interface-design
Command: npx skills add https://github.com/jankneumann/agentic-assistant --skill api-and-interface-design-jankneumann

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents breaking consumers and reduces ambiguity by guiding how to design API and interface contracts that remain consistent over time, with predictable errors, validation boundaries, and version-safe evolution.

Core Features & Use Cases

  • Hyrum’s Law-aware contract design: Treats observable behaviors (errors, ordering, timing) as commitments and designs for intentional exposure and deprecation.
  • Contract-first, type-driven interfaces: Specifies interfaces before implementation using TypeScript interfaces/protocol-style patterns in Python.
  • Consistent REST semantics and PATCH rules: Covers pagination, filtering, PATCH partial updates, and idempotent delete patterns to maintain predictable client expectations.
  • Robust validation at boundaries: Ensures request and external-service responses are validated at system edges (e.g., Pydantic/FastAPI) so internal code can trust typed inputs.
  • Type-system patterns for correctness: Uses discriminated unions, branded/nominal ID types, and immutable value objects to prevent category errors and misuse.

Quick Start

Use the api-and-interface-design skill to design a new REST endpoint by defining the request/response contracts, choosing consistent error semantics, and specifying how pagination and PATCH partial updates should behave for your resource.

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 REST API contracts that stay stable and avoid breaking existing consumers?

To design stable REST API contracts, apply version-safe additive changes, boundary-only validation, and consistent error semantics so observable behaviors remain predictable for long-lived consumer compatibility. Treat Hyrum’s Law as a constraint by intentionally exposing and deprecating behaviors.

What's the best way to handle API validation boundaries using Pydantic and FastAPI?

The best way to handle API validation boundaries is to validate requests and external-service responses at system edges using Pydantic and FastAPI, ensuring internal code can fully trust typed inputs. This prevents unvalidated data from propagating through your system logic.

How does Hyrum's Law affect interface design and public API evolution?

Hyrum’s Law affects interface design by treating observable behaviors like error timing, ordering, and responses as implicit commitments that constrain public API evolution. You must design for intentional exposure and deprecation to safely evolve interfaces without breaking consumer implementations.

Can I use TypeScript discriminated unions and branded types for frontend-backend interface contracts?

Yes, you can use TypeScript discriminated unions and branded nominal ID types to enforce type-system correctness and prevent category errors in frontend-backend interface contracts. These patterns create immutable value objects that make APIs hard to misuse at compile time.

How do I implement consistent PATCH partial updates and idempotent delete patterns in REST?

To implement consistent PATCH partial updates and idempotent delete patterns in REST, define clear contract-first typing rules for partial resource modifications and ensure predictable client expectations across pagination and filtering operations. This maintains semantic consistency across your API surface.

When do I need contract-first typing for Python module boundaries?

You need contract-first typing for Python module boundaries when specifying protocol-style interfaces before implementation to ensure safe evolution of existing public interfaces between internal modules. This approach reduces ambiguity and prevents breaking changes when modules are updated independently.