From beam-style-guard
BEAM/Elixir style guide rules for writing idiomatic OTP code. Triggers when writing or editing Elixir (.ex/.exs) files. Covers behaviours, protocols, supervision, data models, error handling, message passing, Registry, API design, testing, documentation, organization, and anti-patterns.
How this skill is triggered — by the user, by Claude, or both
Slash command
/beam-style-guard:beam-style-rulesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When writing or editing Elixir code, follow these 12 principles. They are ordered by importance.
When writing or editing Elixir code, follow these 12 principles. They are ordered by importance.
@callback MUST have a @doc describing semantics, expected inputs, and all possible return values including error cases.term() or any() — use domain types like Event.t(), String.t(), etc.:ok | {:ok, result} | {:error, :specific_atom}.@moduledoc explaining purpose and when to implement.@spec and @doc with examples.{:ok, _} | {:error, _} consistently.name: __MODULE__ for named processes — never pass PIDs to callers.start_link/1 that accepts keyword opts.defstruct MUST have a preceding @enforce_keys with required fields.@type t :: %__MODULE__{} with all field types.new/1 or new/2.valid?/1 for runtime validation.{:error, :reason}) for expected failures (network, user input, not found).rescue that catches all exceptions. If you must rescue, specify the exception type:
# Bad
rescue _ -> :error
# Good
rescue ArgumentError -> {:error, :invalid_argument}
DynamicSupervisor for spawning entity processes.Registry (:unique or :duplicate keys) instead of passing PIDs.init/1.Registry.lookup/2, never store PIDs in module attributes or config.Comn.Events) that exposes the public API.GenServer.call/2 or GenServer.cast/2 to callers — wrap in named functions.async: true in ExUnit.Case unless tests share state.start_supervised!/1, not manual start_link.assert_receive/2 and refute_receive/2 for message assertions.@moduledoc (use @moduledoc false only for private implementation modules).@doc with at least one example.@spec.@doc on each @callback.Comn.Events.NATS → lib/comn/events/nats.ex.event_struct.ex for Comn.EventStruct).Process.put/2 or Process.get/1 unless you document exactly why (e.g., Logger metadata).rescue _ -> or rescue e -> without specifying types.GenServer.call in a single handle_call.For detailed check descriptions, examples of violations, and fix patterns, see:
references/critical-checks.md — Must-fix violationsreferences/warning-checks.md — Should-fix violationsreferences/info-checks.md — Consider-fixing violationsProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub imsmith/claude-plugins-marketplace --plugin beam-style-guard