Skip to content
Back to skills

Elixir Knowledge Patch

ASecurity

Elixir

  • 25 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
developmentjavascriptpythonrustjavaswiftshellnodetestingapidatabase

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill elixir-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Elixir Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Elixir Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-elixir-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-elixir-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: elixir-knowledge-patch
description: Elixir
version: "1.20.5"
license: MIT
metadata:
  author: Nevaberry
---


# Elixir Knowledge Patch

Load this skill when updating Elixir code, interpreting compiler diagnostics,
changing Mix or ExUnit workflows, or working with Erlang/OTP, Ecto, Phoenix,
LiveView, and the interoperability tools indexed below.
Use the quick references for common changes and the topic files for full
conditions, examples, and version-specific attribution.

## Reference index

| Reference | Topics |
| --- | --- |
| [Elixir language and core](references/elixir-language-and-core.md) | Syntax, macros, protocols, calendars, strings, JSON, files, processes, inspection, EEx |
| [Types and static analysis](references/types-and-static-analysis.md) | Inference scope, gradual types, lists, tuples, map keys, guards, control flow, struct checks |
| [Tooling, testing, and releases](references/tooling-testing-and-releases.md) | Runtime compatibility, compilation, dependencies, Mix, formatting, ExUnit, IEx, logging, packaging |
| [Erlang/OTP](references/erlang-otp.md) | Code paths, syntax, collections, ETS, JSON, tracing, profiling, terminal I/O, warnings, TLS, SSH |
| [Ecto](references/ecto.md) | Query composition, preloads, writes, schemas, changesets, adapter migration |
| [Phoenix and LiveView](references/phoenix-and-liveview.md) | Controllers, layouts, authentication, scopes, HEEx, hooks, DOM updates, testing, generators |
| [Interoperability and portability](references/interop-and-portability.md) | Popcorn, Hologram, Fine, Rustler, Zigler, Pythonx, Swift distribution |

## Migration quick reference

### Syntax and core APIs

- Escaping an uppercase sigil's closing delimiter is deprecated. Choose a
  delimiter absent from the content, such as `~S|a/b|`.
- Implicit steps are deprecated in range patterns and range construction in
  guards. Write `left..right//step`, or `left..right//_` in a pattern.
  For descending bounds, replace inferred `Range.new/2` steps with an explicit
  step, such as `Range.new(5, 1, -1)`.
- `require MyMacros` still returns the module at runtime but no longer expands
  to a module literal. Put it on its own line before `MyMacros.expand()` and
  remove unused requires to clear the new warning.
- Pin an already bound bitstring segment size, as in
  `<<byte::size(^size)>> = <<42>>` after `size = 8`.
- Literal carriage returns are rejected inside strings, inside comments, and
  immediately after `?`. Use `"\r"` or `?\r` for carriage-return values.
- `defprotocol` blocks no longer allow `defstruct/1` or `defexception/1`;
  move the struct or exception to a separate module. For custom derivation,
  use the protocol's optional `__deriving__/1` macro; the `Any`
  implementation's `__deriving__/3` hook is soft-deprecated.
- Use `Macro.struct_info!(module, __CALLER__)` for field metadata in macros;
  `Macro.struct!/2` is soft-deprecated. Use `format_status/1` in GenServers;
  `format_status/2` is soft-deprecated.
- Pass file stream line mode or byte count before file modes:
  `File.stream!("events.log", :line, [:utf8])`. Modes second is hard-deprecated.
  Pass copy conflict callbacks as `on_conflict: callback` to `File.cp/3` and
  `File.cp_r/3`; a callback directly in the third argument is deprecated.
- Replace EEx comments `<%# ... %>` with `<%!-- ... --%>`.
  Custom EEx engines should implement `handle_text/3`; the two-argument
  callback is hard-deprecated.

### Compilation, Mix, and logging

- Modules load on demand during compilation. Before spawning a compile-time
  worker that calls another module in the project, call
  `Code.ensure_compiled!(OtherModule)`, or use `Kernel.ParallelCompiler.pmap/2`
  for parallel maps the compiler can track.
- An `@on_load` callback can fail when it calls a project module that has yet
  to load. Set `@compile {:autoload, true}` in the module the callback calls.
- Migrate hard-deprecated `Kernel.ParallelCompiler.async/1` calls to
  `Kernel.ParallelCompiler.pmap/2`. Set `:elixirc_paths` to a list of strings;
  Mix rejects other values.
- Move `warnings_as_errors: true` out of `:elixirc_options` and
  `:test_elixirc_options`; pass `--warnings-as-errors` to `mix compile` and
  `mix test`. Move `xref: [exclude: ...]` to
  `elixirc_options: [no_warn_undefined: ...]`.
