api-design

Design RESTful APIs and TypeScript interfaces with structured contracts.

27.1k|2.6k|Updated Aug 6, 2024
One-click install
npx skills add https://github.com/mastra-ai/mastra --skill api-design-mastra-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design
Source: https://github.com/mastra-ai/mastra/tree/main/examples/unified-workspace/skills/api-design
Command: npx skills add https://github.com/mastra-ai/mastra --skill api-design-mastra-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teams building APIs often struggle with consistency, discoverability, and maintainability across endpoints and data contracts, leading to integration bugs and slowed development.

Core Features & Use Cases

  • REST endpoint design: guidelines for resource-oriented URLs and meaningful HTTP methods.
  • TypeScript interface patterns: modeling domain entities with clear, stable types and discriminated unions.
  • Versioning and docs: strategies for API versioning, deprecation, and contract documentation.
  • Security and reliability: recommendations for response schemas, error handling, and input validation.
  • Use Case: Refactor a monolithic set of endpoints into modular resources with typed request/response shapes.

Quick Start

Design the API for a new resource, define TS interfaces for key entities, and draft a minimal OpenAPI contract following the guidelines.

Frequently Asked Questions about api-design

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

FAQPage Schema
What's the best way to design RESTful API endpoints and TypeScript interfaces?

RESTful API design involves creating resource-oriented URLs, using meaningful HTTP methods, and modeling domain entities with clear TypeScript types like discriminated unions. This ensures scalable, well-structured data contracts and consistent endpoint structures across your application.

How do I model TypeScript interfaces for API request and response schemas?

TypeScript interface modeling for API schemas requires defining clear, stable types for domain entities. You should use discriminated unions for complex data shapes and establish consistent response schemas to enforce contract stability and prevent integration bugs.

What strategies should I use for API versioning and deprecation?

API versioning strategies manage contract evolution by applying consistent URL structures and clear documentation practices. Proper versioning and deprecation guidelines help maintain discoverability and reliability across endpoints while preventing broken integrations during updates.

How do I refactor a monolithic set of API endpoints into modular resources?

Refactoring monolithic API endpoints into modular resources requires grouping operations around resource-oriented URLs. You define typed request and response shapes using TypeScript interfaces and apply meaningful, idempotent HTTP methods to structure the endpoints cleanly.

Can I use standard development environments for API contract documentation without external tools?

Yes, you can design REST APIs and TypeScript interfaces using standard development environments without external tools. The process emphasizes consistent URL structures, idempotent methods, and clear response schemas to draft minimal OpenAPI contracts directly.