Elixir Essentials

Enforce Elixir coding standards covering pattern matching, error handling, and naming conventions.

24|4|Updated Nov 15, 2023
One-click install
npx skills add https://github.com/matthewsinclair/intent --skill elixir-essentials
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Elixir Essentials
Source: https://github.com/matthewsinclair/intent/tree/main/intent/plugins/claude/skills/in-elixir-essentials
Command: npx skills add https://github.com/matthewsinclair/intent --skill elixir-essentials

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about Elixir Essentials

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Elixir coding standards for pattern matching and error handling?▼

Enforce Elixir coding standards by mandating multi-clause pattern matching over conditionals and using tagged tuples like `{:ok, result}` or `{:error, reason}` for all fallible functions to ensure consistency and readability.

What is the best way to handle sequential data transformations in Elixir?▼

The best way to handle sequential data transformations in Elixir is by using pipes for sequential operations and the `with` statement for railway-oriented composition of multiple fallible functions.

How do you annotate behavior callbacks in Elixir to prevent typos?▼

Annotate behavior callbacks in Elixir by requiring `@impl true` for all callbacks, which catches typos and improves clarity by explicitly declaring that a function implements a specific behavior.

Why should I remove debug artifacts like IO.inspect from my Elixir code?▼

Remove debug artifacts like `IO.inspect` or `dbg()` from your Elixir code because enforcing coding standards prohibits these artifacts in committed code to maintain production-level cleanliness and prevent debugging side effects.

Does this Elixir coding standard cover naming conventions and data access?▼

Yes, the Elixir coding standard covers naming conventions for boolean and raising functions, and it advocates for assertive data access using `struct.field` for required keys and pattern matching for destructuring.