- `mix cmd` passes arguments directly by default. Put `--shell` before the
  command for shell constructs. Move app selection to `mix do`, as in
  `mix do --app my_app cmd pwd`. Separate tasks with `+`:
  `mix do compile + test`; comma separators are deprecated.
- Move `:default_task`, `:preferred_cli_env`, and `:preferred_cli_target`
  out of `project/0`; define `:default_task`, `:preferred_envs`, and
  `:preferred_targets` in `cli/0`.
- Protocol consolidation runs in `compile.elixir`; `mix compile.protocols`
  has no effect. Use `mix compile --no-consolidate-protocols` to disable it.
- The Logger `:backends` configuration is deprecated. Use
  `config :logger, default_handler: false` to disable the default handler,
  or start custom backends from the application's start callback.
- Migrate hard-deprecated `Logger.*_backend` calls to Logger handlers;
  applications still using that API can use `:logger_backends`.
  Replace `Logger.disable(self())` with
  `Logger.put_process_level(self(), :none)` and `Logger.enable(self())`
  with `Logger.delete_process_level(self())`.

### Web and database upgrades

- `use Phoenix.Controller` requires `:formats`, which can be `[]` if formats
  are determined later. `:namespace` and `:put_default_views` emit deprecation
  warnings. Pass a module and name to `put_layout/2`; bare names are deprecated.
- The `Phoenix.Router` option `:trailing_slash` is deprecated; use
  `Phoenix.VerifiedRoutes` to generate paths. `Phoenix.Endpoint` drops the
  injected `config` variable; use `Application.compile_env/3` at compile time.
- When the response has no CSP header, `put_secure_browser_headers` adds
  `content-security-policy: base-uri 'self'; frame-ancestors 'self';`.
  Set an explicit CSP if a third-party site needs to embed the app.
  The defaults drop `x-download-options` and `x-frame-options`.
- Colocated scripts require Phoenix 1.8 or later. A leading dot in `phx-hook`
  now qualifies the hook name with the template's module at compile time;
  rename legacy hooks whose literal names start with a dot.
  The Phoenix reference includes the compiler and esbuild upgrade setup.
- LiveViewTest's new parser uses `{:lazy_html, ">= 0.0.0", only: :test}`.
  Replace Floki-specific `:fl-contains()` and `:fl-icontains()` with `element/3`
  text filters. Duplicate DOM and LiveComponent IDs raise by default;
  `on_error` on `live/3` and `live_isolated/3` controls handling.
- Ecto rejects `:array_join` and `on_conflict: {:replace, []}`.
  Use `on_conflict: :nothing` to leave conflicting rows untouched.
  Query and repository `:prefix` values should be strings; non-binary values
  produce a warning. Construct parameterized types with
  `Ecto.ParameterizedType.init/2`.

### Runtime and corrected behavior

- On OTP 28, regex literals cannot be `defstruct` defaults; assign the regex
  when constructing the struct. The PCRE2-based `re` rejects escapes such as
  `\M`; compile regex source on each node because compiled values cannot be
  reused across nodes or OTP versions.
- OTP 29 disables SSH shell, exec, and SFTP services by default; include the
  options for needed services. The working directory is searched last on the
  code path, losing precedence over same-named OTP or application modules.
- Elixir 1.18.6 and 1.20.5 enforce URI port bounds and raise for JSON integers
  outside the float64 range. In Elixir 1.20.5, reaching the regex match limit
  raises `SystemLimitError`; earlier versions reported no match.
- In Elixir 1.20.5, `Duration.from_iso8601/1` rejects inputs longer than
  192 bytes and a fractional seconds component after whole seconds,
  such as `PT1S2.5S`.

## Type checking quick reference

- For a `dynamic(type)` argument, calls accept any overlap with the parameter
  type and warn when the types are disjoint. Function arguments start at
  `dynamic()` and are refined from use.
- `when is_map_key(map, :foo)` requires the key; its negation infers
  `%{..., foo: not_set()}`, so `map.foo` in that clause triggers a warning.
  `if_set(type)` marks a literal map key as optional.
- On unknown map shapes, `Map.put(map, :age, 42)` infers a required `:age` key
  with an integer value. `Map.replace(map, :age, 42)` infers an optional `:age`
  key with an integer value when present; `Map.delete(map, :age)` infers its absence.
  A function using `Map.fetch!(map, :age)`
  can infer that its callers must supply that key.
