skill/elixir-review/SKILL.md
# Elixir Code Review Skill ## Overview Comprehensive code review patterns for Elixir applications focusing on BEAM VM performance, security, concurrency safety, and code quality metrics. ## BEAM VM Performance Analysis ### Process Management - **Process Count:** Monitor with `:observer.start()` - avoid creating >1M processes without justification - **Process Isolation:** Ensure processes don't share mutable state - use message passing exclusively - **Process Linking:** Review supervisor trees
npx skillsauth add vircung/opencode-config skill/elixir-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive code review patterns for Elixir applications focusing on BEAM VM performance, security, concurrency safety, and code quality metrics.
:observer.start() - avoid creating >1M processes without justification# ❌ Avoid: Shared mutable state
Agent.update(pid, fn state -> Map.put(state, key, large_data) end)
# ✅ Prefer: Immutable message passing
GenServer.cast(pid, {:update, key, value})
:fprof or :eprof for function-level profiling:observer memory tab:scheduler.utilization(1)# ✅ Always validate external input
def create_user(params) do
changeset = User.changeset(%User{}, params)
if changeset.valid? do
Repo.insert(changeset)
else
{:error, changeset}
end
end
# ❌ Avoid: Direct parameter usage
def create_user(params) do
Repo.insert(%User{name: params["name"], email: params["email"]})
end
protect_from_forgery in controllersPlug.SecureHeaders for HSTS, frame options# ❌ Race condition potential
def increment_counter(pid) do
current = GenServer.call(pid, :get)
GenServer.call(pid, {:set, current + 1})
end
# ✅ Atomic operation
def increment_counter(pid) do
GenServer.call(pid, :increment)
end
# ✅ Proper resource cleanup
def handle_call({:process_file, path}, _from, state) do
try do
file = File.open!(path, [:read])
result = process_file_content(file)
{:reply, {:ok, result}, state}
after
File.close(file)
end
end
# ✅ Explicit error handling
with {:ok, user} <- Users.find(id),
{:ok, permissions} <- Auth.get_permissions(user),
{:ok, data} <- fetch_data(user, permissions) do
{:ok, data}
else
{:error, :user_not_found} -> {:error, "User not found"}
{:error, :insufficient_permissions} -> {:error, "Access denied"}
{:error, reason} -> {:error, "Operation failed: #{reason}"}
end
# ❌ Avoid: Nested case statements
case Users.find(id) do
{:ok, user} ->
case Auth.get_permissions(user) do
{:ok, permissions} -> fetch_data(user, permissions)
{:error, _} -> {:error, "Access denied"}
end
{:error, _} -> {:error, "User not found"}
end
@moduledoc@doc with examples@spec for all public functions@doc examples that can be tested with doctests<> in loops instead of building listsGenServer.call vs castRepo.preload causing multiple queries# ❌ Security anti-patterns
def execute_command(user_input) do
System.cmd("sh", ["-c", user_input]) # Command injection risk
end
def build_query(table, user_where) do
"SELECT * FROM #{table} WHERE #{user_where}" # SQL injection risk
end
# ✅ Secure alternatives
def allowed_commands, do: ["ls", "pwd", "whoami"]
def execute_safe_command(cmd) when cmd in @allowed_commands do
System.cmd(cmd, [])
end
elixir-architecture for context boundary validationelixir-otp for supervisor tree and GenServer pattern reviewelixir-ecto patterns for query and schema validationelixir-phoenix-framework for web-specific security patterns# Run these tools during review
mix credo --strict # Code quality analysis
mix dialyzer # Type checking
mix deps.audit # Security vulnerability scanning
mix format --check-formatted # Code formatting verification
# Add to review checklist
:observer.start() # BEAM VM monitoring
:debugger.start() # Process debugging
:fprof.start() # Function profiling
mix test - all tests passmix credo --strict - no issuesmix dialyzer - no type errorswith statements appropriatelyassign patternsUse this skill to ensure Elixir code meets BEAM VM best practices, security standards, and performance requirements while maintaining the functional programming paradigms that make Elixir powerful.
development
Python code security analysis, performance optimization, and maintainability assessment
development
Modern Python coding standards, best practices, testing patterns, and implementation guidelines
development
Python system design patterns, project structure, and scalable architecture guidelines
development
# Elixir Phoenix Framework Skill ## Overview Comprehensive Phoenix framework patterns focusing on generators, LiveView, context design, and version-specific best practices. Emphasizes generator-first development approach. ## Phoenix Generator Reference Guide ### Core Generators ```bash # Project scaffolding mix phx.new app_name # New Phoenix application mix phx.new app_name --umbrella # Umbrella application mix phx.new app_name --no-ecto # Without Ecto data