Elixir Code Review
by @anderskev
Reviews Elixir code for idiomatic patterns, OTP basics, and documentation. Use when reviewing .ex/.exs files, checking pattern matching, GenServer usage, or...
clawhub install elixir-code-reviewπ About This Skill
name: elixir-code-review description: Reviews Elixir code for idiomatic patterns, OTP basics, and documentation. Use when reviewing .ex/.exs files, checking pattern matching, GenServer usage, or module documentation.
Elixir Code Review
Quick Reference
| Issue Type | Reference | |------------|-----------| | Naming, formatting, module structure | references/code-style.md | | With clauses, guards, destructuring | references/pattern-matching.md | | GenServer, Supervisor, Application | references/otp-basics.md | | @moduledoc, @doc, @spec, doctests | references/documentation.md |
Review Checklist
Code Style
Pattern Matching
OTP Basics
Documentation
Security
String.to_atom/1 on user input (use to_existing_atom/1)Code.eval_string/1 on untrusted input:erlang.binary_to_term/1 without :safe optionValid Patterns (Do NOT Flag)
def foo(nil), do: nil is valid guard|> with single transformation - Readability choice, not wrong@doc false on callback implementations - Callbacks documented at behaviour levelKernel.apply/3 - Valid for dynamic dispatch with known module/functionContext-Sensitive Rules
| Issue | Flag ONLY IF | |-------|--------------| | Missing @spec | Function is public AND exported | | Generic rescue | Specific exception types available | | Nested case/cond | More than 2 levels deep |
When to Load References
Gates β before reporting
Do these in order for the review batch. Do not publish findings until each step passes.
1. Protocol loaded β Read review-verification-protocol and apply its checks for each finding category you use (unused, validation, security, performance, etc.). Pass: For every substantive finding, you can name which protocol subsection you satisfied or state N/A with reason (pure style).
2. Anchored evidence β Pass: Each finding includes a concrete locator: path:line (or line range), or Module.function/arity plus a short quoted snippet from the file.
3. Claims backed by artifacts β For assertions like unused code, missing validation, or security risk, Pass: You attach the supporting artifact (e.g. search results, file read scope) or downgrade the item to an explicit question / uncertain with what you did not verify.
Before Submitting Findings
Complete Gates β before reporting (section above) first; the verification protocol is mandatory input to those gates.