elixir-essentials
Elixir Essentials
RULES — Follow these with no exceptions
- Use pattern matching over if/else for control flow and data extraction
- Add @impl true before every callback function (mount, handle_event, handle_info, etc.)
- Return {:ok, result} | {:error, reason} tuples for fallible operations
- Use
withfor 2+ sequential fallible operations instead of nested case - Use the pipe operator for 2+ chained transformations
- Never nest if/else statements — use case, cond, or multi-clause functions
- Predicate functions end with
?, dangerous functions end with! - Let it crash — don't write defensive code for impossible states
Pattern Matching
Pattern matching is the primary control flow mechanism in Elixir. Prefer it over conditional statements.
More from j-morgan6/elixir-claude-optimization
phoenix-uploads
MANDATORY for file upload features. Invoke before implementing upload or file serving functionality.
14phoenix-liveview-essentials
MANDATORY for ALL LiveView work. Invoke before writing LiveView modules or .heex templates.
10phoenix-liveview
INVOKE BEFORE implementing any LiveView feature. REQUIRED for mount, handle_event, handle_info callbacks, file uploads, navigation, PubSub, streams, and LiveView testing. Essential for all LiveView development.
7elixir-patterns
INVOKE BEFORE writing any Elixir code. REQUIRED for pattern matching, pipe operators, with statements, guards, list comprehensions, and naming conventions. Use this skill to ensure idiomatic Elixir patterns.
6testing-essentials
MANDATORY for ALL test files. Invoke before writing any _test.exs file.
6ecto-essentials
MANDATORY for ALL database work. Invoke before modifying schemas, queries, or migrations.
5