What problem does it solve?
This Skill enforces a set of core Elixir coding rules to ensure consistency, readability, and maintainability across Elixir projects, preventing common pitfalls and promoting best practices.
Core Features & Use Cases
- Pattern Matching: Mandates multi-clause pattern matching over conditionals for cleaner code.
- Callback Annotations: Requires
@impl true for all behaviour callbacks to catch typos and improve clarity.
- Error Handling: Enforces tagged tuples (
{:ok, result} or {:error, reason}) for all fallible functions.
- Composition: Promotes the use of
with for railway-oriented programming and pipes for sequential transformations.
- Naming Conventions: Standardizes naming for boolean functions, functions that raise, unused variables, and expressive variable names.
- Data Access: Advocates for assertive data access (
struct.field) for required keys and pattern matching for destructuring.
- Debugging: Prohibits debug artifacts like
IO.inspect or dbg() in committed code.
Quick Start
Apply the Elixir Essentials rules to the provided code snippet.