What problem does it solve? Domain logic often mixes side effects, exceptions, and mutable state, making code hard to test and reason about. This Skill enforces a functional discipline where decisions happen in pure code, expected failures are typed values, and side effects live only at adapter boundaries. ## Core Features & Use Cases - Errors as Values: Standardizes a Result<T, E> type with ok/err/map/flatMap helpers so expected failures are typed return values instead of hidden exceptions. - Functional Core / Imperative Shell: Keeps domain decisions pure while adapters handle I/O, time, and randomness through injected ports like ClockPort and IdPort. - Discriminated Unions and Immutability: Models state machines as discriminated unions with exhaustive switches, bans null in domain code, and defaults to readonly data structures. - Use Case: When implementing a checkout flow, you write a pure function returning Result<OrderConfirmation, CheckoutError> with injected payment and clock ports, making it fully testable without mocks. ## Quick Start Ask the agent to refactor the checkout function so expected failures return Result types and side effects move to injected ports.