Agent skill

Elixir Essentials

by j-morgan6 in j-morgan6/elixir-phoenix-guide

A skill your agent uses when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts.

MITAuto-check passedDevelopment

Install Elixir Essentials

skills CLI
$ npx skills add j-morgan6/elixir-phoenix-guide --skill elixir-essentials -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install j-morgan6/elixir-phoenix-guide elixir-essentials --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/j-morgan6/elixir-phoenix-guide.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/elixir-essentials .claude/skills/elixir-essentials && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
elixir-essentials
GitHub stars
166
Token cost
~2.2k tokens
SKILL.md length
389 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts.

  • Works in 8 steps: Use pattern matching over if/else for… → Add @impl true before every callback… → Return {:ok, result} | {:error, reason}… → …
  • Refactoring core Elixir — pattern matching
  • SKILL.md covers RULES — Follow these with no…, Pattern Matching, Pipe Operator and With Statement, plus 15 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Elixir Essentials is an agent skill from j-morgan6/elixir-phoenix-guide. Use when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts. Baseline style for any .ex/.exs change not covered by a more specific skill.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Refactoring. It works with Elixir. The licence is MIT.

When your agent uses it

  • Refactoring core Elixir — pattern matching
  • Tasks that involve Refactoring

Example prompts

  • “/elixir-essentials”

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Use pattern matching over if/else for control flow and data extraction
  2. Add @impl true before every callback function (mount, handle_event, handle_info, etc.)
  3. Return {:ok, result} | {:error, reason} tuples for fallible operations
  4. Use with for 2+ sequential fallible operations instead of nested case
  5. Use the pipe operator for 2+ chained transformations
  6. Never nest if/else statements — use case, cond, or multi-clause functions
  7. Predicate functions end with ?, dangerous functions end with !
  8. Let it crash — don't write defensive code for impossible states

What it can do on your machine

Read from SKILL.md and the folder at commit cdfddac. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are elixir).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Elixir Essentials loads about 2.2k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 389 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from j-morgan6/elixir-phoenix-guide at commit cdfddac, republished under its MIT licence (© j-morgan6). 389 words, ~2,193 tokens.

Download SKILL.mdSave it as .claude/skills/elixir-essentials/SKILL.md (or your agent's skills folder).
name
elixir-essentials
description
Use when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, _}/{:error, _} contracts. Baseline style for any .ex/.exs change not covered by a more specific skill.
file_patterns
**/*.ex, **/*.exs
auto_suggest
true

Elixir Essentials

RULES — Follow these with no exceptions

  1. Use pattern matching over if/else for control flow and data extraction
  2. Add @impl true before every callback function (mount, handle_event, handle_info, etc.)
  3. Return {:ok, result} | {:error, reason} tuples for fallible operations
  4. Use with for 2+ sequential fallible operations instead of nested case
  5. Use the pipe operator for 2+ chained transformations
  6. Never nest if/else statements — use case, cond, or multi-clause functions
  7. Predicate functions end with ?, dangerous functions end with !
  8. 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.

Prefer Pattern Matching Over if/else

Bad:

elixir
def process(result) do
  if result.status == :ok do
    result.data
  else
    nil
  end
end

Good:

elixir
def process(%{status: :ok, data: data}), do: data
def process(_), do: nil
Use Case for Multiple Patterns

Bad:

elixir
# Nested if inside else — hard to read and not how Elixir expresses multi-way branching
def handle_response(response) do
  if response.status == 200 do
    {:ok, response.body}
  else
    if response.status == 404 do
      {:error, :not_found}
    else
      {:error, :unknown}
    end
  end
end

Good:

elixir
def handle_response(%{status: 200, body: body}), do: {:ok, body}
def handle_response(%{status: 404}), do: {:error, :not_found}
def handle_response(_), do: {:error, :unknown}

Pipe Operator

Use the pipe operator |> to chain function calls for improved readability.

Basic Piping

Bad:

elixir
String.upcase(String.trim(user_input))

Good:

elixir
user_input
|> String.trim()
|> String.upcase()
Pipe into Function Heads

Bad:

elixir
def process_user(user) do
  validated = validate_user(user)
  transformed = transform_user(validated)
  save_user(transformed)
end

Good:

elixir
def process_user(user) do
  user
  |> validate_user()
  |> transform_user()
  |> save_user()
end

