erlang
/erlang
Expert Erlang programming assistance covering BEAM virtual machine, actor concurrency, supervision trees, and OTP. Use when developing telecom systems, distributed databases, or messaging backbones.
- Author
- G1Joshi ↗
- Repository
- Agent-Skills ↗
- Licence
- MIT
- Last repository change
- 01.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Expert Erlang programming assistance covering BEAM virtual machine, actor concurrency, supervision trees, and OTP. Use when developing telecom systems, distributed databases, or messaging backbones.
Original author description
Expert Erlang programming assistance covering BEAM virtual machine, actor concurrency, supervision trees, and OTP. Use when developing telecom systems, distributed databases, or messaging backbones.
How it works
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
SKILL.md preview
---
name: erlang
description: Expert Erlang programming assistance covering BEAM virtual machine, actor concurrency, supervision trees, and OTP. Use when developing telecom systems, distributed databases, or messaging backbones.
---
# Erlang
Erlang is a battle-tested functional programming language designed for massive concurrency, high fault-tolerance, and distributed telecom systems on the BEAM virtual machine.
## When to Use
- **Nine-Nines High Availability Infrastructure**: Telecommunications, payment switching networks, and messaging systems requiring 99.9999999% uptime.
- **Massively Scalable Chat Systems (WhatsApp/ejabberd)**: Connecting millions of concurrent WebSocket and XMPP connections simultaneously.
- **Hot Code Swapping**: Upgrading running production systems and deploying bugfixes without stopping the server.
- **Low-Latency Distributed Clusters (OTP)**: Building distributed node clusters with built-in node discovery and heartbeats.
## Quick Start
```erlang
-module(hello).
-export([start/0]).
start() ->
io:format("Hello from Erlang/OTP!~n").
```
## Core Concepts
### Open Telecom Platform (OTP) GenServer Behavior
Standardized generic client-server framework managing state, calls, and asynchronous casts:
```erlang
-module(counter_server).
-behaviour(gen_server).
-export([start_link/0, increment/0, get_count/0]).
-export([init/1, handle_call/3, handle_cast/2, terminate/2]).
start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
increment() -> gen_server:cast(?MODULE, inc).
get_count() -> gen_server:call(?MODULE, get).
init([]) -> {ok, 0}.
handle_call(get, _From, Count) -> {reply, Count, Count}.
handle_cast(inc, Count) -> {noreply, Count + 1}.
terminate(_Reason, _State) -> ok.
```
### Pattern Matching Function Clauses
Functions declare multiple clauses matching input parameters structurally:
```erlang
-module(finance).
-export([tax/2]).
tax(Amount, {state, "CA"}) -> Amount * 0.0825;
tax(Amount, {state, "NY"}) -> Amount * 0.08875;
tax(Amount, {state, _Other}) -> Amount * 0.05.
```
### Hot Code Upgrades
Reloads module code live in memory while preserving active process state:
```erlang
% Compile and reload module in running Erlang VM
c(my_worker).
```
## Common Patterns
### Simple Actor Message Passing Loop
**Problem**: Managing asynchronous message queues and state without threads and mutexes.
**Solution**:
Use tail-recursive receive loops:
```erlang
-module(actor_counter).
-export([loop/1, start/0]).
start() ->
spawn(fun() -> loop(0) end).
loop(Count) ->
receive
{increment, N} ->
loop(Count + N);
{get, Sender} ->
Sender ! {current_count, Count},
loop(Count);
stop ->
ok
end.
```
## Best Practices
**Do**:
- Adhere Strictly to OTP Principles: Build applications around standard OTP behaviors (`gen_server`, `gen_statem`, `supervisor`).
- Use Erlang Term Storage (ETS) for Shared Cache: Leverage ETS tables for high-concurrency in-memory read lookups across processes.
- Run Dialyzer for Static Type Analysis: Add `-spec` type specifications to all public functions and run Dialyzer in CI.
- Monitor BEAM Metrics via Telemetry: Track process count, reductions, and scheduler utilization.
**Don't**:
- Register thousands of named processes: Atom tables are global and un-garbage-collected; dynamic atoms risk crashing the VM.
- Use defensive try/catch everywhere: Let processes crash on unexpected errors; let supervisors reset them to known good state.
- Block schedulers with non-yielding C-NIFs: Keep C Native Implemented Functions (NIFs) under 1ms or use dirty schedulers.
## Troubleshooting
| Error | Cause | Solution |
| :--------------------------------------------- | :------------------------------------------------------------------ | :-------------------------------------------------------------------------------- |
| `{badmatch, Value}` | Pattern matching failed on `=` or function argument. | Verify return structure and provide clauses for all expected outcomes. |
| `noproc: process not alive` | Sending a message or RPC call to a process PID that already exited. | Verify supervisor restart strategies and link/monitor processes with `monitor/2`. |
| `function_clause: no function clause matching` | Invoking function with arguments that don't match any head clause. | Check argument types, arity, and guard conditions. |
## References
- [Erlang.org](https://www.erlang.org/)
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · G1Joshi/Agent-Skills | 100 | MIT |
| dkbnull/hello-skill | 86 | MIT |
Database snapshot: 13.11.2026 · package version 8b516e177b18 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100erlang-distribution
Use when erlang distributed systems including node connectivity, distributed processes, global name registration, distributed supervision, network partitions, and building fault-tolerant multi-node applications on the BEAM VM. - 95erlang-otp-behaviors
Use when oTP behaviors including gen_server for stateful processes, gen_statem for state machines, supervisors for fault tolerance, gen_event for event handling, and building robust, production-ready Erlang applications with proven patterns. - 95elixir
Use this skill when the user asks about Elixir build tools, Mix, OTP, Phoenix, Ecto, supervision trees, concurrency, testing, or production deployment. Focus on BEAM/Erlang VM, tooling, and ecosystem — not syntax. - 100erlang-actor-model-fault-tolerance
Use this skill when designing distributed Erlang architectures adhering to the 'let it crash' philosophy and process supervision trees. - 90elixir-pro
Write idiomatic Elixir code with OTP patterns, supervision trees, and Phoenix LiveView. Masters concurrency, fault tolerance, and distributed systems. Use for Elixir refactoring, OTP design, or complex BEAM optimizations. - 100otp
Guide for OTP and Elixir concurrency. Use when implementing GenServers, designing supervision trees, or building fault-tolerant concurrent systems.