atelier-typescript-functional-patterns

Model TypeScript domain logic with ADTs, Option/Result, and branded types.

39|4|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/martinffx/claude-code-atelier --skill atelier-typescript-functional-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: atelier-typescript-functional-patterns
Source: https://github.com/martinffx/claude-code-atelier/tree/main/plugins/atelier-typescript/skills/atelier-typescript-functional-patterns
Command: npx skills add https://github.com/martinffx/claude-code-atelier --skill atelier-typescript-functional-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Functional programming patterns help teams encode business rules and state with TypeScript types, reducing runtime errors by making illegal states unrepresentable and guiding safer code through algebraic data types, discriminated unions, and branded types.

Core Features & Use Cases

  • Discriminated unions for exhaustive state modeling
  • Option and Result types for explicit error handling
  • Branded types for domain-safe identifiers and units
  • Comprehensive references and migration guidance for adoption
  • Real-world patterns and examples for building reliable domain models

Quick Start

Install a TypeScript project and start applying ADTs, Option/Result, and branded types to build safe, expressive domain models.

Frequently Asked Questions about atelier-typescript-functional-patterns

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

FAQPage Schema
How do I use discriminated unions in TypeScript to make illegal states unrepresentable?

Discriminated unions in TypeScript model domain states exhaustively, making illegal states unrepresentable by enforcing type-safe pattern matching and preventing invalid runtime state transitions.

What is the best way to handle errors in TypeScript without throwing exceptions?

Option and Result types provide explicit error handling in TypeScript, forcing the caller to acknowledge potential failure cases safely without relying on runtime exceptions.

How do I implement branded types for domain-safe identifiers in TypeScript?

Branded types in TypeScript tag primitive values like strings or numbers at the type level, ensuring domain-safe identifiers and units are structurally distinct and preventing invalid assignments across your codebase.

Can I use functional programming patterns to model state machines in TypeScript projects?

Yes, functional programming patterns support modeling state machines in TypeScript projects of varying sizes by using algebraic data types and smart constructors to enforce clear separation of concerns.

When should I use algebraic data types over standard TypeScript interfaces?

Use algebraic data types instead of standard interfaces when you need exhaustive pattern matching and strict domain modeling to encode business rules directly into the type system.