← ClaudeAtlas

functional-elixir-phoenixlisted

Use when designing a Phoenix context, an Ecto schema or changeset, a LiveView's assigns, or deciding what belongs in the domain rather than in the web layer.
yutna/functional-design-skills · ★ 0 · AI & Automation · score 75
Install: claude install-skill yutna/functional-design-skills
# Functional Phoenix ## Overview Phoenix contributes a boundary that maps cleanly onto the core and shell split: contexts hold the domain, controllers and LiveViews hold the shell. Ecto contributes a parser at the edge that most projects mistake for a domain model. The language itself, and OTP, are unchanged and live in [functional-elixir](../functional-elixir/SKILL.md). This pack is only what Phoenix and Ecto add. **Check the installed version before writing code.** The shapes below target Phoenix 1.8, LiveView 1.2 and Ecto 3. ## When to use - Designing a context, a schema, or a changeset - Deciding whether a rule belongs in a changeset or in the domain - Structuring a LiveView's assigns and events - Publishing something other parts of the system react to - Reviewing a controller or LiveView that has grown rules Not for: the Elixir language, OTP, routing, or deployment. ## Core rules 1. Rule. **Contexts are bounded contexts**, not folders. Each owns its structs and exposes functions; none reaches into another's schemas. 2. Rule. **An Ecto schema is a boundary artefact, not the domain type.** It carries nullable columns, associations and `__meta__`. Map it into a domain struct and work with that. 3. Rule. **A changeset parses; it does not decide.** Format, presence and length belong there. "A discount over twenty per cent needs approval" belongs in the domain, where it can be tested without Ecto. 4. Default. **One assign for the screen state**, as a ta