- Tuple size guards refine arity. Map and list size guards distinguish empty
  from nonempty collections. Earlier branches refine later branches in
  `case` and conditionals and can expose redundant clauses.
- The checker assumes a `for` body executes at least once. When an empty list
  is a valid path, guard the comprehension with an explicit condition such as
  `if items != [] do`.
- Inference uses signatures from the current module, standard library, and
  dependencies. Calls to other modules in the same project are treated as
  `dynamic()` during inference; the subsequent whole-project check uses
  the inferred types from those modules.
- Match the expected struct before struct update syntax. A match also lets
  the compiler check keys with map update syntax. Put specific struct clauses
  before a `%_{}` catch-all if they need separate handling.

## Compilation and testing quick reference

- `:module_definition` defaults to `:compiled`. Set
  `elixirc_options: [module_definition: :interpreted]` to interpret module bodies.
  In that mode, anonymous functions evaluated in a `defmodule` body support
  at most 20 arguments; functions declared with `def` still support 255.
  Compile-time stack traces may be less precise.
- `mix format --migrate` rewrites the AST; review the result where macros also
  rewrite the AST. `mix format --no-compile` skips compilation.
- ExUnit runs an entire module once per map in `parameterize:`. With
  `async: true`, parameter runs can execute concurrently. Async modules in
  the same `group:` run serially; different groups can run concurrently.
- Use `mix test --dry-run` to see which tests would run without executing bodies,
  `mix test --name-pattern checkout` to filter by name, and
  `--repeat-until-failure` to stop repetitions at the first failure.
  `--slowest-modules` reports modules by combined test times.
- Custom test macros should use `ExUnit.Case.register_test/6`;
  `register_test/4` is deprecated. For guarded checks, use
  `assert match?(n when n > 0, value)`; guarded `assert` matches with `=` raise.

## Phoenix and LiveView quick reference

- Use `{expr}` for ordinary HEEx tag bodies. Keep `<%= %>` for blocks producing
  distinct markup and for interpolation inside `<script>` and `<style>`.
- Generated resource LiveViews pass `socket.assigns.current_scope` first to
  context functions. Put their routes in the authenticated `live_session` so
  the auth hook populates that assign. Scoped PubSub updates can reload the
  scoped query with `reset: true` to replace the streamed list.
- Use a stable `:key` with `:for` on HTML tags or components to track reordering.
  Slot entries keep the previous change tracking and cannot take `:key`.
- `Phoenix.Component.portal/1` moves content to its CSS `target` once LiveView
  connects; events still reach the owner. Run `JS.ignore_attributes/1` on
  `phx-mounted` to preserve browser-controlled attributes across patches.
- The right side of Ecto query `in` accepts any `Enumerable`. Two-argument
  functions passed to `Repo.preload/3` receive IDs first, association metadata
  second. `allow_stale: true` on a
  struct or changeset write suppresses `Ecto.StaleEntryError`.

## Core, OTP, and interoperability quick reference

- `Date.shift/2` accepts calendar units; `DateTime.shift/2` accounts for time-zone
  transitions. Month shifts can clamp days, so two one-month shifts can differ
  from a single two-month shift. `Kernel.to_timeout/1` converts durations to
  timeouts usable with process and GenServer APIs.
- `String.byte_slice/3` uses byte offsets and counts, dropping partial UTF-8
  code points at boundaries. `JSON.encode!/1` converts integer and atom map
  keys to JSON strings; Calendar types implement `JSON.Encoder`.
- `ets:first_lookup/1` and `ets:next_lookup/2` return keys with matching objects
  when there is an entry.
  `ets:update_element/4` accepts a default tuple for a missing key.
- On OTP 27, use `mix profile.tprof`; `tprof` can measure call counts, time,
  and allocated words. Independent `trace` sessions have their own tracer,
  process configuration, and function configuration.
- Popcorn runs a subset of Elixir in the browser on AtomVM compiled to
  WebAssembly. Hologram transpiles Elixir to JavaScript on top of Phoenix.
- Fine, Rustler, and Zigler provide the native binding workflows in the
  interoperability reference. Pythonx's `~PY` uses Elixir bindings in embedded
  Python; `Pythonx.uv_init/1` provisions Python and dependencies with uv.
  Swift programs can communicate with Erlang and Elixir nodes through
  Erlang distribution.

Files in this skill

  • SKILL.md4.9 KB
  • references/elixir-apis-and-mix.md2.7 KB
  • references/elixir-type-system.md1.6 KB
  • references/liveview-js-and-hooks.md2.5 KB
  • references/liveview-templates-and-streams.md1.3 KB
  • references/phoenix-1-8.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.