typescript-functional-patterns
Installation
SKILL.md
Functional Patterns for Reliable TypeScript
Inspect the owning package and existing implementation first. Reuse established project types, helpers, errors, lifecycle behavior, and test utilities. The patterns below are options, not an implementation checklist. Introduce one only when the current task requires it.
Project-specific rules
- Remove paste-ready implementations of Result, Option, brands, and error helpers.
- Reuse types supplied by installed libraries and the existing codebase.
- Introduce a branded type only for a new invariant that is otherwise unsafe.
- Do not create another branded ID or parser when a canonical one exists.
Build reliable systems using Algebraic Data Types (ADTs), discriminated unions, Result/Option types, and branded types. These patterns enable the compiler to prove correctness, prevent runtime errors, and make illegal states unrepresentable.
Why Functional Patterns?
Reliability through types: Use the type system to encode business rules, making invalid states impossible to construct. The compiler becomes your safety net, catching errors at build time rather than runtime.