elixir-essentials
Installation
SKILL.md
Elixir Essentials
Use this skill before writing ANY .ex or .exs file.
RULES — Follow these with no exceptions
- Use pattern matching over if/else for control flow and data extraction
- Use
@impl truebefore every callback function (mount, handle_event, handle_info, etc.) - Produce
{: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
- Use
?suffix for predicate functions,!suffix for dangerous functions - Never write defensive code for impossible states — let it crash
- Use
@docand@moduledocfor all public APIs - Prefer immutability — never mutate data in place
- Don't use
String.to_atom/1on user input (atom table exhaustion) - Prefer
forcomprehensions before chaining 3+ Enum operations