typespec-rest

Design REST APIs with TypeSpec HTTP decorators for routes, parameters, and authentication.

1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/hafley66/claude-research --skill typespec-rest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typespec-rest
Source: https://github.com/hafley66/claude-research/tree/main/skills/typespec-rest
Command: npx skills add https://github.com/hafley66/claude-research --skill typespec-rest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design REST APIs with TypeSpec HTTP library, covering routes, operations, responses, authentication, and versioning.

Core Features & Use Cases

  • Define REST endpoints with @route, @get, @post, @patch, @delete
  • Handle request bodies with @body
  • Path/query/header parameters with @path, @query, @header
  • Authentication with @auth, OAuth2, API key schemes
  • API versioning with @versioned
  • Error responses with union types and status codes
  • Custom response models and pagination

Quick Start

Design a REST API for a sample resource using TypeSpec HTTP decorators to define routes, methods, and authentication.

Frequently Asked Questions about typespec-rest

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

FAQPage Schema
Does TypeSpec work for generating OpenAPI contracts from HTTP decorators?

TypeSpec works for generating OpenAPI contracts by codifying HTTP requirements into explicit decorators and models. This approach enables predictable OpenAPI generation and validated API contracts for REST endpoints.

How do I define REST API routes and HTTP methods using TypeSpec?

REST API routes and HTTP methods are defined in TypeSpec using explicit decorators like @route, @get, @post, @patch, and @delete. This approach codifies endpoint requirements into models, enabling predictable OpenAPI generation and validated API contracts.

Can I handle API authentication and versioning in TypeSpec?

API authentication and versioning are handled in TypeSpec using @auth decorator with OAuth2 or API key schemes, and @versioned decorator. This ensures consistent security and version control across generated API contracts.

How do I manage path, query, and header parameters when designing a REST API?

Path, query, and header parameters are managed in REST API design using @path, @query, and @header decorators. These explicitly bind parameters to models, ensuring accurate request mapping and validated OpenAPI contracts.

What is the best way to define error responses and pagination in a REST API?

Error responses and pagination in a REST API are best defined using union types with status codes for errors and custom response models for pagination. This codifies error handling explicitly, enabling predictable OpenAPI generation.

Does TypeSpec work for generating OpenAPI contracts from HTTP decorators?

TypeSpec works for generating OpenAPI contracts by codifying HTTP requirements into explicit decorators and models. This approach enables predictable OpenAPI generation and validated API contracts for REST endpoints.