With Statement

Use with for sequential operations that can fail.

Bad:

elixir
def create_post(params) do
  case validate_params(params) do
    {:ok, valid_params} ->
      case create_changeset(valid_params) do
        {:ok, changeset} ->
          Repo.insert(changeset)
        error -> error
      end
    error -> error
  end
end

Good:

elixir
def create_post(params) do
  with {:ok, valid_params} <- validate_params(params),
       {:ok, changeset} <- create_changeset(valid_params),
       {:ok, post} <- Repo.insert(changeset) do
    {:ok, post}
  end
end
With Statement - Inline Error Handling

Handle specific errors in the else block.

elixir
def transfer_money(from_id, to_id, amount) do
  with {:ok, from_account} <- get_account(from_id),
       {:ok, to_account} <- get_account(to_id),
       :ok <- validate_balance(from_account, amount),
       {:ok, _} <- debit(from_account, amount),
       {:ok, _} <- credit(to_account, amount) do
    {:ok, :transfer_complete}
  else
    {:error, :insufficient_funds} ->
      {:error, "Not enough money in account"}

    {:error, :not_found} ->
      {:error, "Account not found"}

    error ->
      {:error, "Transfer failed: #{inspect(error)}"}
  end
end

Guards

Use guards for simple type and value checks in function heads.

elixir
def calculate(x) when is_integer(x) and x > 0 do
  x * 2
end

def calculate(_), do: {:error, :invalid_input}

List Comprehensions

Use for comprehensions for complex transformations and filtering.

Bad (multiple passes):

elixir
list
|> Enum.map(&transform/1)
|> Enum.filter(&valid?/1)
|> Enum.map(&format/1)

Good (single pass):

elixir
for item <- list,
    transformed = transform(item),
    valid?(transformed) do
  format(transformed)
end

Naming Conventions

  • Module names: PascalCase
  • Function names: snake_case
  • Variables: snake_case
  • Atoms: :snake_case
  • Predicate functions end with ?: valid?, empty?
  • Dangerous functions end with !: save!, update!

Tagged Tuples for Error Handling

The idiomatic way to handle success and failure in Elixir.

elixir
def fetch_user(id) do
  case Repo.get(User, id) do
    nil -> {:error, :not_found}
    user -> {:ok, user}
  end
end

# Usage
case fetch_user(123) do
  {:ok, user} -> IO.puts("Found: #{user.name}")
  {:error, :not_found} -> IO.puts("User not found")
end
Show full SKILL.md (150 more words)Show less

Case Statements

Pattern match on results.

elixir
def process_upload(file) do
  case save_file(file) do
    {:ok, path} ->
      Logger.info("File saved to #{path}")
      create_record(path)

    {:error, :invalid_format} ->
      {:error, "File format not supported"}

    {:error, reason} ->
      Logger.error("Upload failed: #{inspect(reason)}")
      {:error, "Upload failed"}
  end
end

Bang Functions

Functions ending with ! raise errors instead of returning tuples.

elixir
# Returns {:ok, user} or {:error, changeset}
def create_user(attrs) do
  %User{}
  |> User.changeset(attrs)
  |> Repo.insert()
end

# Returns user or raises
def create_user!(attrs) do
  %User{}
  |> User.changeset(attrs)
  |> Repo.insert!()
end

# Usage
try do
  user = create_user!(invalid_attrs)
  IO.puts("Created #{user.name}")
rescue
  e in Ecto.InvalidChangesetError ->
    IO.puts("Failed: #{inspect(e)}")
end

Try/Rescue

Catch exceptions when needed (use sparingly).

elixir
def parse_json(string) do
  try do
    {:ok, Jason.decode!(string)}
  rescue
    Jason.DecodeError -> {:error, :invalid_json}
  end
end

Processes, GenServers, supervision: see the otp-essentials skill.

Validation Errors

Return clear, actionable error messages.

elixir
def validate_image_upload(file) do
  with :ok <- validate_file_type(file),
       :ok <- validate_file_size(file),
       :ok <- validate_dimensions(file) do
    {:ok, file}
  else
    {:error, :invalid_type} ->
      {:error, "Only JPEG, PNG, and GIF files are allowed"}

    {:error, :too_large} ->
      {:error, "File must be less than 10MB"}

    {:error, :invalid_dimensions} ->
      {:error, "Image must be at least 100x100 pixels"}
  end
