dev-api-design

Defines REST and tRPC API design standards including error responses, versioning, and requestId propagation.

3|3|Updated Apr 23, 2026
One-click install
npx skills add https://github.com/joaoguirunas/team-os --skill dev-api-design-joaoguirunas
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dev-api-design
Source: https://github.com/joaoguirunas/team-os/tree/main/.claude/skills/dev-api-design
Command: npx skills add https://github.com/joaoguirunas/team-os --skill dev-api-design-joaoguirunas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Inconsistent API design across endpoints leads to confusing contracts, leaked internals in error responses, and untraceable requests. This Skill provides a single set of conventions for REST naming, response envelopes, error codes, versioning, and request tracing. ## Core Features & Use Cases - REST conventions: Standard CRUD route naming, non-CRUD action patterns, plural resources, and a maximum of two nesting levels. - Standardized responses: Success, paginated list, and error envelopes with mandatory requestId on every response for end-to-end tracing. - HTTP status and error code mapping: A fixed table mapping 400/401/403/404/409/429/500 to codes like VALIDATION_ERROR and RATE_LIMITED. - tRPC guidance: Router patterns with zod input validation for TypeScript full-stack projects, plus criteria for choosing tRPC vs REST. - Versioning and contracts: URL path versioning rules, Sunset headers, and a required docs/api/{resource}.md contract template. - Use Case: When adding a new payments endpoint, apply the naming rules, return the standard error envelope with requestId, document the contract in docs/api/payments.md, and bump the API version if the change is breaking. ## Quick Start Design a REST API for a users resource following the dev-api-design conventions, including the standard error response format and requestId middleware.

Frequently Asked Questions about dev-api-design

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

FAQPage Schema
How do I design REST API endpoints with standard naming conventions?▼

Use plural resource names like /users with GET for list and fetch, POST to create, PUT for full replacement, PATCH for partial updates, and DELETE to remove. Non-CRUD actions use POST with an explicit verb such as /users/:id/deactivate, and nesting is limited to two levels.

What is the standard format for API error responses?▼

Return an error object with a machine-readable code like VALIDATION_ERROR, a human-readable message, optional field-level details, and a requestId. Never expose stack traces, database messages, or internal logic in error responses.

When should I use tRPC instead of REST?▼

Use tRPC for Next.js plus TypeScript projects where end-to-end type safety matters, defining routers with zod-validated inputs. Use REST when building a public API for third parties or when multiple languages consume the API.

How do I version a REST API when making breaking changes?▼

Use URL path versioning such as /api/v1/users moving to /api/v2/users, and bump the version only on breaking changes. Keep the previous version running for at least three months and send a Sunset header on the deprecated version.

Why should every API response include a requestId?▼

A requestId generated in entry middleware and returned on every success and error response lets you trace requests end-to-end across logs and downstream services. Propagate the same requestId to log entries for correlation.

Should API resource IDs be sequential integers?▼

No, use opaque IDs like usr_abc123 instead of sequential integers such as 123. Opaque IDs avoid leaking record counts and prevent trivial enumeration of resources.