Skip to content
Back to skills

Elixir Knowledge Patch

ASecurity

Elixir

  • 25 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 5, 2026
developmentpythonrustswiftshellnodeexpresstestingapibackendsecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 9 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-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-elixir-knowledge-patch-nevaberry-plugins)

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 applications, addressing compiler warnings,
changing Mix or ExUnit workflows, or working with Erlang/OTP, Ecto, Phoenix,
LiveView, and language interoperability. Use the topic references for complete
behavior, examples, and version-specific qualifications.

## Reference index

| Reference | Topics |
| --- | --- |
| [Elixir language and core](references/elixir-language-and-core.md) | Syntax, macros, protocols, calendars, strings, JSON, files, processes, Logger |
| [Types and static analysis](references/types-and-static-analysis.md) | Inference, call checking, guards, reachability, tuple/list/map types |
| [Tooling, testing, and releases](references/tooling-testing-and-releases.md) | Runtime compatibility, compilation, dependencies, Mix, ExUnit, IEx, release artifacts |
| [Erlang/OTP](references/erlang-otp.md) | Code paths, warnings, security, comprehensions, collections, tracing, shell, Dialyzer |
| [Ecto](references/ecto.md) | Query and adapter migrations, projections, preloads, writes, schemas, changesets |
| [Phoenix and LiveView](references/phoenix-and-liveview.md) | Controllers, layouts, scopes, authentication, HEEx, hooks, rendering, tests |
| [Interoperability and portability](references/interop-and-portability.md) | Popcorn, Hologram, Fine, Rustler, Zigler, Pythonx, Swift distribution |

## Breaking changes and deprecations

### Compilation and module loading

Elixir 1.20 requires Erlang/OTP 27 or later and supports OTP 29.
Modules load on demand during compilation. If a process spawned during
compilation calls another module in the same project, call
`Code.ensure_compiled!(OtherModule)` before spawning the process, or use
`Kernel.ParallelCompiler.pmap/2` so the compiler can track the parallel work.

An `@on_load` callback can fail if it calls a module in the same project that has
yet to load. Set `@compile {:autoload, true}` in the module the callback calls.
Migrate the hard-deprecated `Kernel.ParallelCompiler.async/1` to
`Kernel.ParallelCompiler.pmap/2`.

`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 compiler warning.

### Core API migrations

| Existing usage | Migration |
| --- | --- |
| GenServer `format_status/2` | Implement `format_status/1`; the former callback is soft-deprecated. |
| `Macro.struct!/2` | Use `Macro.struct_info!(module, __CALLER__)` for struct field metadata. |
| `__deriving__/3` on the `Any` implementation | Define the optional `__deriving__/1` macro in the protocol. |
| Two-argument slicing function from `Enumerable.slice/1` | Accept `start`, `length`, and `step`. |
| Descending `Range.new/2` with an inferred step | Supply the step explicitly, as in `Range.new(5, 1, -1)`. |
| `Tuple.append(tuple, item)` | Use `Tuple.insert_at(tuple, tuple_size(tuple), item)`. |
| Modes second in `File.stream!` | Put line mode or byte count first: `File.stream!("events.log", :line, [:utf8])`. |
| Direct conflict callback as the third file-copy argument | Use a keyword option, as in `File.cp(source, destination, on_conflict: callback)`. |
| Positional name domain and tick time for node startup | Use the keyword-list form of `Node.start/2`. |
| `ExUnit.Case.register_test/4` | Use `ExUnit.Case.register_test/6` in custom test macros. |

### Source and template migrations

Implicit steps are deprecated in range patterns and range construction in
guards. Write `left..right//step`, or `left..right//_` in a pattern for any step.
Escaping an uppercase sigil's closing delimiter is deprecated; choose a
delimiter absent from the content, as in `~S|a/b|`.

Replace EEx comments `<%# ... %>` with `<%!-- ... --%>`. Custom EEx engines
should implement `handle_text(state, metadata, text)` as `handle_text/3`.
The old comment opener and two-argument callback are hard-deprecated.

The parser rejects literal carriage returns inside strings, inside comments,
and immediately after `?`. Use `"\r"` or `?\r` for carriage-return values.
Pin an already bound variable used as a segment size in a bitstring match:

```elixir
size = 8
<<byte::size(^size)>> = <<42>>
```

`defprotocol` blocks no longer allow `defstruct/1` or `defexception/1`; move
the struct or exception to a separate module. Match the expected struct before
using struct update syntax.

### Mix and Logger configuration

Set `:elixirc_paths` to a list of strings; Mix rejects other values.
Move `xref: [exclude: ...]` to `elixirc_options: [no_warn_undefined: ...]`.
Move `warnings_as_errors: true` out of `:elixirc_options` and
`:test_elixirc_options`; pass `--warnings-as-errors` to `mix compile` and
`mix test`, or use task aliases to keep the setting in the project.

Move `:default_task`, `:preferred_cli_env`, and `:preferred_cli_target` from
`project/0` to `:default_task`, `:preferred_envs`, and `:preferred_targets` in
`cli/0`. Separate `mix do` tasks with `+`; comma separators are deprecated.
`mix cmd` passes arguments directly by default; shell constructs need `--shell`.
Protocol consolidation runs in `compile.elixir`; `mix compile.protocols` has no
effect. Use `mix compile --no-consolidate-protocols` to disable consolidation.

Migrate hard-deprecated `Logger.*_backend` calls to Logger handlers;
applications still using the backend 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())`.
The `: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.

### Phoenix, LiveView, and Ecto upgrades

