erlang
4
总安装量
2
周安装量
#51995
全站排名
安装命令
npx skills add https://github.com/poletron/custom-rules --skill erlang
Agent 安装分布
github-copilot
2
mcpjam
1
claude-code
1
zencoder
1
crush
1
cline
1
Skill 文档
Critical Patterns
OTP GenServer (REQUIRED)
-module(counter).
-behaviour(gen_server).
-export([start_link/0, increment/0, get/0]).
-export([init/1, handle_call/3, handle_cast/2]).
start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
init([]) -> {ok, 0}.
handle_call(get, _From, State) ->
{reply, State, State}.
handle_cast(increment, State) ->
{noreply, State + 1}.
Supervisor (REQUIRED)
-module(my_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
SupFlags = #{strategy => one_for_one, intensity => 5, period => 10},
Children = [
#{id => worker, start => {my_worker, start_link, []}}
],
{ok, {SupFlags, Children}}.
Decision Tree
Need request/response? â Use gen_server call
Need fire-and-forget? â Use gen_server cast
Need supervision? â Use supervisor behavior
Need state machine? â Use gen_statem
Need event handling? â Use gen_event
Commands
erl # Start REPL
erlc module.erl # Compile
rebar3 compile # Build project
rebar3 shell # Interactive shell
Resources
- Concurrent Programming: concurrent-programming.md
- Fault Tolerance: fault-tolerance.md
- OTP Patterns: otp-patterns.md