end

Changeset Errors

Extract and format Ecto changeset errors.

elixir
def changeset_errors(changeset) do
  Ecto.Changeset.traverse_errors(changeset, fn {msg, opts} ->
    Enum.reduce(opts, msg, fn {key, value}, acc ->
      String.replace(acc, "%{#{key}}", to_string(value))
    end)
  end)
end

# Usage
case create_user(attrs) do
  {:ok, user} -> {:ok, user}
  {:error, changeset} ->
    errors = changeset_errors(changeset)
    {:error, errors}
end

Early Returns

Use pattern matching in function heads for early returns.

elixir
def process_data(nil), do: {:error, :no_data}
def process_data([]), do: {:error, :empty_list}
def process_data(data) when is_list(data) do
  # Process the list
  {:ok, Enum.map(data, &transform/1)}
end

Avoid Defensive Programming

Don't check for things that can't happen. Let it crash.

Bad (defensive):

elixir
def get_username(user) do
  if user && user.name do
    user.name
  else
    "Unknown"
  end
end

Good (trust your types):

elixir
def get_username(%User{name: name}), do: name

If the user is nil or doesn't have a name, it's a bug that should crash and be fixed.

Documentation

Use @doc for public functions and @moduledoc for modules.

elixir
defmodule MyModule do
  @moduledoc """
  This module handles user operations.
  """

  @doc """
  Fetches a user by ID.

  Returns `{:ok, user}` or `{:error, :not_found}`.
  """
  def fetch_user(id), do: # ...
end

Immutability

All data structures are immutable. Functions return new values rather than modifying in place.

elixir
# Always returns a new list
list = [1, 2, 3]
new_list = [0 | list]  # [0, 1, 2, 3]
# list is still [1, 2, 3]

Testing

When writing test files for Elixir modules, invoke elixir-phoenix-guide:testing-essentials before writing any _test.exs file.

Anonymous Functions

Use the capture operator & for concise anonymous functions.

Verbose:

elixir
Enum.map(list, fn x -> x * 2 end)

Concise:

elixir
Enum.map(list, &(&1 * 2))

Named function capture:

elixir
Enum.map(users, &User.format/1)

© j-morgan6, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/elixir-essentials of j-morgan6/elixir-phoenix-guide.

Open the folder on GitHubat commit cdfddac

Compare with similar skills

Elixir Essentials next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Elixir Essentials compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Elixir Essentials this skillj-morgan6/elixir-phoenix-guide166—~2.2kAutomated safety check: PassMIT
Elixirstreamband/hydra-srt146—~804Automated safety check: PassApache-2.0
Idiomatic Elixirgeorgeguimaraes/elixir-agent-tools184—~2.1kAutomated safety check: PassApache-2.0
Change CleanupSimon-Initiative/oli-torus119—~3.7kAutomated safety check: PassMIT
Elixir AntipatternsGentleman-Programming/Gentleman-Skills657—~2.1kAutomated safety check: PassMIT
Elixirericrisco/rsc-harness156—~2.9kAutomated safety check: PassMIT

Similar skills

  • Elixir

    streamband/hydra-srt

    A skill your agent uses for Elixir/Phoenix development in this repo: implementing features, refactors, debugging, tests, Ecto changes, and production-safe fixes.

    146 GitHub stars~804 tokensUpdated 21 days ago
    DevelopmentAuto-check passed
  • Idiomatic Elixir

    georgeguimaraes/elixir-agent-tools

    Writes and refactors idiomatic Elixir modules and functions, with rules for pattern matching, error handling, protocols and when a process is really needed.

    184 GitHub stars~2.1k tokensUpdated 18 days ago
    DevelopmentAuto-check passed
  • Change Cleanup

    Simon-Initiative/oli-torus

    Clean up and harden code introduced by the current branch without drifting into broad refactors.

    119 GitHub stars~3.7k tokensUpdated today
    DevelopmentAuto-check passed
  • Elixir Antipatterns

    Gentleman-Programming/Gentleman-Skills

    Core catalog of 8 critical Elixir/Phoenix anti-patterns covering error handling, separation of concerns, Ecto queries, and testing.

    657 GitHub stars~2.1k tokensUpdated 6 mo ago
    DevelopmentAuto-check passed
  • Elixir

    ericrisco/rsc-harness

    A skill your agent uses when writing or refactoring Elixir/OTP on the BEAM — GenServers, supervision trees and restart strategies, pattern matching, mix projects and releases — or when processes…

    156 GitHub stars~2.9k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Elixir Idioms

    irahardianto/awesome-agv

    Elixir and OTP idioms: pattern matching, with pipelines, GenServer and supervision tree architecture, fault-tolerant concurrency, and ExUnit testing.

    157 GitHub stars~771 tokensUpdated 2 days ago
    DevelopmentAuto-check passed

