Erlang Coding Practices
Application skill for Erlang style learning (from the archived awesome-guidelines style capsules). For supervision trees and release tooling, combine with OTP stack capsules in skills/*-foundation.
Core Principle
Erlang quality is pattern-visible modules + crash-loud bugs, explicit exports, clause-driven control flow, and restrictive matching on every boundary.
When to Use / NOT
- Erlang/OTP applications, libraries, and
src/*.erl modules.
- Setting up Elvis, Dialyzer, xref, rebar3 test/dialyzer in CI.
NOT when:
- Elixir code, use
elixir-coding-practices (BEAM overlap on security only).
- Generated
.app / protobuf stubs, validate generators.
Workflow
- Layout, indent, types/records, grouping (
erlang-style-formatting-modules.md).
- Names & types, snake/CamelCase, specs, opaque state (
erlang-style-naming-types.md).
- Control flow, clauses, try/catch, no if (
erlang-style-control-flow.md).
- OTP & security, exports, API wrap, input safety (
erlang-style-otp-security.md).
- Verify, Elvis, Dialyzer, xref, rebar3 test on changed modules.
Red Flags
-compile(export_all) or -import
- camelCase functions or snake_case variables
- Records/types in
.hrl
- Cross-module raw
gen_server:call
- Giant top-level
case or if
case catch / legacy catch / control-flow throw
- Boolean function parameters
binary_to_atom/1 on external input
binary_to_term/1 without [safe] on untrusted data
- Catch-all
_ when return set is known
_ = on fallible standard-library calls
- Debug
io:format in src/
- God modules or macros for module names
Verification
rebar3 dialyzer / project Dialyzer profile
- Elvis (Inaka rules or project config)
xref / cross-reference check where configured
rebar3 eunit or Common Test on changed modules
- Capsule checklist on exported
-spec list
References
awesome-guidelines/references/erlang-style-learning-note.md
awesome-guidelines/references/erlang-style-formatting-modules.md
awesome-guidelines/references/erlang-style-naming-types.md
awesome-guidelines/references/erlang-style-control-flow.md
awesome-guidelines/references/erlang-style-otp-security.md
1---2name: erlang-coding-practices3description: Use when authoring or reviewing Erlang, 2-space layout, snake_case/CamelCase naming, clause functions, -spec exports, OTP API encapsulation, {ok,error} returns, atom/deserialize safety, and Elvis/dialyzer/xref in CI.4---56# Erlang Coding Practices78Application skill for Erlang style learning (from the archived `awesome-guidelines` style capsules). For supervision trees and release tooling, combine with OTP stack capsules in `skills/*-foundation`.910## Core Principle1112Erlang quality is **pattern-visible modules + crash-loud bugs**, explicit exports, clause-driven control flow, and restrictive matching on every boundary.1314## When to Use / NOT1516- Erlang/OTP applications, libraries, and `src/*.erl` modules.17- Setting up Elvis, Dialyzer, xref, rebar3 test/dialyzer in CI.1819**NOT when:**2021- Elixir code, use `elixir-coding-practices` (BEAM overlap on security only).22- Generated `.app` / protobuf stubs, validate generators.2324## Workflow25261. **Layout**, indent, types/records, grouping (`erlang-style-formatting-modules.md`).272. **Names & types**, snake/CamelCase, specs, opaque state (`erlang-style-naming-types.md`).283. **Control flow**, clauses, try/catch, no if (`erlang-style-control-flow.md`).294. **OTP & security**, exports, API wrap, input safety (`erlang-style-otp-security.md`).305. **Verify**, Elvis, Dialyzer, xref, rebar3 test on changed modules.3132## Red Flags3334- `-compile(export_all)` or `-import`35- camelCase functions or snake_case variables36- Records/types in `.hrl`37- Cross-module raw `gen_server:call`38- Giant top-level `case` or `if`39- `case catch` / legacy `catch` / control-flow `throw`40- Boolean function parameters41- `binary_to_atom/1` on external input42- `binary_to_term/1` without `[safe]` on untrusted data43- Catch-all `_` when return set is known44- `_ =` on fallible standard-library calls45- Debug `io:format` in `src/`46- God modules or macros for module names4748## Verification4950- `rebar3 dialyzer` / project Dialyzer profile51- Elvis (Inaka rules or project config)52- `xref` / cross-reference check where configured53- `rebar3 eunit` or Common Test on changed modules54- Capsule checklist on exported `-spec` list555657## References5859- `awesome-guidelines/references/erlang-style-learning-note.md`60- `awesome-guidelines/references/erlang-style-formatting-modules.md`61- `awesome-guidelines/references/erlang-style-naming-types.md`62- `awesome-guidelines/references/erlang-style-control-flow.md`63- `awesome-guidelines/references/erlang-style-otp-security.md`