api-patterns

Guides API design decisions across REST, GraphQL, and tRPC with validation scripts.

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill api-patterns-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-patterns
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/.agent/skills/api-patterns
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill api-patterns-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Choosing the wrong API style or shipping inconsistent endpoints leads to costly rewrites and integration friction. This Skill provides decision frameworks for selecting between REST, GraphQL, and tRPC, plus concrete rules for response formats, versioning, authentication, and rate limiting. ## Core Features & Use Cases - API Style Selection: Decision trees comparing REST, GraphQL, and tRPC based on consumers, type safety, and caching needs. - Design References: In-depth guides covering resource naming, HTTP status codes, pagination strategies, JWT/OAuth/Passkey auth, and OWASP API Top 10 security testing. - Automated Validation: A Python script that scans API code and OpenAPI specs for missing error handling, status codes, validation, and rate limiting. - Use Case: When designing a new public API for a TypeScript monorepo, consult the decision tree to pick tRPC, then run the validator script against your endpoints before deployment. ## Quick Start Ask the AI to help design a REST API for a user management service, including response format, versioning, and authentication strategy.

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?

Choose REST for public APIs needing wide compatibility, GraphQL for complex interconnected data with multiple frontends, and tRPC for TypeScript monorepos needing end-to-end type safety. The decision depends on your API consumers, caching needs, and whether both ends use TypeScript.

What HTTP status codes should a REST API return?

Use 200 for successful reads, 201 for created resources, 204 for success with no content, 400 for malformed requests, 401 for missing auth, 403 for insufficient permissions, 404 for missing resources, 409 for conflicts, 422 for validation errors, and 429 for rate limiting.

When should I use cursor pagination instead of offset pagination?

Use cursor pagination for large datasets where offset performance degrades, and keyset pagination when performance is critical and you have a sortable key. Offset pagination works for small datasets where users need to jump to specific pages.

Does tRPC work with non-TypeScript clients?

No, tRPC requires TypeScript on both frontend and backend to deliver end-to-end type inference. For non-TypeScript clients or public APIs, use REST with OpenAPI or GraphQL instead.

How do I test my API against OWASP API Security Top 10?

Test for BOLA by replaying requests with different user sessions, check JWT algorithm confusion and weak secrets, verify rate limiting exists and resists header-based bypasses, and disable GraphQL introspection in production. The security-testing reference covers each vulnerability category.