Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

elixir

/elixir

Wspiera programowanie w Elixirze: dopasowanie wzorców, GenServer, supervisory OTP i kanały Phoenix, dla współbieżnych, rozproszonych i odpornych na błędy systemów.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
2
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wspiera programowanie w Elixirze: dopasowanie wzorców, GenServer, supervisory OTP i kanały Phoenix, dla współbieżnych, rozproszonych i odpornych na błędy systemów.

Oryginalny opis (EN)

Expert Elixir programming assistance covering pattern matching, GenServer, OTP supervisors, and Phoenix channels. Use when building highly concurrent, distributed, fault-tolerant web and backend systems.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 153 linii, 597 słów
Podgląd SKILL.md
---
name: elixir
description: Expert Elixir programming assistance covering pattern matching, GenServer, OTP supervisors, and Phoenix channels. Use when building highly concurrent, distributed, fault-tolerant web and backend systems.
---

# Elixir

A dynamic, functional language designed for building scalable and maintainable applications. Running on the Erlang VM (BEAM).

## When to Use

- **High-Concurrency Distributed Systems**: Running millions of simultaneous processes on the battle-tested BEAM (Erlang VM).
- **Real-Time Web Applications (Phoenix LiveView)**: Building dynamic, interactive web interfaces with zero client-side JavaScript.
- **Fault-Tolerant Microservices & Telecommunications**: Applications that self-heal from failures using supervision trees and "let it crash" philosophy.
- **IoT & Embedded Systems (Nerves)**: Building robust embedded firmware for IoT gateways and industrial controllers.

## Quick Start

```elixir
IO.puts "Hello, World!"

list = [1, 2, 3]
doubled = Enum.map(list, fn x -> x * 2 end)

defmodule Math do
  def sum(a, b), do: a + b
end
```

## Core Concepts

### Lightweight Actor Processes & Message Passing

Processes on the BEAM are isolated, consume only ~2KB of memory, and communicate exclusively via asynchronous message passing:

```elixir
# Spawn an isolated actor process
pid = spawn(fn ->
  receive do
    {:ping, sender_pid} ->
      send(sender_pid, :pong)
  end
end)

# Send message and await response
send(pid, {:ping, self()})
receive do
  :pong -> IO.puts("Received pong response!")
after
  1000 -> IO.puts("Timeout waiting for response")
end
```

### Pattern Matching & Pipe Operator (`|>`)

Pipelines data transformations through readable function compositions:

```elixir
def process_order(payload) do
  payload
  |> Jason.decode!()
  |> validate_order()
  |> calculate_tax()
  |> persist_to_database()
end
```

### Supervision Trees & Fault Tolerance

Supervisors monitor worker processes and restart them automatically when unhandled exceptions occur:

```elixir
defmodule CoreApp.Supervisor do
  use Supervisor

  def start_link(init_arg) do
    Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
  end

  @impl true
  def init(_init_arg) do
    children = [
      {CoreApp.DatabaseWorker, []},
      {CoreApp.EventConsumer, []}
    ]

    Supervisor.init(children, strategy: :one_for_one)
  end
end
```

## Common Patterns

### State Management with GenServer

**Problem**: Maintaining state and handling concurrent messages safely without shared memory locks.

**Solution**:
Implement a supervised GenServer actor:

```elixir
defmodule CounterServer do
  use GenServer

  # Client API
  def start_link(default \\ 0) do
    GenServer.start_link(__MODULE__, default, name: __MODULE__)
  end

  def increment do
    GenServer.cast(__MODULE__, :inc)
  end

  def get_count do
    GenServer.call(__MODULE__, :get)
  end

  # Server Callbacks
  @impl true
  def init(count), do: {:ok, count}

  @impl true
  def handle_cast(:inc, state), do: {:noreply, state + 1}

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

## Best Practices

**Do**:

- Embrace Phoenix LiveView: Build rich real-time SPAs using server-rendered LiveView; eliminate client API maintenance.
- Let It Crash: Do not defensively catch every exception; let crashed processes be cleanly restarted by supervisors.
- Use Ecto Changesets for Data Validation: Validate incoming parameters and domain constraints using composable changesets.
- Structure Concurrency with GenServer & Task: Use standard OTP behaviors (`GenServer`, `Task`, `Agent`) rather than raw `spawn`.

**Don't**:

- Use GenServers as simple data storage: Storing large volumes of data in GenServer state creates performance bottlenecks; use ETS.
- Perform blocking work inside GenServer `handle_call`: Delegate slow tasks to separate `Task.async` workers.
- Mutate state across processes: State is strictly immutable; communicate via messages and return new state.

## Troubleshooting

| Error                                               | Cause                                                                              | Solution                                                                       |
| :-------------------------------------------------- | :--------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
| `MatchError: no match of right hand side value`     | Pattern match failed on expected tuple (e.g. `{:ok, val}` got `{:error, reason}`). | Add fallback clause or use `with` statement for multi-step pattern matching.   |
| `GenServer.call timeout after 5000ms`               | Target process deadlocked, busy, or crashed during call.                           | Inspect GenServer callback work and increase timeout parameter if intentional. |
| `UndefinedFunctionError: function ... is undefined` | Module not compiled, typo in function name, or wrong arity.                        | Run `mix compile` and check module exports with `module_info(:exports)`.       |

## References

- [Elixir-Lang](https://elixir-lang.org/)
- [Phoenix Framework](https://www.phoenixframework.org/)

Wersje

RepozytoriumWynikLicencja
Ta strona · G1Joshi/Agent-Skills100MIT
ericrisco/rsc-harness100MIT
TerminalSkills/skills100Apache-2.0
georgeguimaraes/claude-code-elixir100Apache-2.0
j4flmao/agent-skills95MIT
j4flmao/agent-skills95MIT
dkbnull/hello-skill86MIT

Migawka bazy z 13.11.2026 · wersja paczki e36f898136c8 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 95elixir-otp-patterns
    Opisuje wzorce OTP w Elixirze (GenServer, Supervisor, Agent, Task) do budowy współbieżnych aplikacji odpornych na awarie.
  • 100elixir-expert
    Pomaga budować odporne na błędy systemy współbieżne w Elixirze z wzorcami OTP, architekturą GenServer i frameworkiem Phoenix do aplikacji w czasie rzeczywistym.
  • 100elixir-otp-concurrency
    Buduje odporne na awarie usługi współbieżne w Elixirze z GenServer, supervisorami i przekazywaniem wiadomości.
  • 100elixir-idioms
    Opisuje idiomy Elixira i OTP: dopasowanie wzorców, pipeline'y with, drzewa nadzoru GenServer, odporną na błędy współbieżność i testy ExUnit.
  • 100elixir-expert
    Wspiera pracę z Elixirem, Phoenix, OTP i systemami współbieżnymi.
  • 100otp
    Prowadzi przez współbieżność w OTP i Elixirze: GenServery, drzewa nadzoru i budowę odpornych na awarie systemów współbieżnych.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.