skillfed

Elixir Idioms

This skill covers the core patterns that make Elixir code functional and resilient. Learn pattern matching across function heads and case expressions, build stateful processes with GenServer, and embrace the supervision model's "let it crash" philosophy. The skill also covers pipe-friendly API design, naming conventions, and tools like Credo and Dialyzer for code quality.

Elixir Idioms teaches functional, fault-tolerant coding patterns including pattern matching, OTP supervision, and the pipe operator.

AI-generated summary based on this skill's SKILL.md

150 48 MIT updated by irahardianto

Install

irahardianto/awesome-agv/elixir-idioms · repository language: JavaScript

git clone https://github.com/irahardianto/awesome-agv
cp -r awesome-agv/.agents/skills/elixir-idioms ~/.claude/skills/elixir-idioms
npx skillfed install irahardianto/awesome-agv/elixir-idioms

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to write idiomatic Elixir code?

Elixir Idioms teaches you to write idiomatic Elixir code by mastering pattern matching across function heads and case expressions, designing pipe-friendly APIs, and following naming conventions. The skill emphasizes leveraging Elixir's functional nature—using immutability, avoiding side effects in pure functions, and composing operations with the pipe operator. You'll learn to structure code that reads naturally and aligns with the language's design philosophy.

What does Elixir Idioms cover about OTP supervision trees?

Elixir Idioms covers OTP supervision trees as a core fault-tolerance mechanism. You'll understand how to build stateful processes with GenServer, design supervision hierarchies that restart failed children, and embrace the "let it crash" philosophy. The skill teaches you to structure applications so that failures are isolated, supervised, and recovered automatically—making your systems resilient by design.

What pattern matching examples does Elixir Idioms provide?

Elixir Idioms provides pattern matching examples across multiple contexts: matching in function heads to handle different input shapes, using case expressions for conditional logic, and destructuring data structures. These examples show how pattern matching replaces traditional if-else chains, making code more declarative and expressive while catching unhandled cases at compile time.

Which code quality tools does Elixir Idioms cover?

Elixir Idioms covers essential code quality tools including Credo for linting and style checking, Dialyzer for static type analysis, and ExUnit for testing. The skill shows you how to set up and use these tools to enforce consistency, catch type errors early, and maintain high code standards across your Elixir projects.

How does Elixir Idioms explain the pipe operator?

Elixir Idioms explains pipe operator usage as a key pattern for writing readable, composable code. You'll learn how to chain function calls left-to-right, design APIs that work naturally with pipes, and avoid nested function calls. The skill demonstrates how the pipe operator encourages a functional, data-transformation mindset central to idiomatic Elixir.

What functional programming principles does Elixir Idioms teach?

Elixir Idioms teaches functional programming and immutability principles by showing how Elixir's immutable data structures and process-based concurrency model enable safe, predictable code. You'll learn to think in terms of data transformations, avoid shared mutable state, and use processes and message passing for concurrent, fault-tolerant systems.

SKILL.md

rendered from the published skill — quoted content, verbatim

Elixir Idioms and Patterns

Elixir rewards immutability, pattern matching, and the OTP supervision model. Idiomatic Elixir = functional, fault-tolerant, process-oriented.

> Scope: Elixir coding idioms. Test naming: .agents/rules/testing-strategy.md.

Pattern Matching

  1. Pattern match everything — function heads, case, with: elixir def handle_result({:ok, task}), do: {:reply, task} def handle_result({:error, :not_found}), do: {:error, 404} def handle_result({:error, reason}), do: {:error, 500, reason}

  2. with for happy-path pipelines: elixir with {:ok, user} <- fetch_user(user_id), {:ok, task} <- create_task(user, params), :ok <- notify(user, task) do {:ok, task} end

OTP and Supervision

  1. GenServer for stateful processes: ```elixir defmodule TaskCache do use GenServer

    def start_link(opts), do: GenServer.start_link(MODULE, %{}, opts) def get(pid, id), do: GenServer.call(pid, {:get, id})

    @impl true def handle_call({:get, id}, _from, state) do {:reply, Map.get(state, id), state} end

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
.agents/skills/elixir-idioms/SKILL.md

Related skills

Tags

fault-tolerance process-oriented immutable-data supervision-tree functional-style actor-model code-quality static-analysis pattern-matching