`use Phoenix.Controller` requires `:formats`, which can be `[]` if determined
later. Pass the module and name together to `put_layout/2`; bare names are
deprecated even in per-format options. `Phoenix.Endpoint` drops the injected
`config` variable; use `Application.compile_env/3` for compile-time configuration.

`put_secure_browser_headers` adds
`content-security-policy: base-uri 'self'; frame-ancestors 'self';` when no CSP
header exists. Set an explicit CSP if a third-party site needs to embed the app.
Generated templates call layouts such as `app.html.heex` as function components.

For LiveView upgrades, use `mix igniter.upgrade phoenix_live_view` to upgrade
from 1.0 automatically, or add
`compilers: [:phoenix_live_view] ++ Mix.compilers()` in `project/0` manually.
Colocated scripts require Phoenix 1.8 or later; the Phoenix and LiveView reference
contains the esbuild setup. Rename legacy hooks whose literal names start with
a dot: a leading dot now qualifies the name with the template's module.

LiveViewTest uses `:lazy_html`; replace Floki-specific `:fl-contains()` and
`:fl-icontains()` selectors with `element/3` text filters. Duplicate DOM and
LiveComponent IDs raise by default; `on_error` controls handling.

Ecto rejects `on_conflict: {:replace, []}`; use `on_conflict: :nothing` to leave
conflicting rows untouched. It no longer accepts `:array_join` joins.
Use `Ecto.ParameterizedType.init/2` to construct parameterized types, and update
adapter clause handlers from `Ecto.Query.QueryExpr` to `Ecto.Query.ByExpr` for
`distinct`, `group_by`, `order_by`, and window expressions.

### Runtime and security-sensitive behavior

On OTP 28, compiled values from `re:compile/2` cannot be reused across nodes or
OTP versions; compile regex source on each node that needs it. A regex literal
cannot be a `defstruct` field default on OTP 28; assign it at construction.

On OTP 29, the code server searches `.` last by default. The SSH daemon disables
shell, exec, and SFTP services by default; include options for the needed services.
`gb_sets:from_ordset/1` and `gb_trees:from_orddict/1` reject unordered input;
use `gb_sets:from_list/1` or `gb_trees:from_list/1` when input may be unsorted.

Elixir 1.18.6 and 1.20.5 enforce URI port bounds and reject JSON integers outside
the float64 range. In Elixir 1.20.5, reaching the regex engine's match limit
raises `SystemLimitError`; earlier versions reported no match.

## Frequently used features

### Type checking and diagnostics

For a `dynamic(type)` argument, the checker accepts any overlap with the parameter
type and warns when the types are disjoint. It refines arguments from use,
tracks map keys through `Map.put`, `Map.replace`, and `Map.delete`, and uses earlier
branches to refine later ones. Put specific struct clauses before `%_{}` when
they need separate handling.

`if_set(type)` marks a literal map key as optional. Keys written as types are
also optional. Cross-module inference treats calls to other modules in the same
project as `dynamic()`; the subsequent whole-project check uses their inferred
types. The checker assumes a `for` body executes at least once; when an empty
list is a valid path, guard the comprehension with `if items != [] do`.

### Compilation and test workflows

The `:module_definition` compiler option defaults to `:compiled`. To interpret
module bodies, use `elixirc_options: [module_definition: :interpreted]` in
`project/0`. In that mode, anonymous functions evaluated in `defmodule` bodies
take at most 20 arguments; `def` functions still support up to 255. Compile-time
stack traces may be less precise.

ExUnit runs a module once per map in `parameterize:`; with `async: true`, those
runs can execute concurrently. Modules in the same concurrency `group` run
serially, while different groups can run concurrently.

Use `mix test --dry-run` to see selected tests without executing their bodies,
`--repeat-until-failure` to stop repetitions at the first failure, and
`--slowest-modules` to report modules by combined test times.
`mix format --no-compile` skips compilation. `mix format --migrate` rewrites the
AST, so review the result where macros also rewrite it.

### Calendar and data operations

`Date.shift/2` accepts calendar units, and `DateTime.shift/2` accounts for time-zone
transitions. Month shifts can clamp the day, so two one-month shifts can differ
from one two-month shift. `Kernel.to_timeout/1` converts durations to timeouts.

Ecto scalar subqueries can appear in `distinct`, `group_by`, `order_by`, and
windows. `select_merge` can build projections for `Repo.insert_all/3` or a
subquery. A two-argument `Repo.preload/3` loader receives IDs first and association
metadata second. `allow_stale: true` on a struct or changeset write suppresses
`Ecto.StaleEntryError`.

### LiveView rendering and scoped resources

Use `{expr}` for ordinary HEEx tag-body interpolation; retain `<%= %>` for blocks
generating distinct markup and interpolation inside `<script>` and `<style>`.
Use a stable `:key` on `:for` HTML tags or components to track reordering; slot
entries cannot take `:key`. `JS.ignore_attributes/1` on `phx-mounted` preserves
browser-controlled attributes across patches.

Generated scoped 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 use `{:created, post}`,
`{:updated, post}`, and `{:deleted, post}`; reload the scoped query with
`reset: true` to replace the streamed list.

Files in this skill

  • SKILL.md11 KB
  • coverage.json1.9 KB
  • references/ecto.md2.9 KB
  • references/elixir-language-and-core.md6 KB
  • references/erlang-otp.md11.3 KB
  • references/interop-and-portability.md2.6 KB
  • references/phoenix-and-liveview.md6.7 KB
  • references/tooling-testing-and-releases.md7.1 KB
  • references/types-and-static-analysis.md6.1 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.