api-and-interface-design

Enforce contract-first design for REST and GraphQL APIs.

Updated May 18, 2026
One-click install
npx skills add https://github.com/lucasloutayf/barberia-evolution --skill api-and-interface-design-lucasloutayf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/lucasloutayf/barberia-evolution/tree/main/.agents/skills/api-and-interface-design
Command: npx skills add https://github.com/lucasloutayf/barberia-evolution --skill api-and-interface-design-lucasloutayf

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design stable, well-documented interfaces that are hard to misuse. Good interfaces make the right thing easy and the wrong thing hard. This applies to REST APIs, GraphQL schemas, module boundaries, component props, and any surface where one piece of code talks to another.

Core Features & Use Cases

  • Contract First: Define the interface before implementing it. The contract is the spec — implementation follows.
  • Consistent Error Semantics: Choose one error strategy and apply it uniformly across endpoints.
  • Validate at Boundaries: Validate external input at API boundaries to prevent internal assumptions from breaking.
  • Prefer Addition Over Modification: Extend interfaces with new optional fields rather than changing existing ones.
  • REST Patterns and Naming: Follow standard REST/GraphQL patterns and consistent naming conventions.

Quick Start

Define the contract first for a new API surface, then implement with consistent error handling and boundary validation.

Frequently Asked Questions about api-and-interface-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is contract-first API design and when should I use it?

Contract-first API design means defining the interface specification before implementation. Use it for REST, GraphQL, or module boundaries to enforce stable data sharing and prevent fragile integrations between frontend and backend teams.

How do I design REST APIs that are hard to misuse?

To design hard-to-misuse REST APIs, enforce consistent error semantics, validate external input at boundaries, and use clear naming conventions. Extend interfaces with new optional fields rather than modifying existing ones to avoid breaking consumers.

What's the best way to handle API error handling consistently across endpoints?

The best way to handle API error handling consistently is to choose one error strategy and apply it uniformly across all endpoints. This prevents confusion and ensures predictable behavior across REST, GraphQL, and module boundaries.

How do I validate external input at API boundaries without breaking internal logic?

Validate external input at API boundaries to prevent internal assumptions from breaking. This contract-first approach ensures external data conforms to the interface spec before reaching internal module logic or downstream processing.

Does contract-first design work for both REST and GraphQL interfaces?

Yes, contract-first design works for REST and GraphQL interfaces, as well as any public boundary where teams share data or components. It enforces additive changes, consistent naming, and boundary validation across endpoints.

Why should I prefer addition over modification when changing module contracts?

Prefer addition over modification when changing module contracts to avoid breaking existing consumers. Extending interfaces with new optional fields maintains backward compatibility while allowing the API surface to grow safely.