haskell-servant

Define and compose type-safe REST APIs in Haskell using Servant's NamedRoutes pattern.

1|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/birdgg/haskell-claude --skill haskell-servant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: haskell-servant
Source: https://github.com/birdgg/haskell-claude/tree/main/skills/haskell-servant
Command: npx skills add https://github.com/birdgg/haskell-claude --skill haskell-servant

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building scalable, type-safe REST APIs in Haskell with Servant can be verbose and error-prone; NamedRoutes patterns reduce boilerplate and enforce a consistent structure across resources.

Core Features & Use Cases

  • Enforces NamedRoutes records per resource, with Generic derivation for API composition
  • Supports nested routing, per-resource handlers, and service-layer separation
  • Includes authentication, error handling, and OpenAPI documentation integration
  • Use Case: Design multi-resource APIs (e.g., User, Product) with consistent routes and handlers

Quick Start

Define your API with NamedRoutes records, implement handlers mirroring those records, and wire them into a Servant application.

Frequently Asked Questions about haskell-servant

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

FAQPage Schema
How do I structure multi-resource REST APIs in Haskell without boilerplate?

Use Servant's NamedRoutes pattern to define per-resource route records with Generic derivation, reducing boilerplate and enforcing consistent API composition across multiple resources. This approach provides type-safe routing and maintainable handler wiring for scalable Haskell web services.

What is the NamedRoutes pattern in Servant and when do I need it?

NamedRoutes is a Servant pattern that uses Generic derivation to compose type-safe REST APIs into structured per-resource records. You need it when building scalable Haskell web services where reducing API definition boilerplate and maintaining consistent routing across multiple resources is required.

How do I wire handlers and nested routes for multiple resources in Servant?

Wire handlers by mirroring your NamedRoutes records with per-resource handler implementations, enabling nested routing composition. This separates service-layer logic from routing definitions, creating maintainable type-safe REST endpoints across resources like User or Product.

Does Servant NamedRoutes support authentication and OpenAPI documentation integration?

Yes, the NamedRoutes pattern supports integration points for authentication, error handling, and OpenAPI documentation. These features are incorporated directly into the type-safe API definition, ensuring consistent security and documentation across all composed resources.

Can I use this NamedRoutes approach for large-scale Haskell web services?

Yes, NamedRoutes is designed for scalable, type-safe REST APIs in Haskell. By enforcing Generic derivation and per-resource route records, it manages API complexity and maintains a consistent structure suitable for large-scale, multi-resource web services.

What's the best way to organize Haskell Servant endpoints for maintainability?

Organize endpoints using per-resource NamedRoutes records with Generic derivation to separate routing from service-layer handlers. This structured composition enforces consistency and type-safety across resources, ensuring the Haskell API remains maintainable as it scales.