More from j-morgan6/elixir-phoenix-guide

All 19 skills in this repo
  • Code Quality

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when refactoring for duplication, complexity, or dead code — includes the plugin's on-demand analysis scripts.

    166 GitHub stars~1.4k tokensUpdated 3 mo ago
    Auto-check passed
  • Deployment Gotchas

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when preparing releases or deployment config — runtime.exs vs compile-time config, release migrations, PHXHOST/PHXSERVER, assets, health checks.

    166 GitHub stars~2.6k tokensUpdated 3 mo ago
    Auto-check passed
  • Ecto Changeset Patterns

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when a resource needs multiple changesets (registration vs update), conditional validation, field transforms, or uniqueness validation — changeset composition.

    166 GitHub stars~2.1k tokensUpdated 3 mo ago
    Auto-check passed
  • Ecto Essentials

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when defining schemas, writing queries, or creating migrations — schema design, Repo usage, indexes, query composition.

    166 GitHub stars~2.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Ecto Nested Associations

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when a form or operation manages parent and child records together — castassoc/castembed, onreplace, Ecto.Multi across tables, FK cascade design.

    166 GitHub stars~2.2k tokensUpdated 3 mo ago
    Auto-check passed
  • Oban Essentials

    j-morgan6/elixir-phoenix-guide

    A skill your agent uses when writing background jobs with Oban — worker options, return contracts, idempotency, uniqueness, Oban.Testing.

    166 GitHub stars~2.1k tokensUpdated 3 mo ago
    Auto-check passed

Works with

Categories

Questions about Elixir Essentials

What does Elixir Essentials do?

A skill your agent uses when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts. Elixir Essentials is an agent skill from j-morgan6/elixir-phoenix-guide. Use when writing or refactoring core Elixir — pattern matching, case/cond/with, pipes, {:ok, }/{:error, } contracts.

When should I use Elixir Essentials?

Elixir Essentials fits situations like: refactoring core Elixir — pattern matching; tasks that involve Refactoring.

How do I install Elixir Essentials in Claude Code?

Run `npx skills add j-morgan6/elixir-phoenix-guide --skill elixir-essentials -a claude-code`. Or copy the skill folder (skills/elixir-essentials in j-morgan6/elixir-phoenix-guide) into .claude/skills/elixir-essentials in your project. Claude Code loads it when a task matches its description.

How do I install Elixir Essentials in Codex?

Run `npx skills add j-morgan6/elixir-phoenix-guide --skill elixir-essentials -a codex`. Or copy the skill folder (skills/elixir-essentials in j-morgan6/elixir-phoenix-guide) into .agents/skills/elixir-essentials in your project. Codex loads it when a task matches its description.

Can I use Elixir Essentials in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add j-morgan6/elixir-phoenix-guide --skill elixir-essentials -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elixir-essentials, .gemini/skills/elixir-essentials, .github/skills/elixir-essentials and .opencode/skills/elixir-essentials in your project.

What does Elixir Essentials need to run?

SKILL.md names no scripts, command-line tools or credentials: Elixir Essentials is instructions for the agent only.

Does Elixir Essentials access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Elixir Essentials safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Elixir Essentials use?

Elixir Essentials is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Elixir Essentials use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Elixir Essentials?

Skills that share tags, products or a category with Elixir Essentials: Elixir (streamband/hydra-srt, 146 stars), Idiomatic Elixir (georgeguimaraes/elixir-agent-tools, 184 stars), Change Cleanup (Simon-Initiative/oli-torus, 119 stars) and Elixir Antipatterns (Gentleman-Programming/Gentleman-Skills, 657 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Elixir Essentials?

j-morgan6 (a GitHub user) maintains it in j-morgan6/elixir-phoenix-guide, which has 166 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on July 6, 2026.

Source: j-morgan6/elixir-phoenix-guide on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.