functional-elixirlisted
Install: claude install-skill yutna/functional-design-skills
# Functional Elixir
## Overview
Elixir gives immutability, pattern matching, and pipelines by default, so
much of this pack is already the idiom. What it does not give is a
compiler that rejects an illegal state, so the enforcement lives in
structs with enforced keys, constructor functions, and Dialyzer.
It also gives processes, which are the only thing in the language that
holds state over time. Deciding what is a process is therefore the same
decision as deciding what is mutable, and it is a design question rather
than a performance one.
This pack covers the language and OTP. Phoenix, Ecto and LiveView are in
[functional-elixir-phoenix](../functional-elixir-phoenix/SKILL.md).
## When to use
- An Elixir project, with or without a web framework
- Designing a struct, a tagged tuple, or a constructor
- Composing a pipeline that can fail
- Deciding whether something should be a process, and what supervises it
- Reviewing Elixir against the core design rules
Not for: Erlang runtime tuning, release configuration, or Phoenix.
## Notation mapping
| Neutral notation | Elixir |
| ------------------- | ------------------------------------- |
| Record type | `defstruct` with `@enforce_keys` |
| Choice type | Tagged tuple, or a struct per case |
| Single-case wrapper | A struct with one field, plus `new/1` |
| `Result<T, E>` | `{:ok, term}` or `{:error, term}` |
| `Option<T>` | `{:ok, term}` or `:error`,