elixir-standards
Use when writing, reviewing, testing, formatting, or configuring any Elixir code (.ex/.exs files, mix.exs, mix.lock) in a touchstone repo — asdf/.tool-versions pin, Hex with committed mix.lock, mix format + Credo, typespecs + Dialyzer, OTP supervision trees, {:ok,_}/{:error,_} idioms, ExUnit + Mox, mix release with runtime.exs. Invoke before adding deps, editing tests, wiring supervisors, or changing error handling. Phoenix-specific concerns (controllers, LiveView, contexts-as-web) → phoenix skill.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- elixir-standards
- license
- MIT
- metadata
- { "author": "touchstone", "version": "0.2.0" }
- description
- Use when writing, reviewing, testing, formatting, or configuring any Elixir code (.ex/.exs files, mix.exs, mix.lock) in a touchstone repo — asdf/.tool-versions pin, Hex with committed mix.lock, mix format + Credo, typespecs + Dialyzer, OTP supervision trees, {:ok,_}/{:error,_} idioms, ExUnit + Mox, mix release with runtime.exs. Invoke before adding deps, editing tests, wiring supervisors, or changing error handling. Phoenix-specific concerns (controllers, LiveView, contexts-as-web) → phoenix skill.
03 SKILL.md 正文
Elixir Standards
Full standard: standards/languages/elixir.md in the touchstone repo. This skill inlines the
load-bearing rules so it stays useful even when installed standalone in ~/.claude/skills/:
Always
- Pin Elixir + OTP in
.tool-versions(1.18+ floor, target 1.20 / OTP 27+) via asdf/mise — never a system Erlang; same strings CI installs. - Hex deps with committed
mix.lock(apps and libraries);mix deps.getfrom the lock,mix deps.unlock --unusedclean. - Format with
mix format(CI:--check-formatted); compile with--warnings-as-errors; lint withmix credo --strict. @specpublic functions; runmix dialyzerwith a cached PLT — new warnings fail the build.- Test with ExUnit
async: true; mock behaviours via Mox, not modules;start_supervised!/1for processes.
Don't get burned
- "Let it crash" is for the unexpected — supervise the recovery; don't
rescue/tryaround expected failures, which return{:ok, _}/{:error, reason}with matchable reasons (not bare strings). Bang functions raise only where a caller can't recover. - Everything under a supervision tree — explicit
child_spec, never barespawn; pick:one_for_one/:rest_for_one/:one_for_alldeliberately.Registry/:viafor names; never build process names from user input (atoms aren't GC'd).DynamicSupervisor/Task.Supervisorfor runtime children. with/elseto chain{:ok, _}steps — keepelseexplicit so an error tag isn't swallowed. Pattern-match in function heads.Task.async_stream(boundedmax_concurrency+:timeout) for parallel I/O; Broadway/GenStage for back-pressured pipelines (scale-up). Never share mutable state across processes; ETS for shared read-heavy caches.- Prod runs a
mix release— no Mix at runtime; all runtime config inconfig/runtime.exs, fail-fast on missing env (System.fetch_env!). Run migrations from a release command, notmix ecto.migrate. mix deps.auditclean; emit:telemetryat boundaries; structuredLoggermetadata, no secrets. Ecto/SQL depth →standards/platform/database.md.
Done
mix format --check-formatted + compile --warnings-as-errors clean · mix credo --strict clean · mix dialyzer clean (specs on public fns) · mix test green (async, Mox) · mix.lock committed, mix deps.audit clean · supervised, no bare spawn · mix release with config/runtime.exs. See standards/languages/elixir.md.
04 同仓库更多 Skills
ok-standards
Use when writing shell, per standards/languages/shell.md.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.