api-and-interface-design

Guide API and interface design with REST and TypeScript patterns.

14|2|Updated Jul 4, 2026
One-click install
npx skills add https://github.com/Krishnatejavepa/Shotgun --skill api-and-interface-design-krishnatejavepa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-and-interface-design
Source: https://github.com/Krishnatejavepa/Shotgun/tree/main/.shotgun/skills/api-and-interface-design
Command: npx skills add https://github.com/Krishnatejavepa/Shotgun --skill api-and-interface-design-krishnatejavepa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill guides the design of stable, well-documented interfaces for APIs and modules, ensuring that the right thing is easy and the wrong thing hard.

Core Features & Use Cases

  • Hyrum's Law: Encourages intentional design to avoid unintended dependencies on public behaviors.
  • One-Version Rule: Avoids diamond dependency problems by designing for a single version of dependencies.
  • Contract First: Defines the interface before implementing it to ensure a clear spec.
  • Consistent Error Semantics: Picks one error strategy and uses it everywhere for predictability.
  • Validate at Boundaries: Trusts internal code and validates at system edges where external input enters.
  • Prefer Addition Over Modification: Extends interfaces without breaking existing consumers.
  • Predictable Naming: Provides naming conventions for REST endpoints, query params, response fields, boolean fields, and enum values.
  • REST API Patterns: Offers guidelines for resource design, pagination, filtering, and partial updates.
  • TypeScript Interface Patterns: Recommends using Discriminated Unions, Input/Output Separation, and Branded Types for IDs.
  • Common Rationalizations: Addresses common misunderstandings about API design.
  • Red Flags: Lists potential issues in API design to avoid.
  • Verification: Provides a checklist for verifying API design.

Quick Start

To begin designing an API, use the 'api-and-interface-design' skill and follow the guidelines for Hyrum's Law, the One-Version Rule, and Contract First principles.

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 when modified?

To prevent breaking REST API consumers, design interfaces by preferring addition over modification. This approach extends API endpoints without altering existing public behaviors, ensuring backward compatibility.

What TypeScript interface patterns should I use for strict API boundaries?

For strict TypeScript interface design, use Discriminated Unions, Input/Output Separation, and Branded Types for IDs. These patterns enforce predictable module boundaries and validate external input effectively.

How does Hyrum's Law affect public API design?

Hyrum's Law affects API design by warning that when an interface has enough consumers, all observable behaviors will be depended upon by someone. It encourages intentional design to avoid unintended public dependencies.

What is the best way to handle error semantics consistently across an API?

The best way to handle error semantics is to pick one consistent error strategy and apply it everywhere. Consistent error semantics provide predictability for API consumers across all module boundaries.

When do I need to validate inputs at system boundaries?

You need to validate inputs at system boundaries where external data enters your module. Trusting internal code while validating at the edges prevents invalid data from propagating through your API.

How do I avoid diamond dependency problems in API design?

To avoid diamond dependency problems in API design, apply the One-Version Rule. This principle designs interfaces for a single version of dependencies, preventing conflicts when different modules require varying versions.