Command Palette

Search for a command to run...

Back to skills
skill № 02011

lang-elixir

Use when the user asks about Elixir, OTP, GenServer, supervision trees, Mix, Ecto, ExUnit, mix release or the BEAM. Produces idiomatic Elixir modules, OTP…

FreeNo executable scripts
j4flmaoby j4flmao★ 47 GitHub stars

Install lang-elixir in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Elixir

Purpose

Guide for Elixir build tools (Mix), OTP supervision trees, Phoenix framework, Ecto database layer, concurrency patterns, testing, and production deployment on BEAM.

Agent Protocol

Trigger

Keywords: elixir build, mix, phoenix, ecto, otp, supervision tree, gen server, phoenix liveview, nerves, ex_unit, elixir release.

Input Context

  • Project type (Phoenix web app, OTP app, Nerves firmware, CLI tool)
  • Database (PostgreSQL via Ecto, ETS, Mnesia)
  • Deployment target (bare-metal, Docker, Fly.io, Gigalixir)

Output Artifact

Code, mix.exs/config changes, or a supervision-tree design. No file unless requested.

Response Format

Elixir/OTP: {versions}
Process design: {supervisor -> children, restart strategy}
Code: {snippet}
Verify: mix format --check-formatted && mix credo && mix test

Decision Trees

Project Type Selection

What are you building?
├── Web app with real-time features → Phoenix (LiveView, PubSub, Channels)
├── Real-time API / WebSocket server → Phoenix Channels or simply GenServer + WebSock
├── Background job processor → Oban (persistent, PostgreSQL-backed jobs)
├── CLI tool → Mix escript.build (self-contained binary) or Burrito
├── Firmware / IoT → Nerves (Raspberry Pi, BeagleBone, embedded Linux)
└── Distributed system → OTP with :global / Horde / Swarm for node discovery

Data Store Selection

Data access pattern?
├── Relational, complex queries → Ecto + PostgreSQL (Phoenix standard)
├── In-memory, fast lookups → ETS (:ets, DETS for disk)
├── Process-local state → Agent, GenServer state
├── Distributed, replicated → Mnesia (built-in, eventually consistent)
├── Time-series → ClickHouse via Ecto adapter or Postgres + TimescaleDB
└── Caching → Cachex (ETS-based with TTL, stats, and distributed mode)

Supervision Strategy

Failure tolerance needed?
├── Simple app, no state → DynamicSupervisor (children started on demand)
├── Stateful service → GenServer under Supervisor with restart: :transient
├── Distributed → Horde.DynamicSupervisor (distributed across cluster nodes)
├── One-for-one restarts → Supervisor with strategy: :one_for_one
├── All-or-nothing → Supervisor with strategy: :one_for_all
└── Don't restart on failure → rest_for_one (restart siblings, not itself)

Build & Dependency Management

mix.exs

defmodule MyApp.MixProject do
  use Mix.Project

  def project do
    [
      app: :my_app,
      version: "0.1.0",
      elixir: "~> 1.17",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      releases: [
        my_app: [
          include_executables_for: [:unix],
          steps: [:assemble, &embed_erts?/1, :tar]
        ]
      ]
    ]
  end

  def application do
    [mod: {MyApp.Application, []}, extra_applications: [:logger]]
  end

  defp deps do
    [
      {:phoenix, "~> 1.7"},
      {:phoenix_live_view, "~> 0.20"},
      {:ecto_sql, "~> 3.11"},
      {:postgrex, "~> 0.17"},
      {:oban, "~> 2.17"},
      {:jason, "~> 1.4"},
      {:bandit, "~> 1.5"}  # HTTP/2 server (replaces cowboy)
    ]
  end
end

Common Commands

mix new my_app              # New OTP app
mix phx.new my_app          # New Phoenix app (--no-ecto, --no-html, --live)
mix deps.get                # Fetch dependencies
mix deps.compile            # Compile deps
mix compile --warnings-as-errors
mix format                  # Formatter (enforce in CI)
mix dialyzer                # Success typing analysis (run regularly)
mix test                    # Run tests
mix release                 # Build production release
mix escript.build           # Build CLI escript

Language-Specific Patterns

GenServer (Server Process)

defmodule OrderServer do
  use GenServer

  # Client API
  def start_link(opts) do
    GenServer.start_link(__MODULE__, opts, name: __MODULE__)
  end

  def get_order(id) do
    GenServer.call(__MODULE__, {:get_order, id})
  end

  def create_order(attrs) do
    GenServer.cast(__MODULE__, {:create_order, attrs})
  end

  # Server Callbacks
  @impl true
  def init(_opts) do
    {:ok, %{orders: %{}, counter: 0}}
  end

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

  @impl true
  def handle_cast({:create_order, attrs}, state) do
    id = state.counter + 1
    order = Map.put(attrs, :id, id)
    {:noreply, put_in(state.orders[id], order)}
  end
end

Phoenix LiveView

defmodule MyAppWeb.OrderLive.Index do
  use MyAppWeb, :live_view

  @impl true
  def mount(_params, _session, socket) do
    if connected?(socket), do: Orders.subscribe()  # PubSub on connect
    {:ok, stream(socket, :orders, Orders.list_orders())}
  end

  @impl true
  def handle_params(params, _url, socket) do
    {:noreply, apply_action(socket, socket.assigns.live_action, params)}
  end

  @impl true
  def handle_info({:order_created, order}, socket) do
    {:noreply, stream_insert(socket,
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/elixir-advanced.md
  • references/elixir-deployment.md
  • references/elixir-fundamentals.md
  • references/otp-supervision.md
  • references/phoenix-live-view.md
  • references/polymorphism-behaviours.md
  • references/polymorphism-protocols.md
  • references/typespecs-parameterized-types.md

FAQ

What does the lang-elixir skill do?

Use when the user asks about Elixir, OTP, GenServer, supervision trees, Mix, Ecto, ExUnit, mix release or the BEAM. Produces idiomatic Elixir modules, OTP process design and release setup. Not for Phoenix and LiveView application architecture (use backend-elixir).

How do I install the lang-elixir skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the lang-elixir skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare lang-elixir with