api-designer
Comprehensive guide to designing type-safe APIs with TypeScript. Covers type-safe contracts, validation with Zod, Result types for error handling, SvelteKit endpoints, middleware patterns, and API versioning.
npx skills add majiayu000/claude-skill-registry --skill api-designer-jasonwarrenuk-goblin-mode --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides the agent to help design type-safe APIs in TypeScript, covering type-safe contracts, Zod validation, Result types for error handling, SvelteKit endpoints, middleware patterns, and API versioning.
How it works
- Defines request/response types and an ApiError shape to standardize communication.
- Demonstrates a Result<T, E> type for representing success and failure in business logic.
- Provides ApiResponse, ApiSuccess, and ApiError interfaces to format API responses.
- Maps endpoints in an ApiEndpoints interface to centralize route contracts.
- Shows Zod-based schemas (CreateUserSchema, UpdateUserSchema) and how to infer TypeScript types from schemas.
- Includes complex validation examples, custom validation rules, and nested schemas; demonstrates schema composition for base/create/update variants.
- Outlines error handling patterns using Result Types for expected failures and ApiError classes for unexpected failures, plus a centralized handleApiError example.
- Details SvelteKit API routes (GET, POST with validation, dynamic routes) and how to integrate validation and error handling.
- Describes reusable middleware patterns: authentication, validation, rate limiting, and composing middleware.
- Presents session management patterns: cookies-based sessions, JWT-based stateless tokens, and Supabase-auth workflow.
- Provides typed wrappers around database calls, emphasizing a polyglot persistence approach over a single ORM.
When to use it
Use this skill when:
- Designing API endpoints
- Creating type-safe API contracts
- Implementing validation
- Handling API errors
- Building SvelteKit API routes
- Creating reusable middleware
- Versioning APIs
- Questions about API design patterns
--- name: api-designer description: Type-safe API design: Zod validation, Result types, SvelteKit endpoints, middleware patterns. user-invocable: false effort: medium paths: - "**/routes/**" - "**/api/**" allowed-tools: - Read - Glob - Grep --- # TypeScript API Design Comprehensive guide to designing type-safe APIs with TypeScript. Covers type-safe contracts, validation with Zod, Result types for error handling, SvelteKit endpoints, middleware patterns, and API versioning. --- ## When This Skill Applies Use this skill when: - Designing API endpoints - Creating type-safe API contracts - Implementing validation - Handling API errors - Building SvelteKit API routes - Creating reusable middleware - Versioning APIs - Questions about API design patterns --- ## Type-Safe Contracts ### Request/Response Types ```typescript // types/api.ts export interface CreateUserRequest { email: string; name: string; password: string; } export interface User { id: string; email: string; name: string; createdAt: string; } export interface ApiError { code: string; message: string; details?: Record<string, string[]>; } ``` **Key principle**: Types ARE documentation. Well-named types with clear structure tel
- When This Skill Applies
- Type-Safe Contracts
- Request/Response Types
- Result Type Pattern
- API Response Format
- Endpoint Type Map
- Validation with Zod
- Why Zod
- Basic Schema
- Complex Validation
- Custom Validation Rules
- Nested Schemas
- Schema Composition
- Error Handling Patterns
npm install zod-openapi @asteasolutions/zod-to-openapi
What does the api-designer skill do?
Comprehensive guide to designing type-safe APIs with TypeScript. Covers type-safe contracts, validation with Zod, Result types for error handling, SvelteKit endpoints, middleware patterns, and API versioning.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-designer-jasonwarrenuk-goblin-mode --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
