api-patterns

Select REST, GraphQL, or tRPC for a project using decision criteria.

17|4|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/sawrus/agent-guides --skill api-patterns-sawrus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-patterns
Source: https://github.com/sawrus/agent-guides/tree/main/skills/api-patterns
Command: npx skills add https://github.com/sawrus/agent-guides --skill api-patterns-sawrus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

API design decisions are often ambiguous and context-dependent. This Skill provides structured guidance to choose between REST, GraphQL, and tRPC based on project needs.

Core Features & Use Cases

  • Decision framework for selecting REST, GraphQL, or tRPC based on data needs, teams, and deployment constraints.
  • Pattern guidance on versioning, pagination, error handling, and schema evolution.
  • Use Case: When starting a new API, determine the most appropriate style to maximize scalability and developer productivity.

Quick Start

  • Decide the API style for your project by answering a few questions: who are the clients, how complex is the data, and how important is caching; choose REST, GraphQL, or tRPC accordingly.

Frequently Asked Questions about api-patterns

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

FAQPage Schema
How do I choose between REST, GraphQL, and tRPC for my API design?

REST, GraphQL, and tRPC differ in data fetching flexibility and schema enforcement. REST uses fixed endpoints, GraphQL allows client-specified queries, and tRPC provides end-to-end type safety, making the best choice dependent on your specific scalability and productivity needs.

What is the best way to handle API versioning and pagination after selecting an architecture style?

The best way to handle API versioning and pagination is applying pattern guidance aligned with your chosen architecture. This framework provides practical guidelines for schema evolution, error handling, and pagination across REST, GraphQL, and tRPC implementations.

When should I use GraphQL instead of REST for a multi-platform backend?

Yes, you can use tRPC in a monorepo to maximize developer productivity through end-to-end type safety. It is particularly effective when frontend and backend share a TypeScript codebase, eliminating the need for separate schema generation.

What are the limitations of using tRPC compared to REST for API design?

A key limitation of tRPC compared to REST is its tight coupling to TypeScript environments, reducing interoperability with non-JS clients. REST provides universal compatibility and standardized HTTP caching, making it more suitable for public-facing APIs.